qr_ynh/scripts/upgrade

44 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
ynh_script_progression --message="Loading installation settings..."
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)
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_restore_upgradebackup
}
ynh_abort_if_errors
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
ynh_script_progression --message="Making sure dedicated system user exists..."
ynh_system_user_create --username=$app --home_dir="$final_path"
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
ynh_secure_remove --file="$final_path"
ynh_setup_source --dest_dir="$final_path"
fi
libreqr_apply_filesystem_permissions
ynh_script_progression --message="Upgrading NGINX web server configuration..."
ynh_add_nginx_config
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
ynh_add_fpm_config
ynh_script_progression --message="Upgrade of $app completed" --last