1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jappix_ynh.git synced 2024-09-03 19:26:19 +02:00

Update upgrade

This commit is contained in:
ericgaspar 2021-07-21 15:23:29 +02:00
parent daa4ea7452
commit 62c62e289e
No known key found for this signature in database
GPG key ID: 574F281483054D44

View file

@ -32,26 +32,24 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
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
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."--weight=1
# Set default values
if [ -z "$language" ]; then
language="${language:-en}"
ynh_app_setting_set --app=$language --key=language --value=$language
fi
if [ -z "$name" ]; then
name=${name:-YunoJappix}
ynh_app_setting_set --app=$app --key=name --value=$name
fi
# If db_name doesn't exist, create it
if [ -z "$final_path/store/conf" ]; then
mkdir -p "$final_path/store/conf"
fi
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
@ -68,20 +66,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# 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
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -90,7 +74,7 @@ ynh_script_progression --message="Setting up source files..." --weight=6
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"
fi