1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

wrap update logic in admin_installed bool check

This commit is contained in:
Promofaux 2017-02-05 19:12:09 +00:00
parent 1428b58dde
commit ba0abdb88d

View File

@ -169,57 +169,71 @@ main() {
web_update=false web_update=false
echo "::: Web Interface: up to date" echo "::: Web Interface: up to date"
fi fi
fi
# Logic # Logic
# If Core up to date AND web up to date: # If Core up to date AND web up to date:
# Do nothing # Do nothing
# If Core up to date AND web NOT up to date: # If Core up to date AND web NOT up to date:
# Pull web repo # Pull web repo
# If Core NOT up to date AND web up to date: # If Core NOT up to date AND web up to date:
# pull pihole repo, run install --unattended -- reconfigure # pull pihole repo, run install --unattended -- reconfigure
# if Core NOT up to date AND web NOT up to date: # if Core NOT up to date AND web NOT up to date:
# pull pihole repo run install --unattended # pull pihole repo run install --unattended
if ! ${core_update} && ! ${web_update} ; then if ! ${core_update} && ! ${web_update} ; then
echo ":::" echo ":::"
echo "::: Everything is up to date!" echo "::: Everything is up to date!"
exit 0 exit 0
elif ! ${core_update} && ${web_update} ; then elif ! ${core_update} && ${web_update} ; then
echo ":::" echo ":::"
echo "::: Pi-hole Web Admin files out of date" echo "::: Pi-hole Web Admin files out of date"
getGitFiles "${ADMIN_INTERFACE_DIR}" "${ADMIN_INTERFACE_GIT_URL}" getGitFiles "${ADMIN_INTERFACE_DIR}" "${ADMIN_INTERFACE_GIT_URL}"
elif ${core_update} && ! ${web_update} ; then elif ${core_update} && ! ${web_update} ; then
echo ":::" echo ":::"
echo "::: Pi-hole core files out of date" echo "::: Pi-hole core files out of date"
getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}"
/etc/.pihole/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 /etc/.pihole/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1
elif ${core_update} && ${web_update} ; then elif ${core_update} && ${web_update} ; then
echo ":::" echo ":::"
echo "::: Updating Everything" echo "::: Updating Everything"
getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}" getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}"
/etc/.pihole/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1 /etc/.pihole/automated\ install/basic-install.sh --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1
else
echo "*** Update script has malfunctioned, fallthrough reached. Please contact support"
exit 1
fi
else else
echo "*** Update script has malfunctioned, fallthrough reached. Please contact support"
exit 1 if ! ${core_update}; then
echo ":::"
echo "::: Everything is up to date!"
exit 0
else
echo ":::"
echo "::: Pi-hole core files out of date"
getGitFiles "${PI_HOLE_FILES_DIR}" "${PI_HOLE_GIT_URL}"
/etc/.pihole/automated\ install/basic-install.sh --reconfigure --unattended || echo "Unable to complete update, contact Pi-hole" && exit 1
fi
fi fi
if [[ "${web_update}" == true ]]; then if [[ "${web_update}" == true ]]; then
web_version_current="$(/usr/local/bin/pihole version --admin --current)" web_version_current="$(/usr/local/bin/pihole version --admin --current)"
echo ":::" echo ":::"
echo "::: Web Admin version is now at ${web_version_current}" echo "::: Web Admin version is now at ${web_version_current}"
echo "::: If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'" echo "::: If you had made any changes in '/var/www/html/admin/', they have been stashed using 'git stash'"
fi fi
if [[ "${core_update}" == true ]]; then
pihole_version_current="$(/usr/local/bin/pihole version --pihole --current)"
echo ":::"
echo "::: Pi-hole version is now at ${pihole_version_current}"
echo "::: If you had made any changes in '/etc/.pihole/', they have been stashed using 'git stash'"
fi
if [[ "${core_update}" == true ]]; then
pihole_version_current="$(/usr/local/bin/pihole version --pihole --current)"
echo ":::"
echo "::: Pi-hole version is now at ${pihole_version_current}"
echo "::: If you had made any changes in '/etc/.pihole/', they have been stashed using 'git stash'"
fi
echo "" echo ""
exit 0 exit 0