mirror of
https://github.com/YunoHost-Apps/airsonic_ynh.git
synced 2024-09-03 18:06:14 +02:00
Apply last example_ynh
This commit is contained in:
parent
6ca76697a8
commit
a8ac13c16e
14 changed files with 268 additions and 230 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*~
|
|
||||||
*.sw[op]
|
|
|
@ -24,7 +24,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'";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ 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__
|
||||||
|
@ -17,22 +19,17 @@ ExecStart=/usr/bin/java \
|
||||||
-Dserver.context-path=${CONTEXT_PATH} \
|
-Dserver.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
|
||||||
ProtectControlGroups=yes
|
|
||||||
ProtectKernelModules=yes
|
|
||||||
ProtectKernelTunables=yes
|
|
||||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
||||||
RestrictNamespaces=yes
|
RestrictNamespaces=yes
|
||||||
RestrictRealtime=yes
|
RestrictRealtime=yes
|
||||||
|
DevicePolicy=closed
|
||||||
SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap
|
SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap
|
||||||
ReadWritePaths=__FINALPATH__
|
ReadWritePaths=__FINALPATH__
|
||||||
|
|
||||||
|
@ -44,6 +41,9 @@ ReadWritePaths=__FINALPATH__
|
||||||
# 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
|
7
doc/DESCRIPTION.md
Normal file
7
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
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.
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Streamez et gérez votre collection de musique
|
|
@ -1,6 +0,0 @@
|
||||||
## Fonctionnalités spécifiques à 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/
|
|
|
@ -17,18 +17,18 @@
|
||||||
},
|
},
|
||||||
"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": [
|
||||||
"nginx"
|
"nginx"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain"
|
"type": "domain"
|
||||||
|
@ -39,14 +39,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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# 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-8-jre|openjdk-11-jre ffmpeg"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
102
scripts/install
102
scripts/install
|
@ -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
|
||||||
|
|
||||||
|
@ -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"
|
||||||
|
@ -109,7 +109,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 +130,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 +148,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 400 "/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 400 "$final_path/airsonic.properties"
|
||||||
|
chown $app:$app "$final_path/airsonic.properties"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -155,45 +170,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 +215,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 +233,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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
101
scripts/restore
101
scripts/restore
|
@ -6,7 +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
|
# 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
|
||||||
|
|
||||||
|
@ -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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
133
scripts/upgrade
133
scripts/upgrade
|
@ -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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -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 400 "/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 400 "$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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue