From b18357e9cacf7d7c33efdac56ad016aa68a4e129 Mon Sep 17 00:00:00 2001 From: Gofannon <17145502+Gofannon@users.noreply.github.com> Date: Wed, 15 Apr 2020 21:55:47 +0200 Subject: [PATCH 01/12] Upgrade to version 10.6.0 --- README.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5e361bd..0005039 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ If you have constrained bandwidth, you may set an upper limit for the bit rate o In addition to being a streaming media server, Airsonic works very well as a local jukebox. The intuitive web interface, as well as search and index facilities, are optimized for efficient browsing through large media libraries. Airsonic also comes with an integrated Podcast receiver, with many of the same features as you find in iTunes. -**Shipped version:** 10.5.0 +**Shipped version:** 10.6.0 ## Screenshots diff --git a/conf/app.src b/conf/app.src index e3469e7..7cedc14 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.5.0/airsonic.war -SOURCE_SUM=588e5362351406ac7e4eafede4fe3dae7b1e24eac6b6c330f51f413cfa184a5a +SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.6.0/airsonic.war +SOURCE_SUM=90fe5dbf83d71b83a955abbca8765ba144996ca8530648e93d1bb50d70fde827 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=false SOURCE_IN_SUBDIR=false diff --git a/manifest.json b/manifest.json index 31202d3..75242e7 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Stream and manage your music collection", "fr": "Streamez et gérez votre collection de musique" }, - "version": "10.5.0~ynh3", + "version": "10.6.0~ynh1", "url": "http://airsonic.github.io", "license": "GPL-3.0-or-later", "maintainer": { From c4a729568bf0cd1f1f71621bad9a0b457799b107 Mon Sep 17 00:00:00 2001 From: Gofannon <17145502+Gofannon@users.noreply.github.com> Date: Wed, 15 Apr 2020 21:56:19 +0200 Subject: [PATCH 02/12] Update system config to latest version --- conf/systemd.service | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/conf/systemd.service b/conf/systemd.service index 333c7d9..e05323a 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -20,5 +20,40 @@ ExecStart=/usr/bin/java \ User=__APP__ Group=__APP__ +# See https://www.freedesktop.org/software/systemd/man/systemd.exec.html +# for details +DevicePolicy=closed +DeviceAllow=char-alsa rw +NoNewPrivileges=yes +PrivateTmp=yes +PrivateUsers=yes +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=yes +RestrictRealtime=yes +SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap +ReadWritePaths=/var/airsonic + +# You can uncomment the following line if you're not using the jukebox +# This will prevent airsonic from accessing any real (physical) devices +#PrivateDevices=yes + +# You can change the following line to `strict` instead of `full` +# if you don't want airsonic to be able to +# write anything on your filesystem outside of AIRSONIC_HOME. +ProtectSystem=full + +# You can uncomment the following line if you don't have any media +# in /home/…. This will prevent airsonic from ever reading/writing anything there. +#ProtectHome=true + +# You can uncomment the following line if you're not using the OpenJDK. +# This will prevent processes from having a memory zone that is both writeable +# and executeable, making hacker's lifes a bit harder. +#MemoryDenyWriteExecute=yes + + [Install] WantedBy=multi-user.target \ No newline at end of file From e7e5fd33f540fcfccce95895956c06cbef9dd124 Mon Sep 17 00:00:00 2001 From: Gofannon <17145502+Gofannon@users.noreply.github.com> Date: Wed, 15 Apr 2020 22:55:24 +0200 Subject: [PATCH 03/12] fix startup of systemd service --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index e05323a..da45966 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -34,7 +34,7 @@ RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 RestrictNamespaces=yes RestrictRealtime=yes SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap -ReadWritePaths=/var/airsonic +ReadWritePaths=__FINALPATH__ # You can uncomment the following line if you're not using the jukebox # This will prevent airsonic from accessing any real (physical) devices From ad455ac3427ef9ae918a66c0f754e263187ee3e3 Mon Sep 17 00:00:00 2001 From: Gofannon <17145502+Gofannon@users.noreply.github.com> Date: Tue, 21 Apr 2020 00:07:33 +0200 Subject: [PATCH 04/12] update upstream version 10.6.1 (#29) --- README.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0005039..439b202 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ If you have constrained bandwidth, you may set an upper limit for the bit rate o In addition to being a streaming media server, Airsonic works very well as a local jukebox. The intuitive web interface, as well as search and index facilities, are optimized for efficient browsing through large media libraries. Airsonic also comes with an integrated Podcast receiver, with many of the same features as you find in iTunes. -**Shipped version:** 10.6.0 +**Shipped version:** 10.6.1 ## Screenshots diff --git a/conf/app.src b/conf/app.src index 7cedc14..af99f60 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.6.0/airsonic.war -SOURCE_SUM=90fe5dbf83d71b83a955abbca8765ba144996ca8530648e93d1bb50d70fde827 +SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.6.1/airsonic.war +SOURCE_SUM=6b8bf98a5288fe982ead0c99489a66cbeb8b880fa2ab4fc86d9e07944e4cf335 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=false SOURCE_IN_SUBDIR=false diff --git a/manifest.json b/manifest.json index 75242e7..1371a7c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Stream and manage your music collection", "fr": "Streamez et gérez votre collection de musique" }, - "version": "10.6.0~ynh1", + "version": "10.6.1~ynh1", "url": "http://airsonic.github.io", "license": "GPL-3.0-or-later", "maintainer": { From d658356895fffc18c1caded700258de9b9db1c3c Mon Sep 17 00:00:00 2001 From: Gofannon <17145502+Gofannon@users.noreply.github.com> Date: Wed, 22 Apr 2020 01:14:31 +0200 Subject: [PATCH 05/12] Remove comment + add new emplty line --- scripts/install | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 7c27ce8..a528c5c 100644 --- a/scripts/install +++ b/scripts/install @@ -67,8 +67,6 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=43 -# FIXME Should run "sudo update-alternatives --config java" -# See https://airsonic.github.io/docs/install/prerequisites/ ynh_install_app_dependencies $pkg_dependencies #================================================= @@ -289,4 +287,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last \ No newline at end of file +ynh_script_progression --message="Installation of $app completed" --last From 13feab3442ccfc5b81e6d40cd7f49c988416b59a Mon Sep 17 00:00:00 2001 From: Gofannon <17145502+Gofannon@users.noreply.github.com> Date: Fri, 15 May 2020 10:02:38 +0200 Subject: [PATCH 06/12] Upgrade to 10.6.2 --- README.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 439b202..9a8700e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ If you have constrained bandwidth, you may set an upper limit for the bit rate o In addition to being a streaming media server, Airsonic works very well as a local jukebox. The intuitive web interface, as well as search and index facilities, are optimized for efficient browsing through large media libraries. Airsonic also comes with an integrated Podcast receiver, with many of the same features as you find in iTunes. -**Shipped version:** 10.6.1 +**Shipped version:** 10.6.2 ## Screenshots diff --git a/conf/app.src b/conf/app.src index af99f60..2e22a93 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.6.1/airsonic.war -SOURCE_SUM=6b8bf98a5288fe982ead0c99489a66cbeb8b880fa2ab4fc86d9e07944e4cf335 +SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.6.2/airsonic.war +SOURCE_SUM=94b17d6a7859a9c029dcbcdc672f4d49bd605bf46bdf74ac51ea0d593db67860 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=false SOURCE_IN_SUBDIR=false diff --git a/manifest.json b/manifest.json index 1371a7c..a7b94f6 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Stream and manage your music collection", "fr": "Streamez et gérez votre collection de musique" }, - "version": "10.6.1~ynh1", + "version": "10.6.2~ynh1", "url": "http://airsonic.github.io", "license": "GPL-3.0-or-later", "maintainer": { From e1413757955b7cc402db2488e3cc741f15fcc7e7 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 10 Aug 2020 11:36:27 +0200 Subject: [PATCH 07/12] add ynh_multimedia_addaccess --- scripts/_common.sh | 11 +++++++++++ scripts/install | 2 ++ scripts/restore | 2 ++ scripts/upgrade | 2 ++ 4 files changed, 17 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index a24a23d..4a86d89 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -60,3 +60,14 @@ ynh_multimedia_addfolder () { ./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir" } + +# Grant write access to multimedia directories to a specified user +# +# usage: ynh_multimedia_addaccess user_name +# +# | arg: user_name - User to be granted write access +ynh_multimedia_addaccess () { + local user_name=$1 + groupadd -f multimedia + usermod -a -G multimedia $user_name +} \ No newline at end of file diff --git a/scripts/install b/scripts/install index a528c5c..c5fef64 100644 --- a/scripts/install +++ b/scripts/install @@ -117,6 +117,8 @@ 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" +# Allow airsonic to write into these directories +ynh_multimedia_addaccess $app #================================================= # ENABLE "TRANSCODE" diff --git a/scripts/restore b/scripts/restore index ebe5684..cad5ecb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -153,6 +153,8 @@ 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" +# Allow airsonic to write into these directories +ynh_multimedia_addaccess $app #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index bb53d22..a01bf84 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -138,6 +138,8 @@ 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" +# Allow airsonic to write into these directories +ynh_multimedia_addaccess $app if ! grep -q "PodcastFolder" $final_path/airsonic.properties; then echo "PodcastFolder=/home/yunohost.multimedia/share/Podcasts" >> $final_path/airsonic.properties From 162ed9ba0a04e136cd8217386682e584dbf7600b Mon Sep 17 00:00:00 2001 From: Gofannon <17145502+Gofannon@users.noreply.github.com> Date: Tue, 25 Aug 2020 12:53:26 +0200 Subject: [PATCH 08/12] Fix multimedia (#35) * fix typos * [enh] give write access to multimedia folder So music can be uploaded from web ui * bump version in manifest --- manifest.json | 2 +- scripts/_common.sh | 10 +++++----- scripts/install | 3 +++ scripts/upgrade | 3 +++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index a7b94f6..03d442e 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Stream and manage your music collection", "fr": "Streamez et gérez votre collection de musique" }, - "version": "10.6.2~ynh1", + "version": "10.6.2~ynh2", "url": "http://airsonic.github.io", "license": "GPL-3.0-or-later", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 4a86d89..c019450 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -27,15 +27,15 @@ 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 # Check the control sum echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \ || ynh_die "Corrupt source" - # Check if the package acl is installed. Or install it. - ynh_package_is_installed 'acl' \ - || ynh_package_install acl + # Check if the package acl is installed. Or install it. + ynh_package_is_installed 'acl' \ + || ynh_package_install acl # Extract mkdir yunohost.multimedia-master @@ -70,4 +70,4 @@ ynh_multimedia_addaccess () { local user_name=$1 groupadd -f multimedia usermod -a -G multimedia $user_name -} \ No newline at end of file +} diff --git a/scripts/install b/scripts/install index c5fef64..af47ef7 100644 --- a/scripts/install +++ b/scripts/install @@ -120,6 +120,9 @@ ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Playlists" --dest # Allow airsonic to write into these directories ynh_multimedia_addaccess $app +# Allow Airsonic to write into these directories +ynh_multimedia_addaccess $app + #================================================= # ENABLE "TRANSCODE" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a01bf84..3ee71ec 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -149,6 +149,9 @@ if ! grep -q "PlaylistFolder" $final_path/airsonic.properties; then echo "PlaylistFolder=/home/yunohost.multimedia/share/Playlists" >> $final_path/airsonic.properties fi +# Allow Airsonic to write into these directories +ynh_multimedia_addaccess $app + #================================================= # ENABLE "TRANSCODE" #================================================= From 73929bd1e919411ad860446737643b01c3abfd87 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 22 Nov 2020 10:16:48 +0100 Subject: [PATCH 09/12] Fix linter warnings --- scripts/backup | 23 ++++------------------- scripts/upgrade | 6 ++++++ 2 files changed, 10 insertions(+), 19 deletions(-) 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/upgrade b/scripts/upgrade index 3ee71ec..f9c2053 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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 #================================================= From a3a65bd03fdbc709f0bb0875c02713b0d8f49270 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Dec 2020 13:01:51 +0100 Subject: [PATCH 10/12] 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 From ebaac83652956d26aeea86f6535ebdffbfc1a5cf Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 7 Dec 2020 18:44:14 +0100 Subject: [PATCH 11/12] 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 From 8ace353f4a9282830ca380b8e46e9f712388db56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 19 Dec 2020 23:28:10 +0100 Subject: [PATCH 12/12] Set badge to SVG --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 14905b4..4321a4e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Airsonic for YunoHost [![Integration level](https://dash.yunohost.org/integration/airsonic.svg)](https://dash.yunohost.org/appci/app/airsonic) ![](https://ci-apps.yunohost.org/ci/badges/airsonic.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/airsonic.maintain.svg) -[![Install Airsonic with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=airsonic) +[![Install Airsonic with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=airsonic) > *This package allow you to install Airsonic quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*