mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-03 12:40:56 +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 {
|
function updatePiholeFunc {
|
||||||
echo "::: Fetching latest changes from Github..."
|
echo "::: Checking for updates..."
|
||||||
cd /etc/.pihole
|
piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
|
||||||
${SUDO} git pull origin master
|
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/",$//')
|
||||||
${SUDO} /etc/.pihole/automated\ install/basic-install.sh pihole
|
|
||||||
|
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
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user