From 244b50a859a71276d8a6b1b01e9b0e68662764dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 27 Jun 2024 23:55:38 +0200 Subject: [PATCH] Fix: name can't be an install question anymore --- manifest.toml | 2 +- scripts/install | 6 +++--- scripts/upgrade | 13 +++++++++++-- tests.toml | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/manifest.toml b/manifest.toml index c36851f..b93f08b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -40,7 +40,7 @@ ram.runtime = "50M" [install.password] type = "password" - [install.name] + [install.instance_name] ask.en = "Choose a name for your Plume instance" ask.fr = "Choisissez un nom pour votre instance Plume" type = "string" diff --git a/scripts/install b/scripts/install index f82c096..9d64131 100755 --- a/scripts/install +++ b/scripts/install @@ -81,10 +81,10 @@ chown $app:$app "$install_dir/$app/.env" #================================================= ynh_script_progression --message="Making setup..." -# Set right permissions +# Set right permissions chown -R "$app":"$app" $install_dir -export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" +export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" pushd $install_dir/$app sudo -u "$app" env PATH=$PATH plm migration run @@ -92,7 +92,7 @@ pushd $install_dir/$app # Add new instance if [ $registration -eq 1 ] then - sudo -u "$app" env PATH=$PATH plm instance new --domain "$domain" --name "$name" -l 'CC-BY' + sudo -u "$app" env PATH=$PATH plm instance new --domain "$domain" --name "$instance_name" -l 'CC-BY' else sudo -u "$app" env PATH=$PATH plm instance new --private --domain "$domain" --name "$name" -l 'CC-BY' fi diff --git a/scripts/upgrade b/scripts/upgrade index 3879f8a..c655f0c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,15 @@ ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped plume" +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +if [ -z "$instance_name" ]; then + ynh_app_setting_set --app="$app" --key="instance_name" --value="$name" +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -79,11 +88,11 @@ chown $app:$app "$install_dir/$app/.env" #================================================= ynh_script_progression --message="Making setup..." -export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" +export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" pushd $install_dir/$app sudo -u "$app" env PATH=$PATH plm migration run -popd +popd #================================================= # SETUP SYSTEMD diff --git a/tests.toml b/tests.toml index 27e3dbb..a60c24c 100644 --- a/tests.toml +++ b/tests.toml @@ -6,8 +6,8 @@ test_format = 1.0 # Default args to use for install # ------------------------------- - args.name="my blog" - args.registration=0 + args.instance_name="my blog" + args.registration=0 # ------------------------------- # Commits to test upgrade from