From cb28a2f77fd9613c86f103ec47c8f72f67e5e7ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Tue, 31 Oct 2017 00:12:03 +0100 Subject: [PATCH] Use app version from manifest --- scripts/_common.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index b681f1d..d1c3a0e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,15 @@ app=$YNH_APP_INSTANCE_NAME ## Adapt md5sum while you update app sha256sum="3fb8b4a4f7aeeeafccc6dc5b232f82d5761be80fe8e82008bc768f805fe5a744" -monitorix_version="3.10.0" + +get_app_version_from_json() { + manifest_path="../manifest.json" + if [ ! -e "$manifest_path" ]; then + manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place + fi + echo $(grep '\"version\": ' "$manifest_path" | cut -d '"' -f 4) # Retrieve the version number in the manifest file. +} +APP_VERSION=$(get_app_version_from_json) install_dependances() { ynh_install_app_dependencies rrdtool perl libwww-perl libmailtools-perl libmime-lite-perl librrds-perl libdbi-perl libxml-simple-perl libhttp-server-simple-perl libconfig-general-perl pflogsumm @@ -15,7 +23,7 @@ install_dependances() { } get_source() { - wget -q -O '/tmp/monitorix.deb' "http://www.monitorix.org/monitorix_${monitorix_version}-izzy1_all.deb" + wget -q -O '/tmp/monitorix.deb' "http://www.monitorix.org/monitorix_${APP_VERSION}-izzy1_all.deb" if [[ ! -e '/tmp/monitorix.deb' ]] || [[ $(sha256sum '/tmp/monitorix.deb' | cut -d' ' -f1) != $sha256sum ]] then