From 7be198913e1c2d198604934b1001b9ef2f4c9837 Mon Sep 17 00:00:00 2001 From: Thatoo Date: Tue, 4 Jun 2019 22:24:07 +0200 Subject: [PATCH 1/2] Create app.src --- conf/app.src | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 conf/app.src diff --git a/conf/app.src b/conf/app.src new file mode 100644 index 0000000..ed3d93d --- /dev/null +++ b/conf/app.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://github.com/duniter/cesium/releases/download/v1.3.11/cesium-v1.3.11-web.zip +SOURCE_SUM= +SOURCE_SUM_PRG= +SOURCE_FORMAT=zip +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= From c043311b437511ad33b5fb084298b9ccf78d7fbd Mon Sep 17 00:00:00 2001 From: Thatoo Date: Tue, 4 Jun 2019 22:47:40 +0200 Subject: [PATCH 2/2] Update upgrade Add the helper ynh_setup_source --- scripts/upgrade | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 3b35c9e..672032d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,15 +12,27 @@ domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) is_public=$(ynh_app_setting_get "$app" is_public) +### This helper will compare the version of the currently installed app and the version of the upstream package. +### $upgrade_type can have 2 different values +### - UPGRADE_APP if the upstream app version has changed +### - UPGRADE_PACKAGE if only the YunoHost package has changed +### ynh_check_app_version_changed will stop the upgrade if the app is up to date. +### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. +upgrade_type=$(ynh_check_app_version_changed) + # Remove trailing "/" for next commands path=${path%/} -# Retreive sources and install them src_path=/var/www/$app sudo rm -rf $src_path sudo mkdir -p $src_path -url=$(curl -s https://api.github.com/repos/duniter/cesium/releases | grep "browser_" | grep "web" | head -1 | cut -d\" -f4) -wget -nc --quiet $url -P /tmp +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading source files..." --time --weight=1 + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir=/tmp +fi sudo unzip -q /tmp/cesium-*-web.zip -d $src_path sudo rm -f /tmp/cesium-*-web.zip