From a3a65bd03fdbc709f0bb0875c02713b0d8f49270 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Dec 2020 13:01:51 +0100 Subject: [PATCH] Small fixes --- README.md | 4 ++-- check_process | 2 -- manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/backup | 2 +- scripts/change_url | 14 +++++++------- scripts/install | 22 +++++++++++----------- scripts/remove | 14 ++------------ scripts/restore | 18 +++++++++--------- scripts/upgrade | 19 ++++++++++--------- 10 files changed, 44 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index e144991..14905b4 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,14 @@ How to configure this app: by an admin panel. ## Documentation -* Official documentation: +* Official documentation: https://airsonic.github.io/docs ## YunoHost specific features * YunoHost LDAP accounts supported: you can login with them * [Multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) handled * Memory RAM limit set to 256 MB because Airsonic was often killed by lack of RAM (hello OOM killer) - * See + * See https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/ ## Supported architectures diff --git a/check_process b/check_process index 6285fa4..4db4937 100644 --- a/check_process +++ b/check_process @@ -18,8 +18,6 @@ incorrect_path=1 port_already_use=0 change_url=1 -;;; Levels - Level 5=auto ;;; Options Email= Notification=none diff --git a/manifest.json b/manifest.json index 03d442e..34040ba 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "gofannon@riseup.net" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index c019450..019d16b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -27,7 +27,7 @@ ynh_multimedia_build_main_dir () { local checksum="806a827ba1902d6911095602a9221181" # Download yunohost.multimedia scripts - wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz + wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1 # Check the control sum echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \ diff --git a/scripts/backup b/scripts/backup index 57909e8..02481ad 100644 --- a/scripts/backup +++ b/scripts/backup @@ -66,7 +66,7 @@ ynh_backup --src_path="$service_config" # BACKUP DATA #================================================= -ynh_backup --src_path="/home/yunohost.airsonic" --is_big +ynh_backup --src_path="/home/yunohost.$app" --is_big #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index 88db807..2a4ea92 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -59,23 +59,23 @@ ynh_systemd_action --service_name=$app --action="stop" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# Change the path in the NGINX config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -116,7 +116,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/ #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index af47ef7..ef528f0 100644 --- a/scripts/install +++ b/scripts/install @@ -81,9 +81,9 @@ ynh_setup_source --dest_dir=$final_path #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -100,14 +100,14 @@ ynh_system_user_create --username=$app # CREATE DIRECTORIES #================================================= -mkdir -p /home/yunohost.airsonic/{Podcasts,Playlists} +mkdir -p /home/yunohost.$app/{Podcasts,Playlists} #================================================= # SECURING FILES AND DIRECTORIES #================================================= -chown -R $app:www-data /home/yunohost.airsonic/ -chmod -R 764 /home/yunohost.airsonic +chown -R $app:www-data /home/yunohost.$app/ +chmod -R 764 /home/yunohost.$app #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -115,8 +115,8 @@ chmod -R 764 /home/yunohost.airsonic ynh_script_progression --message="Adding multimedia directories..." --weight=3 ynh_multimedia_build_main_dir -ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Podcasts" --dest_dir="share/Podcasts" -ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Playlists" --dest_dir="share/Playlists" +ynh_multimedia_addfolder --source_dir="/home/yunohost.$app/Podcasts" --dest_dir="share/Podcasts" +ynh_multimedia_addfolder --source_dir="/home/yunohost.$app/Playlists" --dest_dir="share/Playlists" # Allow airsonic to write into these directories ynh_multimedia_addaccess $app @@ -193,13 +193,13 @@ chown -R $app: $final_path ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) -ynh_use_logrotate $final_path/airsonic.log +ynh_use_logrotate $final_path/$app.log #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description "Airsonic daemon" --log "$final_path/airsonic.log" +yunohost service add $app --description="Airsonic daemon" --log="$final_path/$app.log" #================================================= # START SYSTEMD SERVICE @@ -207,7 +207,7 @@ yunohost service add $app --description "Airsonic daemon" --log "$final_path/air ynh_script_progression --message="Starting a systemd service..." --weight=12 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in" +ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/$app.log" --line_match="Started Application in" #================================================= # SETUP APPLICATION WITH CURL @@ -284,7 +284,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index 78f741b..dc438a9 100644 --- a/scripts/remove +++ b/scripts/remove @@ -61,9 +61,9 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= @@ -74,16 +74,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/restore b/scripts/restore index cad5ecb..c9ac3f4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -115,14 +115,14 @@ systemctl enable $app.service # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description "Airsonic daemon" --log "$final_path/airsonic.log" +yunohost service add $app --description="Airsonic daemon" --log="$final_path/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=12 -ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in" +ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/$app.log" --line_match="Started Application in" #================================================= # RESTORE THE LOGROTATE CONFIGURATION @@ -135,15 +135,15 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup. -ynh_restore_file --origin_path="/home/yunohost.airsonic" --not_mandatory +ynh_restore_file --origin_path="/home/yunohost.$app" --not_mandatory #================================================= # RESTORE USER RIGHTS #================================================= -mkdir -p /home/yunohost.airsonic/{Podcasts,Playlists} -chown -R $app:www-data /home/yunohost.airsonic/ -chmod -R 764 /home/yunohost.airsonic +mkdir -p /home/yunohost.$app/{Podcasts,Playlists} +chown -R $app:www-data /home/yunohost.$app/ +chmod -R 764 /home/yunohost.$app #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -151,8 +151,8 @@ chmod -R 764 /home/yunohost.airsonic ynh_script_progression --message="Adding multimedia directories..." --weight=3 ynh_multimedia_build_main_dir -ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Podcasts" --dest_dir="share/Podcasts" -ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Playlists" --dest_dir="share/Playlists" +ynh_multimedia_addfolder --source_dir="/home/yunohost.$app/Podcasts" --dest_dir="share/Podcasts" +ynh_multimedia_addfolder --source_dir="/home/yunohost.$app/Playlists" --dest_dir="share/Playlists" # Allow airsonic to write into these directories ynh_multimedia_addaccess $app @@ -161,7 +161,7 @@ ynh_multimedia_addaccess $app #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +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 f9c2053..7cb488b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,6 +80,7 @@ ynh_abort_if_errors ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -95,7 +96,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -121,14 +122,14 @@ ynh_system_user_create --username=$app # CREATE DIRECTORIES #================================================= -mkdir -p /home/yunohost.airsonic/{Podcasts,Playlists} +mkdir -p /home/yunohost.$app/{Podcasts,Playlists} #================================================= # SECURING FILES AND DIRECTORIES #================================================= -chown -R $app:www-data /home/yunohost.airsonic/ -chmod -R 764 /home/yunohost.airsonic +chown -R $app:www-data /home/yunohost.$app/ +chmod -R 764 /home/yunohost.$app #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -136,8 +137,8 @@ chmod -R 764 /home/yunohost.airsonic ynh_script_progression --message="Adding multimedia directories..." --weight=3 ynh_multimedia_build_main_dir -ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Podcasts" --dest_dir="share/Podcasts" -ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Playlists" --dest_dir="share/Playlists" +ynh_multimedia_addfolder --source_dir="/home/yunohost.$app/Podcasts" --dest_dir="share/Podcasts" +ynh_multimedia_addfolder --source_dir="/home/yunohost.$app/Playlists" --dest_dir="share/Playlists" # Allow airsonic to write into these directories ynh_multimedia_addaccess $app @@ -189,7 +190,7 @@ ynh_store_file_checksum --file="$final_path/airsonic.properties" ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append --logfile="$final_path/airsonic.log" +ynh_use_logrotate --non-append --logfile="$final_path/$app.log" #================================================= # SETUP SYSTEMD @@ -221,7 +222,7 @@ chown -R $app: $final_path # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description "Airsonic daemon" --log "$final_path/airsonic.log" +yunohost service add $app --description="Airsonic daemon" --log="$final_path/$app.log" #================================================= # SETUP SSOWAT @@ -258,7 +259,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload