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

Merge pull request #2116 from pi-hole/FTLDNS_UpdateCheck

Check for new updates without actually updating
This commit is contained in:
Adam Warner 2018-04-15 20:42:29 +01:00 committed by GitHub
commit 699d419c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -19,6 +19,9 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
PH_TEST=true PH_TEST=true
# when --check-only is passed to this script, it will not perform the actual update
CHECK_ONLY=false
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
# shellcheck disable=SC1091 # shellcheck disable=SC1091
@ -140,6 +143,11 @@ main() {
exit 0 exit 0
fi fi
if [[ "${CHECK_ONLY}" == true ]]; then
echo ""
exit 0
fi
if [[ "${core_update}" == true ]]; then if [[ "${core_update}" == true ]]; then
echo "" echo ""
echo -e " ${INFO} Pi-hole core files out of date, updating local repo." echo -e " ${INFO} Pi-hole core files out of date, updating local repo."
@ -159,7 +167,7 @@ main() {
echo -e " ${INFO} FTL out of date, it will be updated by the installer." echo -e " ${INFO} FTL out of date, it will be updated by the installer."
fi fi
if [[ "${FTL_update}" == true || "${core_update}" == true || "${web_update}" == true ]]; then if [[ "${FTL_update}" == true || "${core_update}" == true ]]; then
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || \ ${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --reconfigure --unattended || \
echo -e "${basicError}" && exit 1 echo -e "${basicError}" && exit 1
fi fi
@ -167,4 +175,8 @@ main() {
exit 0 exit 0
} }
if [[ "$1" == "--check-only" ]]; then
CHECK_ONLY=true
fi
main main

6
pihole
View File

@ -71,7 +71,8 @@ flushFunc() {
} }
updatePiholeFunc() { updatePiholeFunc() {
"${PI_HOLE_SCRIPT_DIR}"/update.sh shift
"${PI_HOLE_SCRIPT_DIR}"/update.sh "$@"
exit 0 exit 0
} }
@ -620,6 +621,7 @@ Options:
-q, query Query the adlists for a specified domain -q, query Query the adlists for a specified domain
Add '-h' for more info on query usage Add '-h' for more info on query usage
-up, updatePihole Update Pi-hole subsystems -up, updatePihole Update Pi-hole subsystems
Add '--check-only' to exit script before update is performed.
-v, version Show installed versions of Pi-hole, Admin Console & FTL -v, version Show installed versions of Pi-hole, Admin Console & FTL
Add '-h' for more info on version usage Add '-h' for more info on version usage
uninstall Uninstall Pi-hole from your system uninstall Uninstall Pi-hole from your system
@ -644,7 +646,7 @@ case "${1}" in
"-wild" | "wildcard" ) wildcardFunc "$@";; "-wild" | "wildcard" ) wildcardFunc "$@";;
"-d" | "debug" ) debugFunc "$@";; "-d" | "debug" ) debugFunc "$@";;
"-f" | "flush" ) flushFunc "$@";; "-f" | "flush" ) flushFunc "$@";;
"-up" | "updatePihole" ) updatePiholeFunc;; "-up" | "updatePihole" ) updatePiholeFunc "$@";;
"-r" | "reconfigure" ) reconfigurePiholeFunc;; "-r" | "reconfigure" ) reconfigurePiholeFunc;;
"-g" | "updateGravity" ) updateGravityFunc "$@";; "-g" | "updateGravity" ) updateGravityFunc "$@";;
"-c" | "chronometer" ) chronometerFunc "$@";; "-c" | "chronometer" ) chronometerFunc "$@";;