mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Addressed UAT issues and moved scripts to /opt/pihole
Symlinks now include the /etc/pihole scripts in the user's PATH.
This commit is contained in:
parent
8c45bd32b7
commit
c520c55ff4
2 changed files with 39 additions and 21 deletions
|
@ -97,7 +97,12 @@ backupLegacyPihole() {
|
||||||
$SUDO mv /etc/resolv.conf /etc/pihole/original/resolv.conf."$(date "+%Y-%m-%d")"
|
$SUDO mv /etc/resolv.conf /etc/pihole/original/resolv.conf."$(date "+%Y-%m-%d")"
|
||||||
$SUDO mv /etc/lighttpd/lighttpd.conf /etc/pihole/original/lighttpd.conf."$(date "+%Y-%m-%d")"
|
$SUDO mv /etc/lighttpd/lighttpd.conf /etc/pihole/original/lighttpd.conf."$(date "+%Y-%m-%d")"
|
||||||
$SUDO mv /var/www/pihole/index.html /etc/pihole/original/index.html."$(date "+%Y-%m-%d")"
|
$SUDO mv /var/www/pihole/index.html /etc/pihole/original/index.html."$(date "+%Y-%m-%d")"
|
||||||
$SUDO mv /usr/local/bin/gravity.sh /etc/pihole/original/gravity.sh."$(date "+%Y-%m-%d")"
|
if [ ! -d /opt/pihole ]; then
|
||||||
|
$SUDO mkdir /opt/pihole
|
||||||
|
$SUDO chown "$USER":root /opt/pihole
|
||||||
|
$SUDO chmod 1766 /opt/pihole
|
||||||
|
fi
|
||||||
|
$SUDO mv /opt/pihole/gravity.sh /etc/pihole/original/gravity.sh."$(date "+%Y-%m-%d")"
|
||||||
else
|
else
|
||||||
:
|
:
|
||||||
fi
|
fi
|
||||||
|
@ -470,14 +475,23 @@ versionCheckDNSmasq(){
|
||||||
installScripts() {
|
installScripts() {
|
||||||
# Install the scripts from /etc/.pihole to their various locations
|
# Install the scripts from /etc/.pihole to their various locations
|
||||||
$SUDO echo ":::"
|
$SUDO echo ":::"
|
||||||
$SUDO echo -n "::: Installing scripts..."
|
$SUDO echo -n "::: Installing scripts to /opt/pihole..."
|
||||||
$SUDO cp /etc/.pihole/gravity.sh /usr/local/bin/gravity.sh
|
if [ ! -d /opt/pihole ]; then
|
||||||
$SUDO cp /etc/.pihole/advanced/Scripts/chronometer.sh /usr/local/bin/chronometer.sh
|
$SUDO mkdir /opt/pihole
|
||||||
$SUDO cp /etc/.pihole/advanced/Scripts/whitelist.sh /usr/local/bin/whitelist.sh
|
$SUDO chown "$USER":root /opt/pihole
|
||||||
$SUDO cp /etc/.pihole/advanced/Scripts/blacklist.sh /usr/local/bin/blacklist.sh
|
$SUDO chmod 1766 /opt/pihole
|
||||||
$SUDO cp /etc/.pihole/advanced/Scripts/piholeLogFlush.sh /usr/local/bin/piholeLogFlush.sh
|
fi
|
||||||
$SUDO cp /etc/.pihole/advanced/Scripts/updateDashboard.sh /usr/local/bin/updateDashboard.sh
|
$SUDO cp /etc/.pihole/gravity.sh /opt/pihole/gravity.sh
|
||||||
$SUDO chmod 755 /usr/local/bin/{gravity,chronometer,whitelist,blacklist,piholeLogFlush,updateDashboard}.sh
|
$SUDO cp /etc/.pihole/advanced/Scripts/chronometer.sh /opt/pihole/chronometer.sh
|
||||||
|
$SUDO cp /etc/.pihole/advanced/Scripts/whitelist.sh /opt/pihole/whitelist.sh
|
||||||
|
$SUDO cp /etc/.pihole/advanced/Scripts/blacklist.sh /opt/pihole/bin/blacklist.sh
|
||||||
|
$SUDO cp /etc/.pihole/advanced/Scripts/piholeLogFlush.sh /opt/pihole/piholeLogFlush.sh
|
||||||
|
$SUDO cp /etc/.pihole/advanced/Scripts/updateDashboard.sh /opt/pihole/updateDashboard.sh
|
||||||
|
$SUDO cp /etc/.pihole/automated\ install/uninstall.sh /opt/pihole/uninstall.sh
|
||||||
|
$SUDO chmod 755 /opt/pihole/{gravity,chronometer,whitelist,blacklist,piholeLogFlush,updateDashboard,uninstall}.sh
|
||||||
|
for f in /opt/pihole/*; do
|
||||||
|
$SUDO ln -s /opt/pihole/"$f" /usr/local/bin/"$f"
|
||||||
|
done
|
||||||
$SUDO echo " done."
|
$SUDO echo " done."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,19 +43,20 @@ spinner()
|
||||||
function removeAndPurge {
|
function removeAndPurge {
|
||||||
# Purge dependencies
|
# Purge dependencies
|
||||||
echo ":::"
|
echo ":::"
|
||||||
dependencies=( dnsutils bc toilet figlet dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget )
|
# Nate 3/28/2016 - Removed `php5-cgi` and `php5` as they are removed with php5-common
|
||||||
|
dependencies=( dnsutils bc toilet figlet dnsmasq lighttpd php5-common git curl unzip wget )
|
||||||
for i in "${dependencies[@]}"; do
|
for i in "${dependencies[@]}"; do
|
||||||
if [ "$(dpkg-query -W --showformat='${Status}\n' "$i" | grep -c "ok installed")" -eq 1 ]; then
|
if [ "$(dpkg-query -W --showformat='${Status}\n' "$i" 2> /dev/null | grep -c "ok installed")" -eq 1 ]; then
|
||||||
while true; do
|
while true; do
|
||||||
read -rp "::: Do you wish to remove $i from your system? (y/n): " yn
|
read -rp "::: Do you wish to remove $i from your system? [y/n]: " yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) echo "::: Removing $i..."; $SUDO apt-get -y remove --purge "$i" > /dev/null & spinner $!; echo "DONE!"; break;;
|
[Yy]* ) printf ":::\tRemoving %s..." "$i"; $SUDO apt-get -y remove --purge "$i" &> /dev/null & spinner $!; printf "DONE!\n"; break;;
|
||||||
[Nn]* ) echo "::: Skipping $i"; break;;
|
[Nn]* ) printf ":::\tSkipping %s" "$i"; break;;
|
||||||
* ) echo "::: You must answer yes or no!";;
|
* ) printf "::: You must answer yes or no!";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "IF FAILED ***"
|
printf ":::\tPackage %s not installed... Not removing.\n" "$i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -64,10 +65,10 @@ echo ":::"
|
||||||
$SUDO rm /etc/dnsmasq.conf /etc/dnsmasq.conf.orig /etc/dnsmasq.d/01-pihole.conf &> /dev/null
|
$SUDO rm /etc/dnsmasq.conf /etc/dnsmasq.conf.orig /etc/dnsmasq.d/01-pihole.conf &> /dev/null
|
||||||
|
|
||||||
# Take care of any additional package cleaning
|
# Take care of any additional package cleaning
|
||||||
echo "::: Auto removing remaining dependencies"
|
printf "::: Auto removing remaining dependencies"
|
||||||
$SUDO apt-get -y autoremove &> /dev/null & spinner $!; echo "DONE!";
|
$SUDO apt-get -y autoremove &> /dev/null & spinner $!; printf "DONE!\n";
|
||||||
echo "::: Auto cleaning remaining dependencies"
|
printf "::: Auto cleaning remaining dependencies"
|
||||||
$SUDO apt-get -y autoclean &> /dev/null & spinner $!; echo "DONE!";
|
$SUDO apt-get -y autoclean &> /dev/null & spinner $!; printf "DONE!\n";
|
||||||
|
|
||||||
# Call removeNoPurge to remove PiHole specific files
|
# Call removeNoPurge to remove PiHole specific files
|
||||||
removeNoPurge
|
removeNoPurge
|
||||||
|
@ -113,21 +114,24 @@ function removeNoPurge {
|
||||||
$SUDO rm /usr/local/bin/whitelist.sh &> /dev/null
|
$SUDO rm /usr/local/bin/whitelist.sh &> /dev/null
|
||||||
$SUDO rm /usr/local/bin/piholeLogFlush.sh &> /dev/null
|
$SUDO rm /usr/local/bin/piholeLogFlush.sh &> /dev/null
|
||||||
$SUDO rm /usr/local/bin/piholeDebug.sh &> /dev/null
|
$SUDO rm /usr/local/bin/piholeDebug.sh &> /dev/null
|
||||||
|
$SUDO rm /etc/dnsmasq.d/adList.conf &> /dev/null
|
||||||
$SUDO rm -rf /var/log/*pihole* &> /dev/null
|
$SUDO rm -rf /var/log/*pihole* &> /dev/null
|
||||||
$SUDO rm -rf /etc/pihole/ &> /dev/null
|
$SUDO rm -rf /etc/pihole/ &> /dev/null
|
||||||
$SUDO rm -rf /etc/.pihole/ &> /dev/null
|
$SUDO rm -rf /etc/.pihole/ &> /dev/null
|
||||||
|
$SUDO rm -rf /opt/pihole/ &> /dev/null
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
printf "::: Finished removing PiHole from your system. Sorry to see you go!\n"
|
printf "::: Finished removing PiHole from your system. Sorry to see you go!\n"
|
||||||
printf "::: Reach out to us at https://github.com/pi-hole/pi-hole/issues if you need help\n"
|
printf "::: Reach out to us at https://github.com/pi-hole/pi-hole/issues if you need help\n"
|
||||||
printf "::: Reinstall by simpling running\n:::\n:::\tcurl -L install.pi-hole.net | bash\n:::\n::: at any time!\n:::\n"
|
printf "::: Reinstall by simpling running\n:::\n:::\tcurl -L install.pi-hole.net | bash\n:::\n::: at any time!\n:::\n"
|
||||||
|
printf "::: PLEASE RESET YOUR DNS ON YOUR ROUTER/CLIENTS TO RESTORE INTERNET CONNECTIVITY!/n"
|
||||||
}
|
}
|
||||||
|
|
||||||
######### SCRIPT ###########
|
######### SCRIPT ###########
|
||||||
echo "::: Preparing to remove packages, be sure that each may be safely removed depending on your operating system."
|
echo "::: Preparing to remove packages, be sure that each may be safely removed depending on your operating system."
|
||||||
echo "::: (SAFE TO REMOVE ALL ON RASPBIAN)"
|
echo "::: (SAFE TO REMOVE ALL ON RASPBIAN)"
|
||||||
while true; do
|
while true; do
|
||||||
read -rp "::: Do you wish to purge PiHole's dependencies from your OS? (You will be prompted for each package)" yn
|
read -rp "::: Do you wish to purge PiHole's dependencies from your OS? (You will be prompted for each package) [y/n]" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) removeAndPurge; break;;
|
[Yy]* ) removeAndPurge; break;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue