mirror of
https://github.com/YunoHost-Apps/cesium_ynh.git
synced 2024-09-03 18:06:25 +02:00
Make available upgrades known by yunohost (#14)
Make available upgrades known by yunohost
This commit is contained in:
parent
cd1e252576
commit
a1a33f7861
3 changed files with 27 additions and 11 deletions
6
conf/app.src
Normal file
6
conf/app.src
Normal 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=fcac385f959178fc4ef8ac323b482c7d618bc48f67d6cc189229f91629b144be
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=zip
|
||||||
|
SOURCE_IN_SUBDIR=false
|
||||||
|
SOURCE_FILENAME=
|
|
@ -22,10 +22,9 @@ sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||||
# Retrieve sources and install them
|
# Retrieve sources and install them
|
||||||
src_path=/var/www/$app
|
src_path=/var/www/$app
|
||||||
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)
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
wget -nc --quiet $url -P /tmp
|
ynh_script_progression --message="Setting up source files..." --time --weight=1
|
||||||
sudo unzip -q /tmp/cesium-*-web.zip -d $src_path
|
ynh_setup_source --dest_dir=$src_path
|
||||||
sudo rm -f /tmp/cesium-*-web.zip
|
|
||||||
sudo chown -R www-data: $src_path
|
sudo chown -R www-data: $src_path
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
|
|
|
@ -12,19 +12,30 @@ 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
|
# Retreive sources and install them
|
||||||
src_path=/var/www/$app
|
src_path=/var/www/$app
|
||||||
sudo rm -rf $src_path
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
sudo mkdir -p $src_path
|
then
|
||||||
url=$(curl -s https://api.github.com/repos/duniter/cesium/releases | grep "browser_" | grep "web" | head -1 | cut -d\" -f4)
|
sudo rm -rf $src_path
|
||||||
wget -nc --quiet $url -P /tmp
|
sudo mkdir -p $src_path
|
||||||
|
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=$src_path
|
||||||
|
sudo chown -R www-data: $src_path
|
||||||
|
fi
|
||||||
|
|
||||||
sudo unzip -q /tmp/cesium-*-web.zip -d $src_path
|
|
||||||
sudo rm -f /tmp/cesium-*-web.zip
|
|
||||||
sudo chown -R www-data: $src_path
|
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
nginx_conf=../conf/nginx.conf
|
nginx_conf=../conf/nginx.conf
|
||||||
|
|
Loading…
Reference in a new issue