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

Update upgrade

Add the helper ynh_setup_source
This commit is contained in:
Thatoo 2019-06-04 22:47:40 +02:00 committed by GitHub
parent 7be198913e
commit c043311b43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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