From 05541f04d0a372854be8a40bf56e479f74c9af99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20HANNEBERT?= Date: Fri, 10 Dec 2021 12:03:10 +0100 Subject: [PATCH] Change: do not use grafana repo, but direct URL to deb file, so that the installed version is the one specified in _common.sh --- scripts/_common.sh | 30 +++++++++++++++++++++++++++++- scripts/install | 24 ++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 22a777f..61fa6fc 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,11 +5,39 @@ #================================================= # Debian package version for Grafana -GRAFANA_VERSION="8.0.7" +GRAFANAVERSION="8.0.7" # dependencies used by the app pkg_dependencies="influxdb" +ARCHITECTURE=$(dpkg --print-architecture) + +#arm64 +sha256_arm64=ebfa946af9e5414a9dd9cfc83cb6973fbfb366b81790f19d9dd0fd563142282d + +#armv6 +sha256_armhf_v6=78ae6990b3d4787f825278300c5779bcc1c89e5cb8ccbf6d7040aab421bb9948 + +#armv7 +sha256_armhf=5b24999e1da04a6031ecca1a1a95386f87b4b23bbd0c59f61ebeea18557b5877 + +#amd64 +sha256_amd64=ddfdd290c94768c2538b8546fd6c0ed2a0f0d2f3a5501e73a97f18edf4b9a167 + +url=https://dl.grafana.com/enterprise/release/grafana-enterprise_${GRAFANAVERSION}_$ARCHITECTURE.deb + +url_armv6=https://dl.grafana.com/enterprise/release/grafana-enterprise-rpi_${GRAFANAVERSION}_$ARCHITECTURE.deb + +if [ -n "$(uname -m | grep armv6)" ] +then + grafana_deb_url="$url_armv6" + sha256sum=sha256_armhf_v6 +else + grafana_deb_url="$url" + sha256sumvar=sha256_${ARCHITECTURE} + sha256sum=${!sha256sumvar} +fi + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index bfb6ab7..ff297f0 100644 --- a/scripts/install +++ b/scripts/install @@ -61,10 +61,30 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=44 +ynh_script_progression --message="Installing dependencies..." --weight=22 ynh_install_app_dependencies $pkg_dependencies -ynh_install_extra_app_dependencies --repo="deb https://packages.grafana.com/oss/deb stable main" --package="grafana" --key="https://packages.grafana.com/gpg.key" + +#================================================= +# DOWNLOAD AND INSTALL GRAFANA DEB PACKAGE +#================================================= +ynh_script_progression --message="Downloading Grafana..." --weight=11 + +temp_folder="$(mktemp -d)" + +grafana_deb_dst="$temp_folder/grafana_deb.deb" + +if [ -n "$(uname -m | grep armv6)" ] +then + grafana_deb_url="$url_armv6" +else + grafana_deb_url="$url" +fi + +ynh_exec_quiet "wget -q -O $grafana_deb_dst $grafana_deb_url" + +ynh_script_progression --message="Installing Grafana..." --weight=11 + DEBIAN_FRONTEND=noninteractive ynh_exec_warn_less dpkg --force-confold -i $grafana_deb_dst #================================================= # CREATE A MYSQL DATABASE