Merge pull request #243 from pi-hole/HotFix/InstallScript
Hot fix/install script
This commit is contained in:
commit
c24685c49a
|
@ -293,24 +293,37 @@ stopServices(){
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForDependencies(){
|
checkForDependencies(){
|
||||||
echo ":::"
|
|
||||||
#Check to see if apt-get update has already been run today
|
|
||||||
timestamp=$(stat -c %Y /var/cache/apt/)
|
|
||||||
timestampAsDate=$(date -d @$timestamp "+%b %e")
|
|
||||||
today=$(date "+%b %e")
|
|
||||||
|
|
||||||
if [ ! "$today" == "$timestampAsDate" ]; then
|
#Running apt-get update/upgrade with minimal output can cause some issues with
|
||||||
#update package lists
|
#requiring user input (e.g password for phpmyadmin see #218)
|
||||||
echo -n "::: Updating package list before install...."
|
#We'll change the logic up here, to check to see if there are any updates availible and
|
||||||
$SUDO apt-get -qq update > /dev/null & spinner $!
|
# if so, advise the user to run apt-get update/upgrade at their own discretion
|
||||||
echo " done!"
|
|
||||||
echo -n "::: Upgrading installed apt-get packages...."
|
today=$(date "+%b %e")
|
||||||
$SUDO apt-get -y -qq upgrade > /dev/null & spinner $!
|
echo ":::"
|
||||||
echo " done!"
|
echo -n "::: Checking apt-get for upgraded packages...."
|
||||||
else
|
updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) & spinner $!
|
||||||
echo "::: Apt-get update already run today, any more would be overkill..."
|
echo " done!"
|
||||||
fi
|
|
||||||
|
echo ":::"
|
||||||
|
if [ $updatesToInstall > 0 ]; then
|
||||||
|
echo "::: There are $updatesToInstall updates availible for your pi!"
|
||||||
|
echo "::: Please consider running 'sudo apt-get update', followed by 'sudo apt-get upgrade'"
|
||||||
|
echo "::: after pi-hole has finished installing."
|
||||||
|
echo ":::"
|
||||||
|
#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):"
|
||||||
|
read answer
|
||||||
|
|
||||||
|
case "$answer" in
|
||||||
|
[yY][eE][sS]|[yY] ) echo "::: Continuing!";;
|
||||||
|
* ) echo "::: Quitting install, please run 'curl -L install.pi-hole.net | bash' after updating packages!"
|
||||||
|
exit 0;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "::: Your pi is up to date! Continuing with pi-hole installation..."
|
||||||
|
fi
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: Checking dependencies:"
|
echo "::: Checking dependencies:"
|
||||||
|
|
Loading…
Reference in New Issue