From ebaac83652956d26aeea86f6535ebdffbfc1a5cf Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 7 Dec 2020 18:44:14 +0100 Subject: [PATCH] Fix linter warnings --- README.md | 2 +- check_process | 3 --- manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/backup | 23 ++++------------------- scripts/change_url | 14 +++++++------- scripts/install | 8 ++++---- scripts/remove | 14 ++------------ scripts/restore | 6 +++--- scripts/upgrade | 12 +++++++++--- 10 files changed, 32 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index e144991..b483cf6 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ How to configure this app: by an admin panel. ## Documentation -* Official documentation: +* Official documentation: https://airsonic.github.io/docs ## YunoHost specific features diff --git a/check_process b/check_process index 6285fa4..144a023 100644 --- a/check_process +++ b/check_process @@ -15,11 +15,8 @@ upgrade=1 from_commit=72d530415c016b23b6ba62085272957b04d2cca6 backup_restore=1 multi_instance=1 - 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 b640dd7..57909e8 100644 --- a/scripts/backup +++ b/scripts/backup @@ -22,7 +22,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -31,25 +31,19 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) service_config=$(ynh_app_setting_get --app=$app --key=service_config) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP #================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=2 - -ynh_systemd_action --service_name=$app --action="stop" +ynh_print_info --message="Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." --weight=1 ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1 ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -58,14 +52,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP LOGROTATE #================================================= -ynh_script_progression --message="Backing up logrotate configuration..." --weight=1 ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= # BACKUP SYSTEMD #================================================= -ynh_script_progression --message="Backing up systemd configuration..." --weight=1 ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup --src_path="$service_config" @@ -76,15 +68,8 @@ ynh_backup --src_path="$service_config" ynh_backup --src_path="/home/yunohost.airsonic" --is_big -#================================================= -# 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" - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." 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..231039d 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 #================================================= @@ -199,7 +199,7 @@ ynh_use_logrotate $final_path/airsonic.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/airsonic.log" #================================================= # START SYSTEMD SERVICE @@ -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..43fdce6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -109,13 +109,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="$service_config" -systemctl enable $app.service +systemctl enable $app.service --quiet #================================================= # 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/airsonic.log" #================================================= # START SYSTEMD SERVICE @@ -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 3ee71ec..84db441 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -95,9 +95,9 @@ 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 +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -217,6 +217,12 @@ ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target # Set permissions on app files chown -R $app: $final_path +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= + +yunohost service add $app --description="Airsonic daemon" --log="$final_path/airsonic.log" + #================================================= # SETUP SSOWAT #================================================= @@ -252,7 +258,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