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

Merge pull request #60 from YunoHost-Apps/advanced

Upgrade to Airsonic-Advanced
This commit is contained in:
yalh76 2022-10-18 20:55:30 +02:00 committed by GitHub
commit fd00e2c795
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 538 additions and 277 deletions

132
.github/workflows/updater.sh vendored Normal file
View file

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

49
.github/workflows/updater.yml vendored Normal file
View file

@ -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 <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
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

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -3,28 +3,35 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
It shall NOT be edited by hand. 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) [![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)* *[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.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## 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.
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.
**Demo:** https://airsonic.github.io/demo/ **Shipped version:** 11.0.0-SNAPSHOT.20220625052932~ynh1 *(:warning: This is the `advanced` branch. The [`master` branch](https://github.com/YunoHost-Apps/airsonic_ynh/tree/master) used in the catalog is currently on version 10.6.2\~ynh3.)*
## Screenshots ## Screenshots
![Screenshot of Airsonic](./doc/screenshots/screenshot_01.png) ![Screenshot of Airsonic-Advanced](./doc/screenshots/screenshot_01.png)
## Disclaimers / important information ## Disclaimers / important information
@ -37,9 +44,9 @@ Stream and manage your music collection
## Documentation and resources ## Documentation and resources
* Official app website: <https://airsonic.github.io/> * Official app website: <https://github.com/airsonic-advanced/airsonic-advanced>
* Official admin documentation: <https://airsonic.github.io/docs/> * Official admin documentation: <https://airsonic.github.io/docs/>
* Upstream app code repository: <https://github.com/airsonic/airsonic> * Upstream app code repository: <https://github.com/airsonic-advanced/airsonic-advanced>
* YunoHost documentation for this app: <https://yunohost.org/app_airsonic> * YunoHost documentation for this app: <https://yunohost.org/app_airsonic>
* Report a bug: <https://github.com/YunoHost-Apps/airsonic_ynh/issues> * Report a bug: <https://github.com/YunoHost-Apps/airsonic_ynh/issues>

View file

@ -3,42 +3,50 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
It shall NOT be edited by hand. 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) [![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)* *[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.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble ## 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.
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.
**Démo :** https://airsonic.github.io/demo/ **Version incluse :** 11.0.0-SNAPSHOT.20220625052932~ynh1 *(:warning: Il s'agit de la branche `advanced`. La [branche `master`](https://github.com/YunoHost-Apps/airsonic_ynh/tree/master) utilisée dans le catalogue est actuellement en 10.6.2\~ynh3.)*
## Captures d'écran ## 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 ## Avertissements / informations importantes
## Fonctionnalités spécifiques à YunoHost ## Caractéristiques spécifiques de YunoHost
* Comptes LDAP YunoHost pris en charge : **oui** * Comptes LDAP supportés par YunoHost : **Oui**
* [Multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia) géré * Gestion du [Multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia)
* Limite de mémoire RAM fixée à 256 Mb car Airsonic quittait souvant par manque de RAM (bonjour OOM killer) * 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/ * Voir https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : <https://airsonic.github.io/> * Site officiel de l'app : <https://github.com/airsonic-advanced/airsonic-advanced>
* Documentation officielle de l'admin : <https://airsonic.github.io/docs/> * Documentation officielle de l'admin : <https://airsonic.github.io/docs/>
* Dépôt de code officiel de l'app : <https://github.com/airsonic/airsonic> * Dépôt de code officiel de l'app : <https://github.com/airsonic-advanced/airsonic-advanced>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_airsonic> * Documentation YunoHost pour cette app : <https://yunohost.org/app_airsonic>
* Signaler un bug : <https://github.com/YunoHost-Apps/airsonic_ynh/issues> * Signaler un bug : <https://github.com/YunoHost-Apps/airsonic_ynh/issues>

View file

@ -2,8 +2,8 @@
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
admin="john"
is_public=1 is_public=1
admin="john"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -13,8 +13,11 @@
setup_public=1 setup_public=1
upgrade=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 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=

View file

@ -10,3 +10,4 @@ LdapAutoShadowing=true
GettingStartedEnabled=false GettingStartedEnabled=false
PodcastFolder=/home/yunohost.multimedia/share/Podcasts PodcastFolder=/home/yunohost.multimedia/share/Podcasts
PlaylistFolder=/home/yunohost.multimedia/share/Playlists PlaylistFolder=/home/yunohost.multimedia/share/Playlists
server.forward-headers-strategy=native

View file

@ -1,7 +1,7 @@
SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.6.2/airsonic.war SOURCE_URL=https://github.com/airsonic-advanced/airsonic-advanced/releases/download/11.0.0-SNAPSHOT.20220625052932/airsonic.war
SOURCE_SUM=94b17d6a7859a9c029dcbcdc672f4d49bd605bf46bdf74ac51ea0d593db67860 SOURCE_SUM=6be139912d0e15b97e454f52fa8a7bb2f511d177afe202f6e2f32dcd8a253cc8
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=false SOURCE_FORMAT=war
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=airsonic.war SOURCE_FILENAME=airsonic.war
SOURCE_EXTRACT=false SOURCE_EXTRACT=false

View file

@ -3,14 +3,20 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
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-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $http_host; proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header Host $host;
proxy_max_temp_file_size 0; proxy_max_temp_file_size 0;
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect http:// https://; proxy_redirect http:// https://;
proxy_buffering off;
proxy_request_buffering off;
# set client body size to 500 MB # set client body size to 500 MB
# Allows to upload zip file up to 500 MB # Allows to upload zip file up to 500 MB
@ -24,7 +30,6 @@ location __PATH__/ {
sub_filter 'subsonic' 'madsonic'; sub_filter 'subsonic' 'madsonic';
# Include SSOWAT user panel. # Include SSOWAT user panel.
# Removed since sub_filter_once directive is also used in this file
#include conf.d/yunohost_panel.conf.inc; #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'"; #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'";
} }

View file

@ -8,33 +8,30 @@ AssertPathExists=__FINALPATH__
[Service] [Service]
Type=simple Type=simple
User=__APP__
Group=__APP__
Environment="JAVA_OPTS=-Xmx256m" Environment="JAVA_OPTS=-Xmx256m"
Environment="JAVA_ARGS=" Environment="JAVA_ARGS="
EnvironmentFile=-/etc/default/__APP__ EnvironmentFile=-/etc/default/__APP__
ExecStart=/usr/bin/java \ ExecStart=/usr/bin/java \
$JAVA_OPTS \ $JAVA_OPTS \
-Dairsonic.home=${AIRSONIC_HOME} \ -Dairsonic.home=${AIRSONIC_HOME} \
-Dserver.context-path=${CONTEXT_PATH} \ -Dserver.servlet.context-path=${CONTEXT_PATH} \
-Dserver.port=${PORT} \ -Dserver.port=${PORT} \
-jar ${JAVA_JAR} $JAVA_ARGS -jar ${JAVA_JAR} $JAVA_ARGS
User=__APP__
Group=__APP__
# See https://www.freedesktop.org/software/systemd/man/systemd.exec.html # See https://www.freedesktop.org/software/systemd/man/systemd.exec.html
# for details # for details
DevicePolicy=closed #DeviceAllow=char-alsa rw
DeviceAllow=char-alsa rw #NoNewPrivileges=yes
NoNewPrivileges=yes #PrivateTmp=yes
PrivateTmp=yes #PrivateUsers=yes
PrivateUsers=yes #RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
ProtectControlGroups=yes #RestrictNamespaces=yes
ProtectKernelModules=yes #RestrictRealtime=yes
ProtectKernelTunables=yes #DevicePolicy=closed
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 #SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap
RestrictNamespaces=yes #ReadWritePaths=__FINALPATH__
RestrictRealtime=yes
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 # You can uncomment the following line if you're not using the jukebox
# This will prevent airsonic from accessing any real (physical) devices # 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` # You can change the following line to `strict` instead of `full`
# if you don't want airsonic to be able to # if you don't want airsonic to be able to
# write anything on your filesystem outside of AIRSONIC_HOME. # 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 # 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. # 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. # and executeable, making hacker's lifes a bit harder.
#MemoryDenyWriteExecute=yes #MemoryDenyWriteExecute=yes
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

9
doc/DESCRIPTION.md Normal file
View file

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

9
doc/DESCRIPTION_fr.md Normal file
View file

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

View file

@ -1,6 +1,6 @@
## Fonctionnalités spécifiques à YunoHost ## Caractéristiques spécifiques de YunoHost
* Comptes LDAP YunoHost pris en charge : **oui** * Comptes LDAP supportés par YunoHost : **Oui**
* [Multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia) géré * Gestion du [Multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia)
* Limite de mémoire RAM fixée à 256 Mb car Airsonic quittait souvant par manque de RAM (bonjour OOM killer) * 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/ * Voir https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/

View file

@ -1,27 +1,26 @@
{ {
"name": "Airsonic", "name": "Airsonic-Advanced",
"id": "airsonic", "id": "airsonic",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Stream and manage your music collection", "en": "Stream and manage your music collection",
"fr": "Streamez et gérez votre collection de musique" "fr": "Streamez et gérez votre collection de musique"
}, },
"version": "10.6.2~ynh3", "version": "11.0.0-SNAPSHOT.20220625052932~ynh1",
"url": "http://airsonic.github.io", "url": "https://github.com/airsonic-advanced/airsonic-advanced",
"upstream": { "upstream": {
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"website": "https://airsonic.github.io/", "website": "https://github.com/airsonic-advanced/airsonic-advanced",
"demo": "https://airsonic.github.io/demo/",
"admindoc": "https://airsonic.github.io/docs/", "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", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {
"name": "Gofannon", "name": "",
"email": "gofannon@riseup.net" "email": ""
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.2.4" "yunohost": ">= 11.0.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -39,14 +38,14 @@
"example": "/airsonic", "example": "/airsonic",
"default": "/airsonic" "default": "/airsonic"
}, },
{
"name": "admin",
"type": "user"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"default": true "default": true
},
{
"name": "admin",
"type": "user"
} }
] ]
} }

