mirror of
https://github.com/YunoHost-Apps/digitranscode_ynh.git
synced 2024-09-03 18:25:59 +02:00
Another try to preserve database when upgrading
Following the advises in https://forum.yunohost.org/t/error-in-the-upgrade-script-of-digiwords-fails-ci-tests/18975?u=melchisedech
This commit is contained in:
parent
ee2ab3888c
commit
e7a40c3cd0
1 changed files with 15 additions and 4 deletions
|
@ -110,8 +110,23 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --time --weight=1
|
||||
|
||||
# Create a temporary directory
|
||||
tmpdir="$(mktemp -d)"
|
||||
|
||||
# Backup the inc/digiwords.db file to the temp dir
|
||||
cp -ar "$final_path/inc/digiwords.db" "$tmpdir/digiwords.db"
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file=$final_path
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
# Copy digiwords.db back to the final_path
|
||||
cp -ar "$tmpdir/digiwords.db" "$final_path/inc/digiwords.db"
|
||||
|
||||
# Remove the tmp directory securely
|
||||
ynh_secure_remove --file="$tmpdir"
|
||||
fi
|
||||
|
||||
# FIXME: this should be managed by the core in the future
|
||||
|
@ -150,10 +165,6 @@ ynh_add_fpm_config
|
|||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# TAKE BACK THE OLD digiwords.db file
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring database..." --time --weight=1
|
||||
ynh_restore_file -o "$final_path/inc/digiwords.db"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
Loading…
Reference in a new issue