diff --git a/scripts/install b/scripts/install index 359b09a..ecb45af 100644 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=final_path --value=$final_path -ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS @@ -160,11 +159,11 @@ if [ $is_public -eq 1 ] then # Everyone can access the app. # The "main" permission is automatically created before the install script. - ynh_permission_update --permission "main" --add "visitors" + ynh_permission_update --permission="main" --add="visitors" fi # Only the admin can access the admin panel of the app (if the app has an admin panel) -ynh_permission_create --permission "admin" --allowed $admin +ynh_permission_create --permission="admin" --allowed=$admin #================================================= # RELOAD NGINX diff --git a/scripts/upgrade b/scripts/upgrade index ed18b31..5fb1c2f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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) admin=$(ynh_app_setting_get --app=$app --key=admin) -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) @@ -28,6 +27,23 @@ port=$(ynh_app_setting_get --app=$app --key=port) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + +if ! ynh_permission_exists --permission="admin"; then + # Create the required permissions + ynh_permission_create --permission="admin" --allowed=$admin +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -83,7 +99,7 @@ if [ -z "/etc/jellyfin/network.xml" ]; then ynh_script_progression --message="Configuring the settings..." --weight=1 # Load services once to generate network.xml - systemctl enable jellyfin + systemctl enable jellyfin --quiet systemctl start jellyfin sleep 5 systemctl stop jellyfin @@ -127,16 +143,6 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --weight # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading permissions configuration..." --weight=1 - -# Create the admin permission if needed -if ! ynh_permission_exists --permission "admin"; then - ynh_permission_create --permission "admin" --allowed $admin -fi - #================================================= # INTEGRATE SERVICE IN YUNOHOST #=================================================