View file

@ -4,8 +4,8 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app (must be on a single line)
pkg_dependencies="openjdk-8-jre|openjdk-11-jre ffmpeg" pkg_dependencies="openjdk-11-jre ffmpeg"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS # 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 ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -14,7 +15,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -28,6 +29,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) 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 # 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" ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # 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" ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/default/$app" ynh_backup --src_path="/etc/default/$app"
#=================================================
# BACKUP DATA
#=================================================
ynh_backup --src_path="/home/yunohost.app/$app" --is_big
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -33,7 +33,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
path_url=$(ynh_app_setting_get --app=$app --key=path) 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 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 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/airsonic.log" --line_match="Started Application in"
#================================================= #=================================================

View file

@ -18,7 +18,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -29,8 +29,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -39,7 +39,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1 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" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path # 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 ynh_script_progression --message="Finding an available port..." --weight=1
# Find a free port # Find an available port
port=$(ynh_find_port --port=8095) port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port 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 ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # 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 750 "$final_path"
chmod -R o-rwx "$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 # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#================================================= #=================================================
# CREATE DATA DIRECTORY # CREATE DATA DIRECTORY
#================================================= #=================================================
@ -109,7 +111,7 @@ ynh_script_progression --message="Creating a data directory..." --weight=1
datadir=/home/yunohost.app/$app datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir 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 764 "$datadir"
chmod -R o-rwx "$datadir" chmod -R o-rwx "$datadir"
@ -130,6 +132,7 @@ ynh_multimedia_addaccess $app
#================================================= #=================================================
# ENABLE "TRANSCODE" # ENABLE "TRANSCODE"
#================================================= #=================================================
ynh_script_progression --message="Enabling transcode..." --weight=1
### For details, see https://airsonic.github.io/docs/transcode/ ### For details, see https://airsonic.github.io/docs/transcode/
@ -147,6 +150,20 @@ fi
# Ensure links belong to the $app user # Ensure links belong to the $app user
chown $app $final_path/transcode 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 # SETUP SYSTEMD
#================================================= #=================================================
@ -155,45 +172,20 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=3
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_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 # 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" ynh_permission_update --permission="main" --add="visitors"
# Reload Nginx # 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 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" 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 # USE MULTIMEDIA
#================================================= #=================================================
ynh_script_progression --message="Using multimedia..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" ynh_systemd_action --service_name=$app --action="stop"
# Use multimedia folder # Use multimedia folder
@ -238,15 +235,42 @@ ynh_script_progression --message="Restarting a systemd service..." --weight=12
# Start a systemd service # 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/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 # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1 ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it # Make app public if necessary
if [ $is_public -eq 0 ] if [ $is_public -eq 1 ]
then 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 fi
#================================================= #=================================================

