2019-08-13 21:35:51 +02:00
|
|
|
#!/bin/bash
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2020-10-25 16:31:23 +01:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
2019-08-13 21:35:51 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
|
|
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
|
2020-10-25 16:31:23 +01:00
|
|
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
2019-08-13 21:35:51 +02:00
|
|
|
ynh_backup_before_upgrade
|
|
|
|
ynh_clean_setup () {
|
|
|
|
ynh_restore_upgradebackup
|
|
|
|
}
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
2022-03-05 18:08:57 +01:00
|
|
|
ynh_script_progression --message="Ensuring downward compatibility..."
|
|
|
|
if ynh_legacy_permissions_exists; then
|
|
|
|
ynh_legacy_permissions_delete_all
|
|
|
|
ynh_app_setting_delete --app=$app --key=is_public
|
|
|
|
fi
|
|
|
|
|
2022-03-03 17:58:37 +01:00
|
|
|
ynh_script_progression --message="Making sure dedicated system user exists..."
|
|
|
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
2019-08-13 21:35:51 +02:00
|
|
|
|
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
|
|
then
|
2020-10-25 16:31:23 +01:00
|
|
|
ynh_script_progression --message="Upgrading source files..."
|
2020-10-31 22:01:13 +01:00
|
|
|
ynh_secure_remove --file="$final_path"
|
2019-08-13 21:35:51 +02:00
|
|
|
ynh_setup_source --dest_dir="$final_path"
|
|
|
|
fi
|
|
|
|
|
2022-03-03 17:58:37 +01:00
|
|
|
chmod -R 440 "$final_path"
|
|
|
|
find "$final_path" -type d | xargs chmod 110
|
2022-03-05 00:25:55 +01:00
|
|
|
chmod 750 "$final_path"/css
|
2022-03-03 17:58:37 +01:00
|
|
|
chown -R $app:www-data "$final_path"
|
2019-08-13 21:35:51 +02:00
|
|
|
|
2022-03-03 17:58:37 +01:00
|
|
|
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
|
|
|
ynh_add_nginx_config
|
2019-08-13 21:35:51 +02:00
|
|
|
|
2022-03-03 17:58:37 +01:00
|
|
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
|
|
|
ynh_add_fpm_config
|
2019-08-13 21:35:51 +02:00
|
|
|
|
2020-10-31 22:01:13 +01:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|