diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100644 index 0000000..23bc22f --- /dev/null +++ b/.github/workflows/updater.sh @@ -0,0 +1,132 @@ +#!/bin/bash + +#================================================= +# PACKAGE UPDATING HELPER +#================================================= + +# This script is meant to be run by GitHub Actions +# The YunoHost-Apps organisation offers a template Action to run this script periodically +# Since each app is different, maintainers can adapt its contents so as to perform +# automatic actions when a new upstream release is detected. + +#================================================= +# FETCHING LATEST RELEASE AND ITS ASSETS +#================================================= + +# Fetching information +current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') +repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') +# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) +version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | .tag_name' | sort -V | tail -1) +assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) + +# Later down the script, we assume the version has only digits and dots +# Sometimes the release name starts with a "v", so let's filter it out. +# You may need more tweaks here if the upstream repository has different naming conventions. +if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then + version=${version:1} +fi + +# Setting up the environment variables +echo "Current version: $current_version" +echo "Latest release from upstream: $version" +echo "VERSION=$version" >> $GITHUB_ENV +echo "REPO=$repo" >> $GITHUB_ENV +# For the time being, let's assume the script will fail +echo "PROCEED=false" >> $GITHUB_ENV + +# Proceed only if the retrieved version is greater than the current one +if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then + echo "::warning ::No new version available" + exit 0 +# Proceed only if a PR for this new version does not already exist +elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then + echo "::warning ::A branch already exists for this update" + exit 0 +fi + +# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) +echo "${#assets[@]} available asset(s)" + +#================================================= +# UPDATE SOURCE FILES +#================================================= + +# Here we use the $assets variable to get the resources published in the upstream release. +# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. + +# Let's loop over the array of assets URLs +for asset_url in ${assets[@]}; do + + echo "Handling asset at $asset_url" + + # Assign the asset to a source file in conf/ directory + # Here we base the source file name upon a unique keyword in the assets url (admin vs. update) + # Leave $src empty to ignore the asset + case $asset_url in + *"war"*) + src="app" + ;; + *) + src="" + ;; + esac + + # If $src is not empty, let's process the asset + if [ ! -z "$src" ]; then + + # Create the temporary directory + tempdir="$(mktemp -d)" + + # Download sources and calculate checksum + filename=${asset_url##*/} + curl --silent -4 -L $asset_url -o "$tempdir/$filename" + checksum=$(sha256sum "$tempdir/$filename" | head -c 64) + + # Delete temporary directory + rm -rf $tempdir + + # Get extension + if [[ $filename == *.tar.gz ]]; then + extension=tar.gz + else + extension=${filename##*.} + fi + + # Rewrite source file + cat < conf/$src.src +SOURCE_URL=$asset_url +SOURCE_SUM=$checksum +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=war +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME=airsonic.war +SOURCE_EXTRACT=false +EOT + echo "... conf/$src.src updated" + + else + echo "... asset ignored" + fi + +done + +#================================================= +# SPECIFIC UPDATE STEPS +#================================================= + +# Any action on the app's source code can be done. +# The GitHub Action workflow takes care of committing all changes after this script ends. + +#================================================= +# GENERIC FINALIZATION +#================================================= + +# Replace new version in manifest +echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json + +# No need to update the README, yunohost-bot takes care of it + +# The Action will proceed only if the PROCEED environment variable is set to true +echo "PROCEED=true" >> $GITHUB_ENV +exit 0 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml new file mode 100644 index 0000000..fb72ba0 --- /dev/null +++ b/.github/workflows/updater.yml @@ -0,0 +1,49 @@ +# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. +# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. +# This file should be enough by itself, but feel free to tune it to your needs. +# It calls updater.sh, which is where you should put the app-specific update steps. +name: Check for new upstream releases +on: + # Allow to manually trigger the workflow + workflow_dispatch: + # Run it every day at 6:00 UTC + schedule: + - cron: '0 6 * * *' +jobs: + updater: + runs-on: ubuntu-latest + steps: + - name: Fetch the source code + uses: actions/checkout@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Run the updater script + id: run_updater + run: | + # Setting up Git user + git config --global user.name 'yunohost-bot' + git config --global user.email 'yunohost-bot@users.noreply.github.com' + # Run the updater script + /bin/bash .github/workflows/updater.sh + - name: Commit changes + id: commit + if: ${{ env.PROCEED == 'true' }} + run: | + git commit -am "Upgrade to v$VERSION" + - name: Create Pull Request + id: cpr + if: ${{ env.PROCEED == 'true' }} + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Update to version ${{ env.VERSION }} + committer: 'yunohost-bot ' + author: 'yunohost-bot ' + signoff: false + base: testing + branch: ci-auto-update-v${{ env.VERSION }} + delete-branch: true + title: 'Upgrade to version ${{ env.VERSION }}' + body: | + Upgrade to v${{ env.VERSION }} + draft: false diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] diff --git a/README.md b/README.md index fbcb1e0..2f8d466 100644 --- a/README.md +++ b/README.md @@ -3,27 +3,34 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app It shall NOT be edited by hand. --> -# Airsonic for YunoHost +# Airsonic-Advanced for YunoHost [![Integration level](https://dash.yunohost.org/integration/airsonic.svg)](https://dash.yunohost.org/appci/app/airsonic) ![Working status](https://ci-apps.yunohost.org/ci/badges/airsonic.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/airsonic.maintain.svg) -[![Install Airsonic with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=airsonic) +[![Install Airsonic-Advanced with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=airsonic) *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install Airsonic quickly and simply on a YunoHost server. +> *This package allows you to install Airsonic-Advanced quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -Stream and manage your music collection +Airsonic-Advanced is a more modern implementation of the Airsonic fork with several key performance and feature enhancements. It adds and supersedes several features in Airsonic. -**Shipped version:** 10.6.2~ynh3 +Airsonic is a free, web-based media streamer, providing ubiquitous access to your music. Use it to share your music with friends, or to listen to your own music while at work. You can stream to multiple players simultaneously, for instance to one player in your kitchen and another in your living room. -**Demo:** https://airsonic.github.io/demo/ +Airsonic is designed to handle very large music collections (hundreds of gigabytes). Although optimized for MP3 streaming, it works for any audio or video format that can stream over HTTP, for instance AAC and OGG. By using transcoder plug-ins, Airsonic supports on-the-fly conversion and streaming of virtually any audio format, including WMA, FLAC, APE, Musepack, WavPack and Shorten. + +If you have constrained bandwidth, you may set an upper limit for the bit rate of the music streams. Airsonic will then automatically re sample the music to a suitable bit rate. + +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:** 11.0.0-SNAPSHOT.20220625052932~ynh1 ## Screenshots -![Screenshot of Airsonic](./doc/screenshots/screenshot_01.png) +![Screenshot of Airsonic-Advanced](./doc/screenshots/screenshot_01.png) ## Disclaimers / important information @@ -36,9 +43,9 @@ Stream and manage your music collection ## Documentation and resources -* Official app website: +* Official app website: * Official admin documentation: -* Upstream app code repository: +* Upstream app code repository: * YunoHost documentation for this app: * Report a bug: diff --git a/README_fr.md b/README_fr.md index d0d3766..547dc40 100644 --- a/README_fr.md +++ b/README_fr.md @@ -3,41 +3,49 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app It shall NOT be edited by hand. --> -# Airsonic pour YunoHost +# Airsonic-Advanced pour YunoHost [![Niveau d'intégration](https://dash.yunohost.org/integration/airsonic.svg)](https://dash.yunohost.org/appci/app/airsonic) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/airsonic.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/airsonic.maintain.svg) -[![Installer Airsonic avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=airsonic) +[![Installer Airsonic-Advanced avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=airsonic) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer Airsonic rapidement et simplement sur un serveur YunoHost. +> *Ce package vous permet d'installer Airsonic-Advanced rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* ## Vue d'ensemble -Streamez et gérez votre collection de musique +Airsonic-Advanced est une implémentation plus moderne de la bifurcation d'Airsonic avec plusieurs améliorations clés en termes de performances et de fonctionnalités. Elle ajoute et remplace plusieurs fonctionnalités d'Airsonic. -**Version incluse :** 10.6.2~ynh3 +Airsonic est un streamer multimédia gratuit, basé sur le web, qui fournit un accès omniprésent à votre musique. Utilisez-le pour partager votre musique avec vos amis, ou pour écouter votre propre musique au travail. Vous pouvez diffuser votre musique sur plusieurs lecteurs simultanément, par exemple sur un lecteur dans votre cuisine et un autre dans votre salon. -**Démo :** https://airsonic.github.io/demo/ +Airsonic est conçu pour gérer de très grandes collections de musique (des centaines de gigaoctets). Bien qu'il soit optimisé pour le streaming MP3, il fonctionne pour tout format audio ou vidéo pouvant être diffusé par HTTP, par exemple AAC et OGG. En utilisant des plug-ins de transcodage, Airsonic prend en charge la conversion et le streaming à la volée de pratiquement tous les formats audio, notamment WMA, FLAC, APE, Musepack, WavPack et Shorten. + +Si vous avez une bande passante limitée, vous pouvez fixer une limite supérieure pour le débit binaire des flux musicaux. Airsonic rééchantillonnera alors automatiquement la musique à un débit binaire approprié. + +En plus d'être un serveur de médias en streaming, Airsonic fonctionne très bien comme un jukebox local. L'interface web intuitive, ainsi que les fonctions de recherche et d'indexation, sont optimisées pour une navigation efficace dans les grandes bibliothèques de médias. Airsonic est également livré avec un récepteur de podcasts intégré, avec la plupart des fonctionnalités que vous trouvez dans iTunes. + + +**Version incluse :** 11.0.0-SNAPSHOT.20220625052932~ynh1 ## Captures d'écran -![Capture d'écran de Airsonic](./doc/screenshots/screenshot_01.png) +![Capture d'écran de Airsonic-Advanced](./doc/screenshots/screenshot_01.png) ## Avertissements / informations importantes -## Fonctionnalités spécifiques à YunoHost +## Caractéristiques spécifiques de YunoHost + +* Comptes LDAP supportés par YunoHost : **Oui** +* Gestion du [Multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia) +* La limite de mémoire RAM a été fixée à 256 Mo car Airsonic était souvent tué par le manque de RAM (hello OOM killer). +* Voir https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/ -* Comptes LDAP YunoHost pris en charge : **oui** -* [Multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia) géré -* Limite de mémoire RAM fixée à 256 Mb car Airsonic quittait souvant par manque de RAM (bonjour OOM killer) -* Voir https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/ ## Documentations et ressources -* Site officiel de l'app : +* Site officiel de l'app : * Documentation officielle de l'admin : -* Dépôt de code officiel de l'app : +* Dépôt de code officiel de l'app : * Documentation YunoHost pour cette app : * Signaler un bug : diff --git a/check_process b/check_process index df2cbf6..b02d6ae 100644 --- a/check_process +++ b/check_process @@ -2,8 +2,8 @@ ; Manifest domain="domain.tld" path="/path" - admin="john" is_public=1 + admin="john" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -12,9 +12,12 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=72d530415c016b23b6ba62085272957b04d2cca6 + upgrade=1 from_commit=72d530415c016b23b6ba62085272957b04d2cca6 + # 10.6.2~ynh3 + upgrade=1 from_commit=6ca76697a8f8da7419eb490aa435649f1b9d96c2 backup_restore=1 multi_instance=1 + port_already_use=0 change_url=1 ;;; Options Email= diff --git a/conf/airsonic.properties b/conf/airsonic.properties index c2eeb96..8dd63a5 100644 --- a/conf/airsonic.properties +++ b/conf/airsonic.properties @@ -10,3 +10,4 @@ LdapAutoShadowing=true GettingStartedEnabled=false PodcastFolder=/home/yunohost.multimedia/share/Podcasts PlaylistFolder=/home/yunohost.multimedia/share/Playlists +server.forward-headers-strategy=native diff --git a/conf/app.src b/conf/app.src index 2e22a93..0682ffd 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.6.2/airsonic.war -SOURCE_SUM=94b17d6a7859a9c029dcbcdc672f4d49bd605bf46bdf74ac51ea0d593db67860 +SOURCE_URL=https://github.com/airsonic-advanced/airsonic-advanced/releases/download/11.0.0-SNAPSHOT.20220625052932/airsonic.war +SOURCE_SUM=6be139912d0e15b97e454f52fa8a7bb2f511d177afe202f6e2f32dcd8a253cc8 SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=false +SOURCE_FORMAT=war SOURCE_IN_SUBDIR=false SOURCE_FILENAME=airsonic.war SOURCE_EXTRACT=false diff --git a/conf/nginx.conf b/conf/nginx.conf index b2901aa..554fa78 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -3,28 +3,33 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto https; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header Host $http_host; - proxy_max_temp_file_size 0; - proxy_pass http://127.0.0.1:__PORT__; - proxy_redirect http:// https://; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_http_version 1.1; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header Host $host; + proxy_max_temp_file_size 0; + proxy_pass http://127.0.0.1:__PORT__; + proxy_redirect http:// https://; + proxy_buffering off; + proxy_request_buffering off; - # set client body size to 500 MB - # Allows to upload zip file up to 500 MB - # See https://github.com/YunoHost-Apps/airsonic_ynh/issues/4 - client_max_body_size 500M; + # set client body size to 500 MB + # Allows to upload zip file up to 500 MB + # See https://github.com/YunoHost-Apps/airsonic_ynh/issues/4 + client_max_body_size 500M; - # Fix last DSub releases not able to connect with LDAP - # See https://github.com/airsonic/airsonic/issues/260 - sub_filter_types text/xml application/json; - sub_filter_once off; - sub_filter 'subsonic' 'madsonic'; - - # Include SSOWAT user panel. - # Removed since sub_filter_once directive is also used in this file -# include conf.d/yunohost_panel.conf.inc; -# proxy_set_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' www.gstatic.com; img-src 'self' *.akamaized.net; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src 'self' fonts.gstatic.com; frame-src 'self'; object-src 'none'"; + # Fix last DSub releases not able to connect with LDAP + # See https://github.com/airsonic/airsonic/issues/260 + sub_filter_types text/xml application/json; + sub_filter_once off; + sub_filter 'subsonic' 'madsonic'; + + # Include SSOWAT user panel. + #include conf.d/yunohost_panel.conf.inc; + #proxy_set_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' www.gstatic.com; img-src 'self' *.akamaized.net; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src 'self' fonts.gstatic.com; frame-src 'self'; object-src 'none'"; } diff --git a/conf/systemd.service b/conf/systemd.service index da45966..02006c4 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,33 +8,30 @@ AssertPathExists=__FINALPATH__ [Service] Type=simple +User=__APP__ +Group=__APP__ Environment="JAVA_OPTS=-Xmx256m" Environment="JAVA_ARGS=" EnvironmentFile=-/etc/default/__APP__ ExecStart=/usr/bin/java \ $JAVA_OPTS \ -Dairsonic.home=${AIRSONIC_HOME} \ - -Dserver.context-path=${CONTEXT_PATH} \ + -Dserver.servlet.context-path=${CONTEXT_PATH} \ -Dserver.port=${PORT} \ -jar ${JAVA_JAR} $JAVA_ARGS -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=__FINALPATH__ +#DeviceAllow=char-alsa rw +#NoNewPrivileges=yes +#PrivateTmp=yes +#PrivateUsers=yes +#RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +#RestrictNamespaces=yes +#RestrictRealtime=yes +#DevicePolicy=closed +#SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap +#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 @@ -43,7 +40,10 @@ ReadWritePaths=__FINALPATH__ # 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 +#ProtectSystem=full +#ProtectControlGroups=yes +#ProtectKernelModules=yes +#ProtectKernelTunables=yes # 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. @@ -54,6 +54,5 @@ ProtectSystem=full # and executeable, making hacker's lifes a bit harder. #MemoryDenyWriteExecute=yes - [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..758595a --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1,9 @@ +Airsonic-Advanced is a more modern implementation of the Airsonic fork with several key performance and feature enhancements. It adds and supersedes several features in Airsonic. + +Airsonic is a free, web-based media streamer, providing ubiquitous access to your music. Use it to share your music with friends, or to listen to your own music while at work. You can stream to multiple players simultaneously, for instance to one player in your kitchen and another in your living room. + +Airsonic is designed to handle very large music collections (hundreds of gigabytes). Although optimized for MP3 streaming, it works for any audio or video format that can stream over HTTP, for instance AAC and OGG. By using transcoder plug-ins, Airsonic supports on-the-fly conversion and streaming of virtually any audio format, including WMA, FLAC, APE, Musepack, WavPack and Shorten. + +If you have constrained bandwidth, you may set an upper limit for the bit rate of the music streams. Airsonic will then automatically re sample the music to a suitable bit rate. + +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. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..17b3038 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1,9 @@ +Airsonic-Advanced est une implémentation plus moderne de la bifurcation d'Airsonic avec plusieurs améliorations clés en termes de performances et de fonctionnalités. Elle ajoute et remplace plusieurs fonctionnalités d'Airsonic. + +Airsonic est un streamer multimédia gratuit, basé sur le web, qui fournit un accès omniprésent à votre musique. Utilisez-le pour partager votre musique avec vos amis, ou pour écouter votre propre musique au travail. Vous pouvez diffuser votre musique sur plusieurs lecteurs simultanément, par exemple sur un lecteur dans votre cuisine et un autre dans votre salon. + +Airsonic est conçu pour gérer de très grandes collections de musique (des centaines de gigaoctets). Bien qu'il soit optimisé pour le streaming MP3, il fonctionne pour tout format audio ou vidéo pouvant être diffusé par HTTP, par exemple AAC et OGG. En utilisant des plug-ins de transcodage, Airsonic prend en charge la conversion et le streaming à la volée de pratiquement tous les formats audio, notamment WMA, FLAC, APE, Musepack, WavPack et Shorten. + +Si vous avez une bande passante limitée, vous pouvez fixer une limite supérieure pour le débit binaire des flux musicaux. Airsonic rééchantillonnera alors automatiquement la musique à un débit binaire approprié. + +En plus d'être un serveur de médias en streaming, Airsonic fonctionne très bien comme un jukebox local. L'interface web intuitive, ainsi que les fonctions de recherche et d'indexation, sont optimisées pour une navigation efficace dans les grandes bibliothèques de médias. Airsonic est également livré avec un récepteur de podcasts intégré, avec la plupart des fonctionnalités que vous trouvez dans iTunes. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md index b1f1a70..22dee7f 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DISCLAIMER_fr.md @@ -1,6 +1,6 @@ -## Fonctionnalités spécifiques à YunoHost +## Caractéristiques spécifiques de YunoHost -* Comptes LDAP YunoHost pris en charge : **oui** -* [Multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia) géré -* Limite de mémoire RAM fixée à 256 Mb car Airsonic quittait souvant par manque de RAM (bonjour OOM killer) -* Voir https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/ \ No newline at end of file +* Comptes LDAP supportés par YunoHost : **Oui** +* Gestion du [Multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia) +* La limite de mémoire RAM a été fixée à 256 Mo car Airsonic était souvent tué par le manque de RAM (hello OOM killer). +* Voir https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/ diff --git a/manifest.json b/manifest.json index 797e2f3..d410071 100644 --- a/manifest.json +++ b/manifest.json @@ -1,34 +1,33 @@ { - "name": "Airsonic", + "name": "Airsonic-Advanced", "id": "airsonic", "packaging_format": 1, "description": { "en": "Stream and manage your music collection", "fr": "Streamez et gérez votre collection de musique" }, - "version": "10.6.2~ynh3", - "url": "http://airsonic.github.io", + "version": "11.0.0-SNAPSHOT.20220625052932~ynh1", + "url": "https://github.com/airsonic-advanced/airsonic-advanced", "upstream": { "license": "GPL-3.0-or-later", - "website": "https://airsonic.github.io/", - "demo": "https://airsonic.github.io/demo/", + "website": "https://github.com/airsonic-advanced/airsonic-advanced", "admindoc": "https://airsonic.github.io/docs/", - "code": "https://github.com/airsonic/airsonic" + "code": "https://github.com/airsonic-advanced/airsonic-advanced" }, "license": "GPL-3.0-or-later", "maintainer": { - "name": "Gofannon", - "email": "gofannon@riseup.net" + "name": "", + "email": "" }, "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 11.0.0" }, "multi_instance": true, "services": [ "nginx" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -39,14 +38,14 @@ "example": "/airsonic", "default": "/airsonic" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", "default": true + }, + { + "name": "admin", + "type": "user" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 4b38524..04255ba 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,8 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="openjdk-8-jre|openjdk-11-jre ffmpeg" +# dependencies used by the app (must be on a single line) +pkg_dependencies="openjdk-11-jre ffmpeg" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index a27e558..52238cf 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -14,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + true } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -28,6 +29,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -40,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -59,14 +67,13 @@ ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= ynh_backup --src_path="/etc/systemd/system/$app.service" + +#================================================= +# BACKUP VARIOUS FILES +#================================================= + ynh_backup --src_path="/etc/default/$app" -#================================================= -# BACKUP DATA -#================================================= - -ynh_backup --src_path="/home/yunohost.app/$app" --is_big - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 563965e..23a3b63 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -33,7 +33,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) path_url=$(ynh_app_setting_get --app=$app --key=path) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 @@ -122,6 +122,7 @@ ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/defaul #================================================= 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" #================================================= diff --git a/scripts/install b/scripts/install index 6d583ee..ccfdd30 100644 --- a/scripts/install +++ b/scripts/install @@ -18,7 +18,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + true } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -29,8 +29,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME @@ -39,7 +39,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/opt/yunohost/$app +final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path @@ -61,7 +61,7 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= ynh_script_progression --message="Finding an available port..." --weight=1 -# Find a free port +# Find an available port port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port @@ -87,7 +87,7 @@ ynh_script_progression --message="Setting up source files..." --weight=82 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir=$final_path +ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" @@ -101,6 +101,8 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# SPECIFIC SETUP #================================================= # CREATE DATA DIRECTORY #================================================= @@ -109,7 +111,7 @@ ynh_script_progression --message="Creating a data directory..." --weight=1 datadir=/home/yunohost.app/$app ynh_app_setting_set --app=$app --key=datadir --value=$datadir -mkdir -p /home/yunohost.app/$app/{Podcasts,Playlists} +mkdir -p $datadir/{Podcasts,Playlists} chmod 764 "$datadir" chmod -R o-rwx "$datadir" @@ -130,6 +132,7 @@ ynh_multimedia_addaccess $app #================================================= # ENABLE "TRANSCODE" #================================================= +ynh_script_progression --message="Enabling transcode..." --weight=1 ### For details, see https://airsonic.github.io/docs/transcode/ @@ -147,6 +150,20 @@ fi # Ensure links belong to the $app user chown $app $final_path/transcode +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app" +chmod 600 "/etc/default/$app" +chown $app:$app "/etc/default/$app" + +# Copy configuration file of airsonic +ynh_add_config --template="../conf/airsonic.properties" --destination="$final_path/airsonic.properties" +chmod 600 "$final_path/airsonic.properties" +chown $app:$app "$final_path/airsonic.properties" + #================================================= # SETUP SYSTEMD #================================================= @@ -155,45 +172,20 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=3 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# MODIFY CONFIG FILES -#================================================= - -ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app" -# Copy configuration file of airsonic -ynh_add_config --template="../conf/airsonic.properties" --destination="$final_path/airsonic.properties" - -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate $final_path/$app.log - -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL -#================================================= - -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 - -# Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path="$final_path/$app.log" --line_match="Started Application in" - #================================================= # SETUP APPLICATION WITH CURL #================================================= +ynh_script_progression --message="Setuping application with CURL..." --weight=1 -# Set the app as temporarily public for cURL call +ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/$app.log" --line_match="Started Application in" + +# Set the app as temporarily public for curl call +ynh_script_progression --message="Configuring SSOwat..." --weight=1 +# Making the app public for curl ynh_permission_update --permission="main" --add="visitors" # Reload Nginx -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name=nginx --action="reload" ynh_script_progression --message="Finalizing installation..." --weight=10 @@ -225,9 +217,14 @@ token=$(echo -n $passwordAdmin$salt | md5sum | awk '{print $1}') ynh_local_curl "/rest/createUser.view" "u=admin" "t=$token" "s=$salt" "username=$admin" "password=a" "v=$VERSION" "c=myapp" "email=$mailadmin" "adminRole=Yes" "ldapAuthenticated=Yes" "settingsRole=Yes" "streamRole=Yes" "jukeboxRole=Yes" "downloadRole=Yes" "uploadRole=Yes" "playlistRole=Yes" "coverArtRole=Yes" "commentRole=Yes" "podcastRole=Yes" "shareRole=Yes" "videoConversionRole=Yes" +# Remove the public access +ynh_permission_update --permission="main" --remove="visitors" + #================================================= # USE MULTIMEDIA #================================================= +ynh_script_progression --message="Using multimedia..." --weight=1 + ynh_systemd_action --service_name=$app --action="stop" # Use multimedia folder @@ -238,15 +235,42 @@ ynh_script_progression --message="Restarting 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" +#================================================= +# GENERIC FINALIZATION +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." --weight=1 + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate $final_path/$app.log + +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +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 + +# Start a systemd service +ynh_systemd_action --service_name=$app --action="restart" --log_path="$final_path/$app.log" --line_match="Started Application in" + #================================================= # SETUP SSOWAT #================================================= ynh_script_progression --message="Configuring permissions..." --weight=1 -# Make app public if necessary or protect it -if [ $is_public -eq 0 ] +# Make app public if necessary +if [ $is_public -eq 1 ] then - ynh_permission_update --permission="main" --remove="visitors" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/remove b/scripts/remove index 04721d0..8bf8d53 100644 --- a/scripts/remove +++ b/scripts/remove @@ -24,13 +24,13 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # STANDARD REMOVE #================================================= -# REMOVE SERVICE FROM ADMIN PANEL +# REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove a service from the admin panel, added by `yunohost service add` +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service..." --weight=2 + ynh_script_progression --message="Removing $app service integration..." --weight=1 yunohost service remove $app fi @@ -43,12 +43,12 @@ ynh_script_progression --message="Stopping and removing the systemd service..." ynh_remove_systemd_config #================================================= -# REMOVE DEPENDENCIES +# REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=19 +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 -# Remove metapackage and its dependencies -ynh_remove_app_dependencies +# Remove the app-specific logrotate config +ynh_remove_logrotate #================================================= # REMOVE APP MAIN DIR @@ -58,6 +58,17 @@ ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" +#================================================= +# REMOVE DATA DIR +#================================================= + +# Remove the data directory if --purge option is used +if [ "${YNH_APP_PURGE:-0}" -eq 1 ] +then + ynh_script_progression --message="Removing app data directory..." --weight=1 + ynh_secure_remove --file="$datadir" +fi + #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -65,30 +76,21 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================ -# REMOVE DATA DIR -#================================================ - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." --weight=1 - ynh_secure_remove --file="/home/yunohost.app/$app" -fi #================================================= -# REMOVE LOGROTATE CONFIGURATION +# REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=19 -# Remove the app-specific logrotate config -ynh_remove_logrotate +# Remove metapackage and its dependencies +ynh_remove_app_dependencies #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE FILES +# REMOVE VARIOUS FILES #================================================= +ynh_script_progression --message="Removing various files..." --weight=1 ynh_secure_remove --file="/etc/default/$app" diff --git a/scripts/restore b/scripts/restore index 00b312d..402efd7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + true } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -42,12 +42,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -67,6 +61,19 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." --weight=1 + +ynh_restore_file --origin_path="$datadir" --not_mandatory + +mkdir -p $datadir + +chmod 764 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" + #================================================= # SPECIFIC RESTORATION #================================================= @@ -77,9 +84,17 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=43 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # ENABLE "TRANSCODE" #================================================= +ynh_script_progression --message="Enabling transcode..." --weight=1 ### For details, see https://airsonic.github.io/docs/transcode/ @@ -98,46 +113,11 @@ fi chown $app $final_path/transcode #================================================= -# RESTORE SYSTEMD +# RESTORE VARIOUS FILES #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +ynh_script_progression --message="Restoring various files..." --weight=1 -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/default/$app" -systemctl enable $app.service --quiet - -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL -#================================================= - -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/$app.log" --line_match="Started Application in" - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - -#================================================= -# RESTORE THE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Restoring the data directory..." --weight=1 - -# 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="$datadir" --not_mandatory - -mkdir -p $datadir - -chmod 764 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -150,6 +130,35 @@ ynh_multimedia_addfolder --source_dir="/home/yunohost.app/$app/Playlists" --dest # Allow airsonic to write into these directories ynh_multimedia_addaccess --user_name=$app +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service --quiet + +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +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/$app.log" --line_match="Started Application in" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 013069b..bb81357 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,14 +18,15 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) admin=$(ynh_app_setting_get --app=$app --key=admin) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." --weight=1 upgrade_type=$(ynh_check_app_version_changed) @@ -37,14 +38,21 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - ynh_clean_check_starting - - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# STANDARD UPGRADE STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="stop" + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -52,7 +60,7 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If final_path doesn't exist, create it if [ -z "$final_path" ]; then - final_path=/opt/yunohost/$app + final_path=/var/www/$app ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi @@ -74,14 +82,18 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +# Rename legacy folder to proper location +if [[ ! -e /home/yunohost.app/$app ]] && [[ -e /home/yunohost.$app ]] +then + mkdir -p /home/yunohost.app/ + mv /home/yunohost.$app /home/yunohost.app/$app +fi -ynh_systemd_action --service_name=$app --action="stop" +mkdir -p $datadir/{Podcasts,Playlists} + +chmod 764 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" #================================================= # CREATE DEDICATED USER @@ -107,6 +119,13 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=4 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # NGINX CONFIGURATION #================================================= @@ -116,40 +135,7 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - ynh_add_nginx_config #================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=4 - -ynh_install_app_dependencies $pkg_dependencies - -# #================================================= -# # SPECIFIC UPGRADE -# #================================================= -# # CREATE DIRECTORIES -# #================================================= - -# mkdir -p /home/yunohost.app/$app/{Podcasts,Playlists} - -# #================================================= -# # SECURING FILES AND DIRECTORIES -# #================================================= - -# Rename legacy folder to proper location -if [[ ! -e /home/yunohost.app/$app ]] && [[ -e /home/yunohost.$app ]] -then - mkdir -p /home/yunohost.app/ - mv /home/yunohost.$app /home/yunohost.app/$app -fi - -mkdir -p /home/yunohost.app/$app/{Podcasts,Playlists} - -#================================================= -# SECURING FILES AND DIRECTORIES -#================================================= - -chown -R $app:www-data /home/yunohost.app/$app -chmod 764 /home/yunohost.app/$app - +# SPECIFIC UPGRADE #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= @@ -175,6 +161,7 @@ ynh_multimedia_addaccess $app #================================================= # ENABLE "TRANSCODE" #================================================= +ynh_script_progression --message="Enabling transcode..." --weight=1 ### For details, see https://airsonic.github.io/docs/transcode/ @@ -193,19 +180,17 @@ fi chown $app $final_path/transcode #================================================= -# STORE THE CONFIG FILE CHECKSUM +# UPDATE A CONFIG FILE #================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 + +ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app" +chmod 600 "/etc/default/$app" +chown $app:$app "/etc/default/$app" -# Copy configuration file of airsonic ynh_add_config --template="../conf/airsonic.properties" --destination="$final_path/airsonic.properties" - -#================================================= -# SETUP LOGROTATE -#================================================= -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/$app.log" +chmod 600 "$final_path/airsonic.properties" +chown $app:$app "$final_path/airsonic.properties" #================================================= # SETUP SYSTEMD @@ -215,20 +200,10 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app" - #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# USE MULTIMEDIA #================================================= - -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_script_progression --message="Using multimedia..." --weight=1 # Use multimedia folder if needed if ! grep -q "/home/yunohost.multimedia/share/Music" $final_path/db/airsonic.script; then @@ -243,6 +218,30 @@ if ! grep -q "/home/yunohost.multimedia/share/Music" $final_path/db/airsonic.scr ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in" fi +#================================================= +# GENERIC FINALIZATION +#================================================= +# SETUP LOGROTATE +#================================================= +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/$app.log" + +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +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" + #================================================= # RELOAD NGINX #=================================================