mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Use new subroutine to determine if updates are available
This commit is contained in:
parent
c449a1c0e0
commit
65c35a5530
1 changed files with 17 additions and 3 deletions
|
@ -86,14 +86,17 @@ GitCheckUpdateAvail() {
|
||||||
git fetch origin
|
git fetch origin
|
||||||
status="$(git status -sb)"
|
status="$(git status -sb)"
|
||||||
|
|
||||||
|
# Change back to original directory
|
||||||
cd "${curdir}"
|
cd "${curdir}"
|
||||||
|
|
||||||
if [[ $status == *"behind"* ]]; then
|
if [[ $status == *"behind"* ]]; then
|
||||||
# Local branch is behind remote branch -> Update
|
# Local branch is behind remote branch -> Update
|
||||||
return 1
|
|
||||||
else
|
|
||||||
# Local branch is up-to-date
|
|
||||||
return 0
|
return 0
|
||||||
|
else
|
||||||
|
# Local branch is up-to-date or in a situation
|
||||||
|
# where this updater cannot be used (like on a
|
||||||
|
# branch that exists only locally)
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +115,18 @@ main() {
|
||||||
|
|
||||||
echo "::: Checking for updates..."
|
echo "::: Checking for updates..."
|
||||||
|
|
||||||
|
if GitCheckUpdateAvail "${PI_HOLE_FILES_DIR}" ; then
|
||||||
|
core_update=true
|
||||||
|
echo "Pi-hole Core update available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if GitCheckUpdateAvail "${ADMIN_INTERFACE_DIR}" ; then
|
||||||
|
web_update=true
|
||||||
|
echo "Web Interface update available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
# Logic
|
# Logic
|
||||||
# If latest versions are blank - we've probably hit Github rate limit (stop running `pihole -up so often!):
|
# If latest versions are blank - we've probably hit Github rate limit (stop running `pihole -up so often!):
|
||||||
|
|
Loading…
Reference in a new issue