mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
Make updatePiholeFunc a bit smarter. Only run update if version is not the latest.
This commit is contained in:
parent
dde9281139
commit
0229f70761
24
pihole
24
pihole
@ -53,10 +53,26 @@ function updateDashboardFunc {
|
||||
}
|
||||
|
||||
function updatePiholeFunc {
|
||||
echo "::: Fetching latest changes from Github..."
|
||||
cd /etc/.pihole
|
||||
${SUDO} git pull origin master
|
||||
${SUDO} /etc/.pihole/automated\ install/basic-install.sh pihole
|
||||
echo "::: Checking for updates..."
|
||||
piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
|
||||
piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
|
||||
|
||||
if [[ ${piholeVersion} == ${piholeVersionLatest} ]] ; then
|
||||
echo "::: Pi-hole is already up to date! Version: ${piholeVersion}"
|
||||
echo ":::"
|
||||
echo "::: No need to update!"
|
||||
else
|
||||
echo "::: An update is available! Current Version: ${piholeVersion}"
|
||||
echo "::: Latest Version: ${piholeVersionLatest}"
|
||||
echo ":::"
|
||||
echo "::: Fetching latest changes from Github..."
|
||||
cd /etc/.pihole
|
||||
${SUDO} git pull origin master
|
||||
${SUDO} /etc/.pihole/automated\ install/basic-install.sh pihole
|
||||
echo ":::"
|
||||
echo "::: Pi-hole has been updated, see https://changes.pi-hole.net for details"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user