mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-28 17:13:17 +00:00
Add in apt-get update if it has not been run today. Otherwise, check number of upgrades availible, advise user there are updates, and at their choice, either continue or cancel the installation
This commit is contained in:
parent
a05b6a4e12
commit
b8f48d1bce
1 changed files with 28 additions and 13 deletions
|
@ -16,7 +16,7 @@
|
||||||
#
|
#
|
||||||
# curl -L install.pi-hole.net | bash
|
# curl -L install.pi-hole.net | bash
|
||||||
|
|
||||||
$SUDO mkdir -p /etc/pihole/
|
|
||||||
######## VARIABLES #########
|
######## VARIABLES #########
|
||||||
|
|
||||||
tmpLog=/tmp/pihole-install.log
|
tmpLog=/tmp/pihole-install.log
|
||||||
|
@ -63,7 +63,7 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "/etc/dnsmasq.d/01-pihole.conf" ]; then
|
if [ -d "/etc/pihole" ]; then
|
||||||
#Likely an existing install
|
#Likely an existing install
|
||||||
upgrade=true
|
upgrade=true
|
||||||
else
|
else
|
||||||
|
@ -260,7 +260,9 @@ setStaticIPv4(){
|
||||||
else
|
else
|
||||||
setDHCPCD
|
setDHCPCD
|
||||||
$SUDO ip addr replace dev $piholeInterface $IPv4addr
|
$SUDO ip addr replace dev $piholeInterface $IPv4addr
|
||||||
echo "Setting IP to $IPv4addr. You may need to restart after the install is complete."
|
echo ":::"
|
||||||
|
echo "::: Setting IP to $IPv4addr. You may need to restart after the install is complete."
|
||||||
|
echo ":::"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,19 +305,33 @@ checkForDependencies(){
|
||||||
#We'll change the logic up here, to check to see if there are any updates availible and
|
#We'll change the logic up here, to check to see if there are any updates availible and
|
||||||
# if so, advise the user to run apt-get update/upgrade at their own discretion
|
# if so, advise the user to run apt-get update/upgrade at their own discretion
|
||||||
|
|
||||||
|
|
||||||
|
#Check to see if apt-get update has already been run today
|
||||||
|
# it needs to have been run at least once on new installs!
|
||||||
|
|
||||||
|
timestamp=$(stat -c %Y /var/cache/apt/)
|
||||||
|
timestampAsDate=$(date -d @$timestamp "+%b %e")
|
||||||
today=$(date "+%b %e")
|
today=$(date "+%b %e")
|
||||||
|
|
||||||
|
if [ ! "$today" == "$timestampAsDate" ]; then
|
||||||
|
#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 "::: Checking apt-get for upgraded packages...."
|
||||||
updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) & spinner $!
|
updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst)
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
if [[ $updatesToInstall -eq 0 ]]; then
|
if [[ $updatesToInstall -eq "0" ]]; then
|
||||||
echo "::: Your pi is up to date! Continuing with pi-hole installation..."
|
echo "::: Your pi is up to date! Continuing with pi-hole installation..."
|
||||||
else
|
else
|
||||||
echo "::: There are $updatesToInstall updates availible for your pi!"
|
echo "::: There are $updatesToInstall updates availible for your pi!"
|
||||||
echo "::: Please consider running 'sudo apt-get update', followed by 'sudo apt-get upgrade'"
|
echo "::: Please consider running 'sudo apt-get upgrade' before continuing with installation"
|
||||||
echo "::: after pi-hole has finished installing."
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
#add in a prompt to give users the option to quit installation or continue
|
#add in a prompt to give users the option to quit installation or continue
|
||||||
echo -n "::: Would you like to continue with the pi-hole installation? (Y/n):"
|
echo -n "::: Would you like to continue with the pi-hole installation? (Y/n):"
|
||||||
|
@ -324,7 +340,7 @@ checkForDependencies(){
|
||||||
case "$answer" in
|
case "$answer" in
|
||||||
[yY][eE][sS]|[yY] ) echo "::: Continuing!";;
|
[yY][eE][sS]|[yY] ) echo "::: Continuing!";;
|
||||||
* ) echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!"
|
* ) echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!"
|
||||||
exit 0;;
|
exit 1;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -480,6 +496,7 @@ The install log is in /etc/pihole." $r $c
|
||||||
|
|
||||||
######## SCRIPT ############
|
######## SCRIPT ############
|
||||||
# Start the installer
|
# Start the installer
|
||||||
|
$SUDO mkdir -p /etc/pihole/
|
||||||
welcomeDialogs
|
welcomeDialogs
|
||||||
|
|
||||||
# Just back up the original Pi-hole right away since it won't take long and it gets it out of the way
|
# Just back up the original Pi-hole right away since it won't take long and it gets it out of the way
|
||||||
|
@ -489,8 +506,6 @@ chooseInterface
|
||||||
# Let the user decide if they want to block ads over IPv4 and/or IPv6
|
# Let the user decide if they want to block ads over IPv4 and/or IPv6
|
||||||
use4andor6
|
use4andor6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Install and log everything to a file
|
# Install and log everything to a file
|
||||||
installPihole | tee $tmpLog
|
installPihole | tee $tmpLog
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue