1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cesium_ynh.git synced 2024-09-03 18:06:25 +02:00

Merge pull request #1 from Thatoo/Thatoo-patch-3

Make available upgrades known by yunohost
This commit is contained in:
Thatoo 2019-06-04 22:50:48 +02:00 committed by GitHub
commit f10542d6b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

6
conf/app.src Normal file
View file

@ -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=

View file

@ -12,15 +12,27 @@ domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path) path=$(ynh_app_setting_get "$app" path)
is_public=$(ynh_app_setting_get "$app" is_public) 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 # Remove trailing "/" for next commands
path=${path%/} path=${path%/}
# Retreive sources and install them
src_path=/var/www/$app src_path=/var/www/$app
sudo rm -rf $src_path sudo rm -rf $src_path
sudo mkdir -p $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) if [ "$upgrade_type" == "UPGRADE_APP" ]
wget -nc --quiet $url -P /tmp 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 unzip -q /tmp/cesium-*-web.zip -d $src_path
sudo rm -f /tmp/cesium-*-web.zip sudo rm -f /tmp/cesium-*-web.zip