mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-24 15:13:42 +00:00
Merge branch 'UninstallFix' of github.com:pi-hole/pi-hole into UninstallFix
This commit is contained in:
commit
1b76bf3e48
2 changed files with 79 additions and 74 deletions
|
@ -6,3 +6,12 @@ http://pgl.yoyo.org/adservers/serverlist.php?
|
||||||
http://someonewhocares.org/hosts/hosts
|
http://someonewhocares.org/hosts/hosts
|
||||||
http://winhelp2002.mvps.org/hosts.txt
|
http://winhelp2002.mvps.org/hosts.txt
|
||||||
http://mirror1.malwaredomains.com/files/justdomains
|
http://mirror1.malwaredomains.com/files/justdomains
|
||||||
|
http://securemecca.com/Downloads/hosts.txt
|
||||||
|
https://hosts.neocities.org/
|
||||||
|
http://sysctl.org/cameleon/hosts
|
||||||
|
https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist
|
||||||
|
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
|
||||||
|
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
|
||||||
|
http://optimate.dl.sourceforge.net/project/adzhosts/HOSTS.txt
|
||||||
|
https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt
|
||||||
|
|
||||||
|
|
|
@ -145,10 +145,8 @@ chooseInterface() {
|
||||||
echo "::: Cancel selected, exiting...."
|
echo "::: Cancel selected, exiting...."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
use4andor6() {
|
use4andor6() {
|
||||||
# Let use select IPv4 and/or IPv6
|
# Let use select IPv4 and/or IPv6
|
||||||
cmd=(whiptail --separate-output --checklist "Select Protocols" $r $c 2)
|
cmd=(whiptail --separate-output --checklist "Select Protocols" $r $c 2)
|
||||||
|
@ -303,40 +301,40 @@ setDNS(){
|
||||||
}
|
}
|
||||||
|
|
||||||
versionCheckDNSmasq(){
|
versionCheckDNSmasq(){
|
||||||
# Check if /etc/dnsmasq.conf is from pihole. If so replace with an original and install new in .d directory
|
# Check if /etc/dnsmasq.conf is from pihole. If so replace with an original and install new in .d directory
|
||||||
dnsFile1="/etc/dnsmasq.conf"
|
dnsFile1="/etc/dnsmasq.conf"
|
||||||
dnsFile2="/etc/dnsmasq.conf.orig"
|
dnsFile2="/etc/dnsmasq.conf.orig"
|
||||||
dnsSearch="addn-hosts=/etc/pihole/gravity.list"
|
dnsSearch="addn-hosts=/etc/pihole/gravity.list"
|
||||||
|
|
||||||
defaultFile="/etc/.pihole/advanced/dnsmasq.conf.original"
|
defaultFile="/etc/.pihole/advanced/dnsmasq.conf.original"
|
||||||
newFileToInstall="/etc/.pihole/advanced/01-pihole.conf"
|
newFileToInstall="/etc/.pihole/advanced/01-pihole.conf"
|
||||||
newFileFinalLocation="/etc/dnsmasq.d/01-pihole.conf"
|
newFileFinalLocation="/etc/dnsmasq.d/01-pihole.conf"
|
||||||
|
|
||||||
if [ -f $dnsFile1 ]; then
|
if [ -f $dnsFile1 ]; then
|
||||||
echo -n "::: Existing dnsmasq.conf found..."
|
echo -n "::: Existing dnsmasq.conf found..."
|
||||||
if grep -q $dnsSearch $dnsFile1; then
|
if grep -q $dnsSearch $dnsFile1; then
|
||||||
echo " it is from a previous pi-hole install."
|
echo " it is from a previous pi-hole install."
|
||||||
echo -n "::: Backing up dnsmasq.conf to dnsmasq.conf.orig..."
|
echo -n "::: Backing up dnsmasq.conf to dnsmasq.conf.orig..."
|
||||||
$SUDO mv -f $dnsFile1 $dnsFile2
|
$SUDO mv -f $dnsFile1 $dnsFile2
|
||||||
echo " done."
|
echo " done."
|
||||||
echo -n "::: Restoring default dnsmasq.conf..."
|
echo -n "::: Restoring default dnsmasq.conf..."
|
||||||
$SUDO cp $defaultFile $dnsFile1
|
$SUDO cp $defaultFile $dnsFile1
|
||||||
echo " done."
|
echo " done."
|
||||||
else
|
else
|
||||||
echo " it is not a pi-hole file, leaving alone!"
|
echo " it is not a pi-hole file, leaving alone!"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -n "::: No dnsmasq.conf found.. restoring default dnsmasq.conf..."
|
echo -n "::: No dnsmasq.conf found.. restoring default dnsmasq.conf..."
|
||||||
$SUDO cp $defaultFile $dnsFile1
|
$SUDO cp $defaultFile $dnsFile1
|
||||||
echo " done."
|
echo " done."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "::: Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf..."
|
echo -n "::: Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf..."
|
||||||
$SUDO cp $newFileToInstall $newFileFinalLocation
|
$SUDO cp $newFileToInstall $newFileFinalLocation
|
||||||
echo " done."
|
echo " done."
|
||||||
$SUDO sed -i "s/@INT@/$piholeInterface/" $newFileFinalLocation
|
$SUDO sed -i "s/@INT@/$piholeInterface/" $newFileFinalLocation
|
||||||
$SUDO sed -i "s/@DNS1@/$piholeDNS1/" $newFileFinalLocation
|
$SUDO sed -i "s/@DNS1@/$piholeDNS1/" $newFileFinalLocation
|
||||||
$SUDO sed -i "s/@DNS2@/$piholeDNS2/" $newFileFinalLocation
|
$SUDO sed -i "s/@DNS2@/$piholeDNS2/" $newFileFinalLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
installScripts() {
|
installScripts() {
|
||||||
|
@ -385,26 +383,26 @@ checkForDependencies() {
|
||||||
today=$(date "+%b %e")
|
today=$(date "+%b %e")
|
||||||
|
|
||||||
if [ ! "$today" == "$timestampAsDate" ]; then
|
if [ ! "$today" == "$timestampAsDate" ]; then
|
||||||
#update package lists
|
#update package lists
|
||||||
echo ":::"
|
|
||||||
echo -n "::: apt-get update has not been run today. Running now..."
|
|
||||||
$SUDO apt-get -qq update & spinner $!
|
|
||||||
echo " done!"
|
|
||||||
fi
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo -n "::: Checking apt-get for upgraded packages...."
|
echo -n "::: apt-get update has not been run today. Running now..."
|
||||||
updatesToInstall=$($SUDO apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst)
|
$SUDO apt-get -qq update & spinner $!
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
fi
|
||||||
|
echo ":::"
|
||||||
|
echo -n "::: Checking apt-get for upgraded packages...."
|
||||||
|
updatesToInstall=$($SUDO apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst)
|
||||||
|
echo " done!"
|
||||||
|
echo ":::"
|
||||||
|
if [[ $updatesToInstall -eq "0" ]]; then
|
||||||
|
echo "::: Your pi is up to date! Continuing with pi-hole installation..."
|
||||||
|
else
|
||||||
|
echo "::: There are $updatesToInstall updates availible for your pi!"
|
||||||
|
echo "::: We recommend you run 'sudo apt-get upgrade' after installing Pi-Hole! "
|
||||||
echo ":::"
|
echo ":::"
|
||||||
if [[ $updatesToInstall -eq "0" ]]; then
|
fi
|
||||||
echo "::: Your pi is up to date! Continuing with pi-hole installation..."
|
echo ":::"
|
||||||
else
|
echo "::: Checking dependencies:"
|
||||||
echo "::: There are $updatesToInstall updates availible for your pi!"
|
|
||||||
echo "::: We recommend you run 'sudo apt-get upgrade' after installing Pi-Hole! "
|
|
||||||
echo ":::"
|
|
||||||
fi
|
|
||||||
echo ":::"
|
|
||||||
echo "::: Checking dependencies:"
|
|
||||||
|
|
||||||
dependencies=( dnsutils bc toilet figlet dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget )
|
dependencies=( dnsutils bc toilet figlet dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget )
|
||||||
for i in "${dependencies[@]}"
|
for i in "${dependencies[@]}"
|
||||||
|
@ -443,31 +441,30 @@ getGitFiles() {
|
||||||
is_repo() {
|
is_repo() {
|
||||||
# If the directory does not have a .git folder it is not a repo
|
# If the directory does not have a .git folder it is not a repo
|
||||||
echo -n "::: Checking $1 is a repo..."
|
echo -n "::: Checking $1 is a repo..."
|
||||||
if [ -d "$1/.git" ]; then
|
if [ -d "$1/.git" ]; then
|
||||||
echo " OK!"
|
echo " OK!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo " not found!!"
|
echo " not found!!"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
make_repo() {
|
make_repo() {
|
||||||
# Remove the non-repod interface and clone the interface
|
# Remove the non-repod interface and clone the interface
|
||||||
echo -n "::: Cloning $2 into $1..."
|
echo -n "::: Cloning $2 into $1..."
|
||||||
$SUDO rm -rf $1
|
$SUDO rm -rf $1
|
||||||
$SUDO git clone -q "$2" "$1" > /dev/null & spinner $!
|
$SUDO git clone -q "$2" "$1" > /dev/null & spinner $!
|
||||||
echo " done!"
|
echo " done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_repo() {
|
update_repo() {
|
||||||
# Pull the latest commits
|
# Pull the latest commits
|
||||||
echo -n "::: Updating repo in $1..."
|
echo -n "::: Updating repo in $1..."
|
||||||
cd "$1"
|
cd "$1"
|
||||||
$SUDO git pull -q > /dev/null & spinner $!
|
$SUDO git pull -q > /dev/null & spinner $!
|
||||||
echo " done!"
|
echo " done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CreateLogFile() {
|
CreateLogFile() {
|
||||||
# Create logfiles if necessary
|
# Create logfiles if necessary
|
||||||
echo ":::"
|
echo ":::"
|
||||||
|
@ -519,7 +516,6 @@ runGravity() {
|
||||||
/usr/local/bin/gravity.sh
|
/usr/local/bin/gravity.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
installPihole() {
|
installPihole() {
|
||||||
# Install base files and web interface
|
# Install base files and web interface
|
||||||
checkForDependencies # done
|
checkForDependencies # done
|
||||||
|
|
Loading…
Reference in a new issue