Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pi-hole/pi-hole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Schaper <dan.schaper@pi-hole.net>2017-03-04 10:30:57 +0300
committerDan Schaper <dan.schaper@pi-hole.net>2017-03-04 10:30:57 +0300
commit0e8fd49669e5b5018439597585da424b516f9f57 (patch)
tree6a2f2a6cb5d4723a718b3e69a575d94828df4686 /advanced
parent945e22874e260d1be8d6fd453c8142ff68d30dd5 (diff)
Function...
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
Diffstat (limited to 'advanced')
-rwxr-xr-xadvanced/Scripts/version.sh33
1 files changed, 22 insertions, 11 deletions
diff --git a/advanced/Scripts/version.sh b/advanced/Scripts/version.sh
index 3089e00c..68e84900 100755
--- a/advanced/Scripts/version.sh
+++ b/advanced/Scripts/version.sh
@@ -49,12 +49,22 @@ getLocalHash() {
return 0
}
-PHVERSIONLATEST=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | \
- awk -F: '$1 ~/tag_name/ { print $2 }' | \
- tr -cd '[[:alnum:]]._-')
-WEBVERSIONLATEST=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | \
- awk -F: '$1 ~/tag_name/ { print $2 }' | \
- tr -cd '[[:alnum:]]._-')
+getRemoteVersion(){
+ # Get the version from the remote origin
+ local daemon="${1}"
+ local version
+
+ version=$(curl --silent --fail https://api.github.com/repos/pi-hole/${daemon}/releases/latest | \
+ awk -F: '$1 ~/tag_name/ { print $2 }' | \
+ tr -cd '[[:alnum:]]._-')
+ if [[ "${version}" =~ ^v ]]; then
+ echo "${version}"
+ else
+ echo "ERROR"
+ return 1
+ fi
+ return 0
+}
#PHHASHLATEST=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/commits/master | \
# grep sha | \
@@ -70,13 +80,13 @@ WEBVERSIONLATEST=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/release
normalOutput() {
- echo "::: Pi-hole version is ${PHVERSION} (Latest version is ${PHVERSIONLATEST:-${DEFAULT}})"
- echo "::: Web-Admin version is ${WEBVERSION} (Latest version is ${WEBVERSIONLATEST:-${DEFAULT}})"
+ echo "::: Pi-hole version is ${PHVERSION} (Latest version is ${PHVERSIONLATEST})"
+ echo "::: Web-Admin version is ${WEBVERSION} (Latest version is ${WEBVERSIONLATEST})"
}
webOutput() {
case "${1}" in
- "-l" | "--latest" ) echo "${WEBVERSIONLATEST:-${DEFAULT}}";;
+ "-l" | "--latest" ) echo "${WEBVERSIONLATEST}";;
"-c" | "--current" ) echo "${WEBVERSION}";;
"-h" | "--hash" ) echo "${WEBHASH}";;
* ) echo "::: Invalid Option!"; exit 1;
@@ -85,7 +95,7 @@ webOutput() {
coreOutput() {
case "${1}" in
- "-l" | "--latest" ) echo "${PHVERSIONLATEST:-${DEFAULT}}";;
+ "-l" | "--latest" ) echo "${PHVERSIONLATEST}";;
"-c" | "--current" ) echo "${PHVERSION}";;
"-h" | "--hash" ) echo "${PHHASH}";;
* ) echo "::: Invalid Option!"; exit 1;
@@ -112,9 +122,10 @@ EOM
PHVERSION=$(getLocalVersion "${PHGITDIR}")
PHHASH=$(getLocalHash "${PHGITDIR}")
+PHVERSIONLATEST=$(getRemoteVersion pi-hole)
WEBVERSION=$(getLocalVersion "${WEBGITDIR}")
WEBHASH=$(getLocalHash "${WEBGITDIR}")
-
+WEBVERSIONLATEST=$(getRemoteVersion AdminLTE)
if [[ $# = 0 ]]; then
normalOutput