diff options
author | Dan Schaper <dan.schaper@pi-hole.net> | 2017-03-04 06:14:30 +0300 |
---|---|---|
committer | Dan Schaper <dan.schaper@pi-hole.net> | 2017-03-04 06:14:30 +0300 |
commit | 81939ab265f9b85516f673df3b3b13467371ded7 (patch) | |
tree | 54a781d8f1ac43021b9332b25122bb737033d93e /advanced | |
parent | f2fe84c9d30e314b08f8f54a4a5720cb3ad6aa0c (diff) |
Get short hash of local and remote
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
Diffstat (limited to 'advanced')
-rwxr-xr-x | advanced/Scripts/version.sh | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/advanced/Scripts/version.sh b/advanced/Scripts/version.sh index 11a7af00..27166507 100755 --- a/advanced/Scripts/version.sh +++ b/advanced/Scripts/version.sh @@ -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}})" |