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

Update upgrade

This commit is contained in:
ericgaspar 2022-04-03 10:38:11 +02:00
parent f1eb3444ae
commit eec978c560
No known key found for this signature in database
GPG key ID: 574F281483054D44

View file

@ -31,6 +31,20 @@ password_hash=$(ynh_app_setting_get --app=$app --key=password_hash)
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up Baïkal before upgrading (may take a while)..."
# 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
#=================================================
@ -61,18 +75,12 @@ if ! ynh_permission_exists --permission="admin"; then
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Backing up Baïkal before upgrading (may take a while)..." --weight=4
ynh_script_progression --message="Making sure dedicated system user exists..."
# 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
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD UPGRADE STEPS
@ -85,19 +93,19 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=3
# Keep the Specific and config folders intact: https://sabre.io/baikal/upgrade/
mkdir -p "$final_path/config"
temp_folder=$(mktemp -d)
mv "$final_path/Specific" "$temp_folder"
mv "$final_path/config" "$temp_folder"
#mkdir -p "$final_path/config"
#temp_folder=$(mktemp -d)
#mv "$final_path/Specific" "$temp_folder"
#mv "$final_path/config" "$temp_folder"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/Specific $final_path/config"
ynh_secure_remove --file="$final_path/Specific"
ynh_secure_remove --file="$final_path/config"
#ynh_secure_remove --file="$final_path/Specific"
#ynh_secure_remove --file="$final_path/config"
mv "$temp_folder/Specific" "$final_path"
mv "$temp_folder/config" "$final_path"
ynh_secure_remove --file="$temp_folder"
#mv "$temp_folder/Specific" "$final_path"
#mv "$temp_folder/config" "$final_path"
#ynh_secure_remove --file="$temp_folder"
fi
#=================================================
@ -115,14 +123,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================