From 60de584ff445127eba27fe42eb578c72730d549d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 28 Oct 2023 22:36:58 +0200 Subject: [PATCH] Update upgrade --- scripts/upgrade | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6cfc080..b5de61c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,13 +63,13 @@ ynh_systemd_action --service_name=$app --action="stop" ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 # If abiword setting doesn't exist -if [ -z "$abiword" ]; then +if [ -z "${abiword:-}" ]; then abiword=0 ynh_app_setting_set --app=$app --key=abiword --value=$abiword fi # If abiword setting exists -if [ -n "$abiword" ]; then +if [ -n "${abiword:-}" ]; then if [ $abiword -eq 1 ]; then export=abiword fi @@ -78,49 +78,49 @@ if [ -n "$abiword" ]; then fi # If export setting doesn't exist -if [ -z "$export" ]; then +if [ -z "${export:-}" ]; then export=none ynh_app_setting_set --app=$app --key=export --value=$export fi # If mypads setting doesn't exist -if [ -z "$mypads" ]; then +if [ -z "${mypads:-}" ]; then mypads=1 ynh_app_setting_set --app=$app --key=mypads --value=$mypads fi # If useldap setting doesn't exist -if [ -z "$useldap" ]; then +if [ -z "${useldap:-}" ]; then useldap=0 ynh_app_setting_set --app=$app --key=useldap --value=$useldap fi # If path setting doesn't exist -if [ -z "$path" ]; then +if [ -z "${path:-}" ]; then path="/" ynh_app_setting_set --app=$app --key=path --value=$path fi # If overwrite_settings doesn't exist, create it -if [ -z "$overwrite_settings" ]; then +if [ -z "${overwrite_settings:-}" ]; then overwrite_settings=1 ynh_app_setting_set --app=$app --key=overwrite_settings --value=$overwrite_settings fi # If overwrite_credentials doesn't exist, create it -if [ -z "$overwrite_credentials" ]; then +if [ -z "${overwrite_credentials:-}" ]; then overwrite_credentials=1 ynh_app_setting_set --app=$app --key=overwrite_credentials --value=$overwrite_credentials fi # If overwrite_nginx doesn't exist, create it -if [ -z "$overwrite_nginx" ]; then +if [ -z "${overwrite_nginx:-}" ]; then overwrite_nginx=1 ynh_app_setting_set --app=$app --key=overwrite_nginx --value=$overwrite_nginx fi # If overwrite_systemd doesn't exist, create it -if [ -z "$overwrite_systemd" ]; then +if [ -z "${overwrite_systemd:-}" ]; then overwrite_systemd=1 ynh_app_setting_set --app=$app --key=overwrite_systemd --value=$overwrite_systemd fi @@ -186,8 +186,8 @@ then then # Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ynh_backup_if_checksum_is_different --file="$install_dir/settings.json" - cp ../conf/settings.json "$install_dir/settings.json" - ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$install_dir/settings.json" + + ynh_add_config --template="../conf/settings.json" --destination="$install_dir/settings.json" if [ "$export" = "abiword" ] then @@ -208,7 +208,6 @@ then language=en ynh_app_setting_set --app=$app --key=language --value=$language fi - ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$install_dir/settings.json" # Use LDAP for MyPads if [ $mypads -eq 1 ] && [ $useldap -eq 1 ] @@ -298,7 +297,7 @@ popd #================================================= # UPGRADE NPM MODULES #================================================= -ynh_script_progression --message="Upgrading Etherpad..." --weight=60 +ynh_script_progression --message="Upgrading Etherpad..." --weight=10 pushd $install_dir ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH bin/installDeps.sh