View file

@ -24,13 +24,13 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
# STANDARD REMOVE # 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 if ynh_exec_warn_less yunohost service status $app >/dev/null
then then
ynh_script_progression --message="Removing $app service..." --weight=2 ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app yunohost service remove $app
fi fi
@ -43,12 +43,12 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
ynh_remove_systemd_config 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 # Remove the app-specific logrotate config
ynh_remove_app_dependencies ynh_remove_logrotate
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
@ -58,6 +58,17 @@ ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" 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 # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
@ -65,30 +76,21 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_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 # Remove metapackage and its dependencies
ynh_remove_logrotate ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
# REMOVE FILES # REMOVE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Removing various files..." --weight=1
ynh_secure_remove --file="/etc/default/$app" ynh_secure_remove --file="/etc/default/$app"

View file

@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -23,7 +23,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -42,12 +42,6 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -67,6 +61,19 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$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 # SPECIFIC RESTORATION
#================================================= #=================================================
@ -77,9 +84,17 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=43
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_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" # ENABLE "TRANSCODE"
#================================================= #=================================================
ynh_script_progression --message="Enabling transcode..." --weight=1
### For details, see https://airsonic.github.io/docs/transcode/ ### For details, see https://airsonic.github.io/docs/transcode/
@ -98,46 +113,11 @@ fi
chown $app $final_path/transcode 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" 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 # 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 # Allow airsonic to write into these directories
ynh_multimedia_addaccess --user_name=$app 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 # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -18,14 +18,15 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) 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) 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) port=$(ynh_app_setting_get --app=$app --key=port)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..." --weight=1
upgrade_type=$(ynh_check_app_version_changed) 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 # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting # Restore it if the upgrade fails
# restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors 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 # 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 final_path doesn't exist, create it
if [ -z "$final_path" ]; then 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 ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
@ -74,14 +82,18 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public ynh_app_setting_delete --app=$app --key=is_public
fi fi
#================================================= # Rename legacy folder to proper location
# STANDARD UPGRADE STEPS if [[ ! -e /home/yunohost.app/$app ]] && [[ -e /home/yunohost.$app ]]
#================================================= then
# STOP SYSTEMD SERVICE mkdir -p /home/yunohost.app/
#================================================= mv /home/yunohost.$app /home/yunohost.app/$app
ynh_script_progression --message="Stopping a systemd service..." --weight=1 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 # CREATE DEDICATED USER
@ -107,6 +119,13 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$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 # NGINX CONFIGURATION
#================================================= #=================================================
@ -116,40 +135,7 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
# UPGRADE DEPENDENCIES # SPECIFIC UPGRADE
#=================================================
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
#================================================= #=================================================
# YUNOHOST MULTIMEDIA INTEGRATION # YUNOHOST MULTIMEDIA INTEGRATION
#================================================= #=================================================
@ -175,6 +161,7 @@ ynh_multimedia_addaccess $app
#================================================= #=================================================
# ENABLE "TRANSCODE" # ENABLE "TRANSCODE"
#================================================= #=================================================
ynh_script_progression --message="Enabling transcode..." --weight=1
### For details, see https://airsonic.github.io/docs/transcode/ ### For details, see https://airsonic.github.io/docs/transcode/
@ -193,19 +180,17 @@ fi
chown $app $final_path/transcode 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" 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 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"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -215,20 +200,10 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app"
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # USE MULTIMEDIA
#================================================= #=================================================
ynh_script_progression --message="Using multimedia..." --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"
# Use multimedia folder if needed # Use multimedia folder if needed
if ! grep -q "/home/yunohost.multimedia/share/Music" $final_path/db/airsonic.script; then 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" ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in"
fi 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 # RELOAD NGINX
#================================================= #=================================================