whiptail --msgbox --backtitle "Welcome" --title "Pi-hole automated installer""This installer will transform your Raspberry Pi into a network-wide ad blocker!"$r$c
whiptail --msgbox --backtitle "Initating network interface" --title "Static IP Needed""The Pi-hole is a SERVER so it needs a STATIC IP ADDRESS to function properly.
whiptail --msgbox --backtitle "IP information" --title "FYI: IP Conflict""It is possible your router could still try to assign this IP to a device, which would cause a conflict. But in most cases the router is smart enough to not do that.
commands["Installing a DNS server"]="sudo apt-get -y install dnsmasq";echoes+=("Installing a DNS server")
commands["Instaling a Web server and PHP"]="sudo apt-get -y install lighttpd php5-common php5-cgi php5";echoes+=("Instaling a Web server and PHP")
commands["Making an HTML folder"]="sudo mkdir /var/www/html";echoes+=("Making an HTML folder")
commands["chowning the Web server"]="sudo chown www-data:www-data /var/www/html";echoes+=("chowning the Web server")
commands["chmodding the Web server"]="sudo chmod 775 /var/www/html";echoes+=("chmodding the Web server")
commands["Giving pi access to the Web server"]="sudo usermod -a -G www-data pi";echoes+=("Giving pi access to the Web server")
commands["Stopping dnsmasq to modify it"]="sudo service dnsmasq stop";echoes+=("Stopping dnsmasq to modify it")
commands["Stopping lighttpd to modify it"]="sudo service lighttpd stop";echoes+=("Stopping lighttpd to modify it")
commands["Backing up the dnsmasq config file"]="sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig";echoes+=("Backing up the dnsmasq config file")
commands["Backing up the lighttpd config file"]="sudo mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig";echoes+=("Backing up the lighttpd config file")
commands["Backing up the default Web page"]="sudo mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig";echoes+=("Backing up the default Web page")
commands["Installing the dnsmasq config file"]="sudo curl -o /etc/dnsmasq.conf https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/dnsmasq.conf";echoes+=("Installing the dnsmasq config file")
commands["Installing the lighttpd config file"]="sudo curl -o /etc/lighttpd/lighttpd.conf https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/lighttpd.conf";echoes+=("Installing the lighttpd config file")
commands["Making a directory for the Web interface"]="sudo mkdir /var/www/html/pihole";echoes+=("Making a directory for the Web interface")
commands["Installing a blank HTML page to take place of ads"]="sudo curl -o /var/www/html/pihole/index.html https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html";echoes+=("Installing a blank HTML page to take place of ads")
commands["Downloading the Pi-hole dashboard"]="sudo wget https://github.com/jacobsalmela/AdminLTE/archive/master.zip -O /var/www/master.zip";echoes+=("Downloading the Pi-hole dashboard")
commands["Unpacking the dashboard"]="sudo unzip /var/www/master.zip -d /var/www/html/";echoes+=("Unpacking the dashboard")
commands["Renaming the dashboard"]="sudo mv /var/www/html/AdminLTE-master /var/www/html/admin";echoes+=("Renaming the dashboard")
commands["Cleaning up the dashboard temp files"]="sudo rm /var/www/master.zip 2>/dev/null";echoes+=("Cleaning up the dashboard temp files")
commands["Creating a log file for the Pi-hole"]="sudo touch /var/log/pihole.log";echoes+=("Creating a log file for the Pi-hole")
commands["chmodding the log file"]="sudo chmod 644 /var/log/pihole.log";echoes+=("chmodding the log file")
commands["chowning the log file so stats can be displayed"]="sudo chown dnsmasq:root /var/log/pihole.log";echoes+=("chowning the log file so stats can be displayed")
commands["Initating sub-space transport of gravity"]="sudo curl -o /usr/local/bin/gravity.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/gravity.sh";echoes+=("Initating sub-space transport of gravity")
commands["Initating sub-space transport of chronometer"]="sudo curl -o /usr/local/bin/chronometer.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/chronometer.sh";echoes+=("Initating sub-space transport of chronometer")