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

--keep plugins and config

This commit is contained in:
ericgaspar 2022-05-17 10:56:37 +02:00
parent 40a9cf459b
commit 9e55c98aa2
No known key found for this signature in database
GPG key ID: 574F281483054D44

View file

@ -32,7 +32,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
architecture=$YNH_ARCH
version=$(ynh_app_setting_get --app=$app --key=version)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
@ -123,28 +122,11 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=2
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Backup the config file and local plugins in the temp dir
cp -a "$final_path/config/config.json" "$tmpdir/config.json"
cp -ar "$final_path/plugins" "$tmpdir/plugins"
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
if [ "$version" = "Enterprise" ]; then
ynh_setup_source --dest_dir="$final_path" --source_id="enterprise"
ynh_setup_source --dest_dir="$final_path" --source_id="enterprise" --keep="$final_path/plugins $final_path/config/config.json"
elif [ "$version" = "Team" ]; then
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
ynh_setup_source --dest_dir="$final_path" --source_id="$YNH_ARCH" --keep="$final_path/plugins $final_path/config/config.json"
fi
# Copy the admin saved settings and plugins from tmp directory to final path
cp -a "$tmpdir/config.json" "$final_path/config/config.json"
cp -ar --no-clobber "$tmpdir/plugins" "$final_path/"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
fi
chmod 750 "$final_path"