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

Update upgrade

This commit is contained in:
ericgaspar 2021-06-07 18:08:10 +02:00
parent ea6dc9df1c
commit c8375f97dc
No known key found for this signature in database
GPG key ID: 574F281483054D44

View file

@ -26,6 +26,20 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -38,17 +52,6 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -65,8 +68,10 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/configuration.ini"
ynh_setup_source --dest_dir="$final_path"
fi
chmod 750 "$final_path"
@ -89,6 +94,16 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/configuration.ini" --destination="$final_path/configuration.ini"
chmod 400 "$final_path/configuration.ini"
chown $app: "$final_path/configuration.ini"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================