1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/airsonic_ynh.git synced 2024-09-03 18:06:14 +02:00

Merge pull request #41 from YunoHost-Apps/linter-warnings

Linter warnings
This commit is contained in:
Éric Gaspar 2020-12-07 19:29:33 +01:00 committed by GitHub
commit fe2ffe023a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 53 additions and 73 deletions

View file

@ -32,14 +32,14 @@ How to configure this app: by an admin panel.
## Documentation
* Official documentation: <https://airsonic.github.io/docs>
* 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 <https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/>
* See https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/
## Supported architectures

View file

@ -18,8 +18,6 @@
incorrect_path=1
port_already_use=0
change_url=1
;;; Levels
Level 5=auto
;;; Options
Email=
Notification=none

View file

@ -14,7 +14,7 @@
"email": "gofannon@riseup.net"
},
"requirements": {
"yunohost": ">= 3.5"
"yunohost": ">= 3.8.1"
},
"multi_instance": true,
"services": [

View file

@ -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 \

View file

@ -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"
@ -74,17 +66,10 @@ ynh_backup --src_path="$service_config"
# BACKUP DATA
#=================================================
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"
ynh_backup --src_path="/home/yunohost.$app" --is_big
#=================================================
# 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)."

View file

@ -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

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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
@ -217,6 +218,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/$app.log"
#=================================================
# SETUP SSOWAT
#=================================================
@ -252,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