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

Update upgrade

fix keep the DB on a temporaly file
This commit is contained in:
Robles Rodolphe 2023-09-12 23:08:07 +02:00 committed by GitHub
parent d5b51248c0
commit fb8879fed3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,6 +29,12 @@ if [[ -z "${secret_key:-}" ]]; then
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
fi
#=================================================
# BACKUP SQLITE DATABASE
#=================================================
ynh_script_progression --message="Backup of the DB in temporary file...." --weight=5
cp -a $install_dir/data/association.sqlite /tmp/
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -38,7 +44,7 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="association.sqlite config.local.user.php data"
ynh_setup_source --dest_dir="$install_dir" --keep="association.sqlite data skel-dist config.local.user.php" --full_replace=1
fi
chmod -R o-rwx "$install_dir"
@ -74,13 +80,13 @@ fi
if ynh_compare_current_package_version --comparison le --version 1.2.11~ynh3; then
ynh_replace_string --match_string="namespace Garradin;" --replace_string="namespace Paheko;" --target_file="$install_dir/config.local.user.php"
fi
# NOTE: Don't overwrite config.local.user.php
ynh_add_config --template="config.local.php" --destination="$install_dir/config.local.php"
ynh_add_config --template="config.local.yunohost.php" --destination="$install_dir/config.local.yunohost.php"
# NOTE: Don't overwrite config.local.user.php
# Move the database on folder data/data created and remove the folder
mv $install_dir/data/data/association.sqlite $install_dir/data/
ynh_secure_remove --file=$install_dir/data/data
# Restore the sqlite DB
mv /tmp/association.sqlite $install_dir/data
# Permissions on files and directories
chmod -R o-rwx "$install_dir"
@ -103,10 +109,10 @@ sleep 5
ynh_local_curl "/index.php"
sleep 5
# Move the database on folder data/data created and remove the folder
ynh_secure_remove --file=$install_dir/data/data
#=================================================
# END OF SCRIPT
#=================================================
# remove directory duplicated
ynh_secure_remove --file="$install_dir/data/data"
ynh_script_progression --message="Upgrade of $app completed" --last