1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wekan_ynh.git synced 2024-09-03 20:36:09 +02:00

remove previous sources during upgrade

This commit is contained in:
yalh76 2019-07-13 21:19:48 +02:00
parent d5c6261967
commit 1cfd8eed14

View file

@ -81,7 +81,7 @@ fi
if ynh_version_gt "0.77-2" "${previous_version}" ; then if ynh_version_gt "0.77-2" "${previous_version}" ; then
ynh_install_nodejs --nodejs_version="8.9.3" ynh_install_nodejs --nodejs_version="8.9.3"
ynh_use_nodejs ynh_use_nodejs
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_replace_string --match_string="__NODEJS__" --replace_string="$nodejs_use_version" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__NODEJS__" --replace_string="$nodejs_use_version" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
@ -155,10 +155,25 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_print_info --message="Upgrading source files..." ynh_print_info --message="Upgrading source files..."
architecture=$(ynh_detect_arch) # Create a temporary directory
tmpdir="$(mktemp -d)"
# Backup the env file in the temp dir
cp -a "$final_path/.env" "$tmpdir/.env"
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
architecture=$(ynh_detect_arch)
# 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" --source_id="$architecture" ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
#Copy the admin saved settings from tmp directory to final path
cp -a "$tmpdir/.env" "$final_path/.env"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
fi fi
#================================================= #=================================================