1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-01-03 12:40:56 +00:00

Get short hash of local and remote

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
Dan Schaper 2017-03-03 19:14:30 -08:00
parent f2fe84c9d3
commit 81939ab265
No known key found for this signature in database
GPG Key ID: 572E999E385B7BFC

View File

@ -17,11 +17,34 @@ current=false
DEFAULT="-1"
normalOutput() {
piholeVersion=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
webVersion=$(cd /var/www/html/admin/ && git describe --tags --abbrev=0)
piholeVersion=$(cd /etc/.pihole/ \
&& git describe --tags --abbrev=0)
webVersion=$(cd /var/www/html/admin/ \
&& 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/",$//')
webVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
piholeHash=$(cd /etc/.pihole/ \
&& git rev-parse --short HEAD)
webHash=$(cd /var/www/html/admin/ \
&& git rev-parse --short HEAD)
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/",$//')
webVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | \
grep -Po '"tag_name":.*?[^\\]",' | \
perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
piholeHashLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/commits/master | \
grep sha | \
head -n1 | \
awk -F ' ' '{ print $2}' | \
tr -cd '[[:alnum:]]._-')
piholeHashLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/commits/master | \
grep sha | \
head -n1 | \
awk -F ' ' '{ print $2}' | \
tr -cd '[[:alnum:]]._-')
echo "::: Pi-hole version is ${piholeVersion} (Latest version is ${piholeVersionLatest:-${DEFAULT}})"
echo "::: Web-Admin version is ${webVersion} (Latest version is ${webVersionLatest:-${DEFAULT}})"