1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/z-push_ynh.git synced 2024-09-03 18:05:58 +02:00

Keep conf files during upgrades >_>

This commit is contained in:
Alexandre Aubin 2023-12-05 01:56:50 +01:00
parent 9b56411c76
commit 77a15b6e28

View file

@ -26,11 +26,31 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
mkdir "$install_dir/bkp"
conf_files_to_keep="backend/caldav/config.php backend/carddav/config.php backend/imap/config.php backend/combined/config.php autodiscover/config.php backend/searchldap/config.php"
for file in $conf_files_to_keep
do
if [ -e $install_dir/$file ]
then
mkdir -p $install_dir/bkp/$(dirname $file)
cp $install_dir/$file $install_dir/bkp/$file
fi
done
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
mkdir "$install_dir/tmp" mkdir "$install_dir/tmp"
ynh_setup_source --dest_dir="$install_dir/tmp" ynh_setup_source --dest_dir="$install_dir/tmp"
cp -af "$install_dir/tmp/src/." "$install_dir/." cp -af "$install_dir/tmp/src/." "$install_dir/."
ynh_secure_remove --file="$install_dir/tmp" ynh_secure_remove --file="$install_dir/tmp"
for file in $conf_files_to_keep
do
if [ -e $install_dir/bkp/$file ]
then
cp $install_dir/bkp/$file $install_dir/$file
fi
done
ynh_secure_remove --file="$install_dir/bkp"
fi fi
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"