From 6542f17fb3f5a52e5d38e8d33c095c7f77820a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 9 Dec 2023 21:43:50 +0100 Subject: [PATCH] cleaning --- manifest.toml | 3 +++ scripts/install | 42 ++++++++++++++++-------------------------- scripts/remove | 28 ---------------------------- scripts/restore | 22 ---------------------- scripts/upgrade | 44 ++++++++++++++++---------------------------- 5 files changed, 35 insertions(+), 104 deletions(-) diff --git a/manifest.toml b/manifest.toml index a114095..8523907 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,8 +19,11 @@ code = "https://github.com/timvisee/send" yunohost = ">= 11.2" architectures = ["amd64", "arm64", "armhf"] multi_instance = true + ldap = false + sso = false + disk = "50M" ram.build = "1G" ram.runtime = "50M" diff --git a/scripts/install b/scripts/install index 54ab523..f830ed4 100644 --- a/scripts/install +++ b/scripts/install @@ -45,6 +45,22 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config +env_path="$PATH" +# Create a dedicated systemd config +ynh_add_systemd_config + +yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" + +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=2 + +ynh_add_config --template="config.js" --destination="$install_dir/server/config.js" + +chmod 400 "$install_dir/server/config.js" +chown $app: "$install_dir/server/config.js" + #================================================= # SPECIFIC SETUP #================================================= @@ -58,32 +74,6 @@ pushd "$install_dir" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build popd -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=2 - -ynh_add_config --template="../conf/config.js" --destination="$install_dir/server/config.js" - -chmod 400 "$install_dir/server/config.js" -chown $app: "$install_dir/server/config.js" - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -env_path="$PATH" -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 1dba9eb..9846aba 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,42 +22,14 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE THE REDIS DATABASE -#================================================= -ynh_script_progression --message="Removing the Redis database..." --weight=1 - ynh_redis_remove_db "$redis_db" -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing $app main directory..." --weight=6 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - ynh_remove_nodejs #================================================= diff --git a/scripts/restore b/scripts/restore index ae7d735..49895c4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -30,26 +30,11 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=7 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." - ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=5 - ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" #================================================= @@ -59,13 +44,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 87b32e8..b667c3d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,6 +62,22 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config +env_path="$PATH" +# Create a dedicated systemd config +ynh_add_systemd_config + +yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" + +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." + +ynh_add_config --template="config.js" --destination="$install_dir/server/config.js" + +chmod 400 "$install_dir/server/config.js" +chown $app: "$install_dir/server/config.js" + #================================================= # SPECIFIC UPGRADE #================================================= @@ -79,34 +95,6 @@ then popd fi -#================================================= -# UPDATE A CONFIG FILE -#================================================= -ynh_script_progression --message="Updating a configuration file..." - -ynh_add_config --template="../conf/config.js" --destination="$install_dir/server/config.js" - -chmod 400 "$install_dir/server/config.js" -chown $app: "$install_dir/server/config.js" - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 - -env_path="$PATH" -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #=================================================