From aca24e321b118468e488b899cb283ced88de8ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Tue, 31 Oct 2017 22:33:02 +0100 Subject: [PATCH] Get version from manifest --- conf/armv7.src | 2 +- scripts/_common.sh | 11 ++++++++++- scripts/install | 2 +- scripts/upgrade | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/conf/armv7.src b/conf/armv7.src index 5e3feda..8add7f3 100644 --- a/conf/armv7.src +++ b/conf/armv7.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Josue-T/synapse_python_build/releases/download/v0.24.1/matrix-synapse_0.24.1-bin1_armv7l.tar.gz +SOURCE_URL=https://github.com/Josue-T/synapse_python_build/releases/download/v__APP_VERSION__/matrix-synapse___APP_VERSION__-bin1_armv7l.tar.gz SOURCE_SUM=20b6b3b195210aa778a017796a310b4327d8ecbd1b423214e83603aae319957c # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 diff --git a/scripts/_common.sh b/scripts/_common.sh index 9bca46a..ce8d474 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,15 @@ app=$YNH_APP_INSTANCE_NAME synapse_user="matrix-synapse" synapse_db_name="matrix_synapse" synapse_db_user="matrix_synapse" -synapse_version="0.24.1" + +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 coturn build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libxml2-dev libxslt1-dev python-lxml libjpeg-dev libpq-dev postgresql @@ -24,6 +32,7 @@ setup_dir() { install_source() { if [ -n "$(uname -m | grep arm)" ] then + ynh_replace_string __APP_VERSION__ $APP_VERSION "$YNH_CWD/../conf/${src_id}.src" ynh_setup_source $final_path/ "armv7" else # Install virtualenv if it don't exist diff --git a/scripts/install b/scripts/install index 768b8c1..a4069c7 100644 --- a/scripts/install +++ b/scripts/install @@ -41,7 +41,7 @@ synapse_db_pwd=$(ynh_string_random 30) ynh_app_setting_set $app special_domain $domain ynh_app_setting_set $app special_path $path ynh_app_setting_set $app final_path $final_path -ynh_app_setting_set $app synapse_version $synapse_version +ynh_app_setting_set $app synapse_version $APP_VERSION ynh_app_setting_set $app synapse_db_pwd $synapse_db_pwd ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app synapse_port $synapse_port diff --git a/scripts/upgrade b/scripts/upgrade index 1687100..e8290dc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -134,7 +134,7 @@ set_certificat_access config_coturn # Set new settings -ynh_app_setting_set $app synapse_version $synapse_version +ynh_app_setting_set $app synapse_version $APP_VERSION # Recharge la configuration Nginx systemctl reload nginx.service