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:
parent
f1eb3444ae
commit
eec978c560
1 changed files with 28 additions and 28 deletions
|
@ -31,6 +31,20 @@ password_hash=$(ynh_app_setting_get --app=$app --key=password_hash)
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
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
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -61,18 +75,12 @@ if ! ynh_permission_exists --permission="admin"; then
|
||||||
fi
|
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
|
# Create a dedicated user (if not existing)
|
||||||
ynh_backup_before_upgrade
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
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
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
|
@ -85,19 +93,19 @@ then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
ynh_script_progression --message="Upgrading source files..." --weight=3
|
||||||
|
|
||||||
# Keep the Specific and config folders intact: https://sabre.io/baikal/upgrade/
|
# Keep the Specific and config folders intact: https://sabre.io/baikal/upgrade/
|
||||||
mkdir -p "$final_path/config"
|
#mkdir -p "$final_path/config"
|
||||||
temp_folder=$(mktemp -d)
|
#temp_folder=$(mktemp -d)
|
||||||
mv "$final_path/Specific" "$temp_folder"
|
#mv "$final_path/Specific" "$temp_folder"
|
||||||
mv "$final_path/config" "$temp_folder"
|
#mv "$final_path/config" "$temp_folder"
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# 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/Specific"
|
||||||
ynh_secure_remove --file="$final_path/config"
|
#ynh_secure_remove --file="$final_path/config"
|
||||||
|
|
||||||
mv "$temp_folder/Specific" "$final_path"
|
#mv "$temp_folder/Specific" "$final_path"
|
||||||
mv "$temp_folder/config" "$final_path"
|
#mv "$temp_folder/config" "$final_path"
|
||||||
ynh_secure_remove --file="$temp_folder"
|
#ynh_secure_remove --file="$temp_folder"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -115,14 +123,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
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
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue