From 51a798ffd6c7256ccc25adf292e26a8c7ffea854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 24 May 2024 08:26:56 +0200 Subject: [PATCH] cleaning --- manifest.toml | 2 +- scripts/backup | 8 +------- scripts/install | 1 - scripts/remove | 5 ----- scripts/upgrade | 38 ++++++++++++-------------------------- 5 files changed, 14 insertions(+), 40 deletions(-) diff --git a/manifest.toml b/manifest.toml index 3db19dc..766b225 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,7 +19,7 @@ cpe = "cpe:2.3:a:xwiki:cryptpad" fund = "https://opencollective.com/cryptpad/contribute?language=fr" [integration] -yunohost = ">= 11.1.21" +yunohost = ">= 11.2" architectures = "all" multi_instance = false ldap = false diff --git a/scripts/backup b/scripts/backup index 7189d8c..38d96c5 100644 --- a/scripts/backup +++ b/scripts/backup @@ -22,17 +22,11 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= diff --git a/scripts/install b/scripts/install index 5be5342..a9721e6 100644 --- a/scripts/install +++ b/scripts/install @@ -68,7 +68,6 @@ ynh_script_progression --message="Adding system configurations related to $app.. # Create a dedicated NGINX config ynh_add_nginx_config -env_path="$PATH" # Create a dedicated systemd config ynh_add_systemd_config diff --git a/scripts/remove b/scripts/remove index dbc0282..a7f6a3e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -29,11 +29,6 @@ ynh_remove_systemd_config # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=3 - ynh_remove_nodejs #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e55c805..8f85586 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,10 +17,11 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 email=$(ynh_user_get_info --username=$admin --key=mail) #================================================= -# CHECK VERSION +# UPGRADE DEPENDENCIES #================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=6 -upgrade_type=$(ynh_check_app_version_changed) +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # STANDARD UPGRADE STEPS @@ -34,17 +35,13 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=1 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" #--keep="config/config.js" +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" #--keep="config/config.js" - chmod -R o-rwx "$install_dir" - chown -R $app:$app "$install_dir" -fi +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # APPLY FOLDER GROUP RIGHTS FOR WWW-DATA @@ -88,13 +85,10 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -env_path="$PATH" -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=6 +# Create a dedicated systemd config +ynh_add_systemd_config -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +yunohost service add $app --description="Zero Knowledge realtime collaborative editor" --log="/var/log/$app/$app.log" #================================================= # INSTALL CRYPTPAD @@ -109,20 +103,12 @@ pushd "$install_dir" ynh_exec_warn_less npm run build popd -#================================================= -# CREATE SYSTEMD SERVICE -#================================================= -# Create a dedicated systemd config -ynh_add_systemd_config - -yunohost service add $app --description="Zero Knowledge realtime collaborative editor" --log="/var/log/$app/$app.log" - #================================================= # ADD UPGRADED CONFIG WITH SANDBOX #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -ynh_add_config --template="../conf/config.js" --destination="$install_dir/config/config.js" +ynh_add_config --template="config.js" --destination="$install_dir/config/config.js" chmod 600 "$install_dir/config/config.js" chown $app "$install_dir/config/config.js"