From bd851fa591c901516c650d452e5e06acb399cf95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 29 Oct 2023 14:58:18 +0100 Subject: [PATCH] cleaning --- manifest.toml | 4 ++-- scripts/change_url | 2 +- scripts/install | 3 +-- scripts/remove | 17 ----------------- scripts/restore | 20 +------------------- scripts/upgrade | 25 ++++++------------------- 6 files changed, 11 insertions(+), 60 deletions(-) diff --git a/manifest.toml b/manifest.toml index dc42236..8e1d531 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://www.navidrome.org/docs" code = "https://github.com/deluan/navidrome" [integration] -yunohost = ">= 11.1.20" +yunohost = ">= 11.2" architectures = ["amd64", "arm64", "armhf"] multi_instance = false ldap = false @@ -43,7 +43,7 @@ ram.runtime = "50M" [install.language] ask.en = "Choose the application language" ask.fr = "Choisissez la langue de l'application" - type = "string" + type = "select" choices = ["de", "en", "es", "fr", "it", "nl", "pt"] default = "fr" diff --git a/scripts/change_url b/scripts/change_url index 200a19e..1c33c62 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -33,7 +33,7 @@ ynh_script_progression --message="Modifying a config file..." --weight=1 config_path="/var/lib/$app" path_url="$new_path" -ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml" +ynh_add_config --template="navidrome.toml" --destination="$config_path/navidrome.toml" chmod 600 "$config_path/navidrome.toml" chown -R $app:$app "$config_path" diff --git a/scripts/install b/scripts/install index fcfb6eb..8d6232d 100644 --- a/scripts/install +++ b/scripts/install @@ -40,7 +40,6 @@ ynh_script_progression --message="Setting up source files..." --weight=4 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -72,7 +71,7 @@ ynh_app_setting_set --app=$app --key=config_path --value=$config_path mkdir -p "$config_path" # Main config File -ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml" +ynh_add_config --template="navidrome.toml" --destination="$config_path/navidrome.toml" chmod 600 "$config_path/navidrome.toml" chown -R $app:$app "$config_path" diff --git a/scripts/remove b/scripts/remove index cbce88c..a104918 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,29 +22,12 @@ 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 NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." --weight=6 - # Remove the config directory securely ynh_secure_remove --file="/var/lib/$app" diff --git a/scripts/restore b/scripts/restore index 4e4aab3..3a7c4af 100644 --- a/scripts/restore +++ b/scripts/restore @@ -17,17 +17,9 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE VARIOUS FILES #================================================= @@ -46,10 +38,7 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig 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..." +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" yunohost service add $app --description="Web-based music collection server and streamer" @@ -60,13 +49,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:" -#================================================= -# 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 30ad5b7..26566c4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,7 +79,6 @@ then ynh_setup_source --dest_dir="$install_dir" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -91,6 +90,11 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +yunohost service add $app --description="Web-based music collection server and streamer" + #================================================= # UPDATE A CONFIG FILE #================================================= @@ -99,28 +103,11 @@ ynh_script_progression --message="Updating a configuration file..." config_path="/var/lib/$app" # Uncomment when there is new options added upstream -ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml" +ynh_add_config --template="navidrome.toml" --destination="$config_path/navidrome.toml" chmod 600 "$config_path/navidrome.toml" chown -R $app:$app "$config_path" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 - -# 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="Web-based music collection server and streamer" - #================================================= # START SYSTEMD SERVICE #=================================================