1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/firefly-iii_ynh.git synced 2024-09-03 18:36:13 +02:00

Update upgrade

This commit is contained in:
Memo 2022-04-07 09:08:20 +02:00 committed by GitHub
parent a611c0f213
commit 139d73d6ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
random_key=$(ynh_app_setting_get --app=$app --key=random_key) random_key=$(ynh_app_setting_get --app=$app --key=random_key)
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
phpversion=$YNH_PHP_VERSION phpversion=$YNH_PHP_VERSION
timezone="$(cat /etc/timezone)"
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -85,50 +86,16 @@ ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; ynh_script_progression --message="Upgrading source files..."
then
pushd "$final_path"
ynh_setup_source --dest_dir=$final_path
ynh_secure_remove --file="$final_path/bootstrap/cache/*"
ynh_secure_remove --file="$final_path/vendor/"
popd
else # Download, check integrity, uncompress and patch the source from app.src
ynh_script_progression --message="Upgrading source files..." ynh_setup_source --dest_dir="$final_path" --keep="$final_path/.env $final_path/storage/upload $final_path/storage/export"
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Backup the config file in the temp dir
mkdir -p "$tmpdir/storage/upload"
mkdir -p "$tmpdir/storage/export"
mkdir -p "$final_path/storage/upload/"
mkdir -p "$final_path/storage/export/"
cp -aT "$final_path/storage/upload" "$tmpdir/storage/upload/$"
cp -a "$final_path/.env" "$tmpdir/.env"
cp -aT "$final_path/storage/export" "$tmpdir/storage/export/"
ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path
ynh_secure_remove bootstrap/cache/*
# Restore the config file and data
mkdir -p "$final_path/storage/upload/"
mkdir -p "$final_path/storage/export/"
cp -aT "$tmpdir/storage/upload" "$final_path/storage/upload"
cp -aT "$tmpdir/storage/export" "$final_path/storage/export"
cp -a "$tmpdir/.env" "$final_path/.env"
# Remove temporary directory
ynh_secure_remove --file="$tmpdir"
fi
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"