1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cowyo_ynh.git synced 2024-09-03 18:16:15 +02:00

[upg] ynh3.7 and [fix] upgrade

This commit is contained in:
tituspijean 2020-03-28 22:32:29 +01:00
parent 77435e02e1
commit d38be28b41
3 changed files with 38 additions and 25 deletions

View file

@ -6,7 +6,7 @@
"en": "A feature-rich wiki webserver for minimalists.",
"fr": "Un serveur de wiki minimaliste mais riche en fonctionnalités."
},
"version": "2.12.0~ynh2",
"version": "2.12.0~ynh3",
"url": "https://github.com/schollz/cowyo",
"license": "MIT",
"maintainer": {
@ -14,7 +14,7 @@
"email": "tituspijean@outlook.com"
},
"requirements": {
"yunohost": ">= 3.5"
"yunohost": ">= 3.7"
},
"multi_instance": true,
"services": [

View file

@ -48,7 +48,6 @@ ynh_script_progression --message="Storing installation settings..." --time --wei
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app is_public $is_public
#=================================================
# STANDARD MODIFICATIONS
@ -132,15 +131,16 @@ ynh_script_progression --message="Starting a systemd service..." --time --weight
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app"
#=================================================
# SETUP SSOWAT
# SETUP PERMISSIONS
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --time --weight=1
ynh_script_progression --message="Configuring permissions..." --time --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set $app unprotected_uris "/"
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission "main" --add "visitors"
fi
#=================================================

View file

@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
@ -39,21 +38,38 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# Cleaning legacy permissions
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
skipped_uris=$(ynh_app_setting_get --app=$app --key=skipped_uris)
unprotected_uris=$(ynh_app_setting_get --app=$app --key=unprotected_uris)
protected_uris=$(ynh_app_setting_get --app=$app --key=protected_uris)
# Remove is_public if exists
if [ ! -z "$is_public" ]; then
ynh_app_setting_delete --app=$app --key=is_public
fi
# Remove skipped_uris if exists
if [ ! -z "$skipped_uris" ]; then
ynh_app_setting_delete --app=$app --key=skipped_uris
fi
# Remove unprotected_uris if exists
if [ ! -z "$unprotected_uris" ]; then
ynh_app_setting_delete --app=$app --key=unprotected_uris
fi
# Remove protected_uris if exists
if [ ! -z "$protected_uris" ]; then
ynh_app_setting_delete --app=$app --key=protected_uris
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -99,6 +115,8 @@ then
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id=$architecture
# Set execution rights
chmod u+x $final_path/cowyo
fi
#=================================================
@ -146,16 +164,11 @@ ynh_add_systemd_config
chown -R $app: $final_path
#=================================================
# SETUP SSOWAT
# SETUP PERMISSIONS
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1
#ynh_script_progression --message="Upgrading permissions configuration..." --time --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi
#=================================================
# START SYSTEMD SERVICE