From 5c25c42da8cba64c666bfe83e06da1ee46db1ab4 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Wed, 20 Jan 2016 22:14:17 +0000 Subject: [PATCH] Make installPiholeWeb() more inteliigent. Checks for existence of /var/www/html/pihole, and only downloads from repo if it does not exist. Will stop install script from overwriting any tweaks users have made to index.html --- automated install/basic-install.sh | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index e2a7fdd4..1448afda 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -252,35 +252,41 @@ $SUDO apt-get -y install git } installWebAdmin(){ +$SUDO echo " " if [ -d "/var/www/html/admin" ]; then $SUDO rm -rf /var/www/html/admin fi if [ -d "/var/www/html/AdminLTE-master" ]; then $SUDO rm -rf /var/www/html/AdminLTE-master fi -$SUDO echo ":::Downloading and installing latest WebAdmin files..." +$SUDO echo "::: Downloading and installing latest WebAdmin files..." $SUDO wget -nv https://github.com/jacobsalmela/AdminLTE/archive/master.zip -O /var/www/master.zip $SUDO unzip -oq /var/www/master.zip -d /var/www/html/ $SUDO mv /var/www/html/AdminLTE-master /var/www/html/admin $SUDO rm /var/www/master.zip 2>/dev/null -$SUDO echo ":::...Done." +$SUDO echo "::: ...Done." -$SUDO echo ":::Creating log file and changing owner to dnsmasq..." -if [ ! -f /var/log/pihole.log ]; then - $SUDO touch /var/log/pihole.log - $SUDO chmod 644 /var/log/pihole.log - $SUDO chown dnsmasq:root /var/log/pihole.log - $SUDO echo ":::...Done." +$SUDO echo "::: Creating log file and changing owner to dnsmasq..." +if [ ! -f /var/log/pihole.log ]; then + $SUDO touch /var/log/pihole.log + $SUDO chmod 644 /var/log/pihole.log + $SUDO chown dnsmasq:root /var/log/pihole.log + $SUDO echo "::: ...Done." else - $SUDO echo ":::No need to create, already exists!" + $SUDO echo "::: No need to create, already exists!" fi } installPiholeWeb(){ -$SUDO mkdir /var/www/html/pihole -$SUDO mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig -$SUDO curl -o /var/www/html/pihole/index.html https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html +$SUDO echo " " +if [ -d "/var/www/html/pihole" ]; then + $SUDO echo "::: Existing pihole custom page detected, not overwriting" +else + $SUDO mkdir /var/www/html/pihole + $SUDO mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig + $SUDO curl -o /var/www/html/pihole/index.html https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html +fi } installCron(){