From 6953c02402919e05460e080664ee5c76d284b110 Mon Sep 17 00:00:00 2001 From: jacobsalmela Date: Sun, 21 Jun 2015 07:50:02 -0500 Subject: [PATCH] detect original pihole and backup Detects if the Pi had an original Pi-hole by looking for adList.conf. If it exists, it backs up all the files to /etc/pihole/original. Then, the script continues as normal and creates the new files. This helps ensure that /etc/hosts and /etc/dnsmasq.d/adList.conf are not being used simultaneously. --- automated install/basic-install.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 43f9d66..87f48ce 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -24,6 +24,19 @@ echo " Press Enter when ready " echo " " read +if [[ -f /etc/dnsmasq.d/adList.conf ]];then + echo "Original Pi-hole detected. Initiating sub space transport..." + sudo mkdir -p /etc/pihole/original/ + mv /etc/dnsmasq.d/adList.conf /etc/pihole/original/adList.conf.$(date "+%Y-%m-%d") + mv /etc/dnsmasq.conf /etc/pihole/original/dnsmasq.conf.$(date "+%Y-%m-%d") + mv /etc/resolv.conf /etc/pihole/original/resolv.conf.$(date "+%Y-%m-%d") + mv /etc/lighttpd/lighttpd.conf /etc/pihole/original/lighttpd.conf.$(date "+%Y-%m-%d") + mv /var/www/pihole/index.html /etc/pihole/original/index.html.$(date "+%Y-%m-%d") + mv /usr/local/bin/gravity.sh /etc/pihole/original/gravity.sh.$(date "+%Y-%m-%d") +else + : +fi + echo "Updating the Pi..." sudo apt-get update sudo apt-get -y upgrade