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.
This commit is contained in:
jacobsalmela 2015-06-21 07:50:02 -05:00
parent 9d700d75b6
commit 6953c02402

View file

@ -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