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 #55 from YunoHost-Apps/testing

Testing
This commit is contained in:
Alexandre Aubin 2021-11-14 17:57:03 +01:00 committed by GitHub
commit a03966d2b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 280 additions and 214 deletions

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -1,68 +1,56 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Airsonic for YunoHost
[![Integration level](https://dash.yunohost.org/integration/airsonic.svg)](https://dash.yunohost.org/appci/app/airsonic) ![](https://ci-apps.yunohost.org/ci/badges/airsonic.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/airsonic.maintain.svg)
[![Install Airsonic with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=airsonic)
> *This package allow you to install Airsonic quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Airsonic quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
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.
Stream and manage your music collection
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.
**Shipped version:** 10.6.2~ynh3
If you have constrained bandwidth, you may set an upper limit for the bit rate of the music streams. Airsonic will then automatically re sample the music to a suitable bit rate.
In addition to being a streaming media server, Airsonic works very well as a local jukebox. The intuitive web interface, as well as search and index facilities, are optimized for efficient browsing through large media libraries. Airsonic also comes with an integrated Podcast receiver, with many of the same features as you find in iTunes.
**Shipped version:** 10.6.2
**Demo:** https://airsonic.github.io/demo/
## Screenshots
![Sreenshot of home page of Airsonic](screenshot_01.png)
![](./doc/screenshots/screenshot_01.png)
## Demo
* [Official demo](https://airsonic.github.io/demo/)
## Configuration
How to configure this app: by an admin panel.
## Documentation
* Official documentation: https://airsonic.github.io/docs
## Disclaimers / important information
## YunoHost specific features
* YunoHost LDAP accounts supported: you can login with them
* YunoHost LDAP accounts supported: **Yes**
* [Multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) handled
* Memory RAM limit set to 256 MB because Airsonic was often killed by lack of RAM (hello OOM killer)
* See https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/
## Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/airsonic.svg)](https://ci-apps.yunohost.org/ci/apps/airsonic/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/airsonic.svg)](https://ci-apps-arm.yunohost.org/ci/apps/airsonic/)
## Links
## Documentation and resources
* Official app website: https://airsonic.github.io/
* Official admin documentation: https://airsonic.github.io/docs/
* Upstream app code repository: https://github.com/airsonic/airsonic
* YunoHost documentation for this app: https://yunohost.org/app_airsonic
* Report a bug: https://github.com/YunoHost-Apps/airsonic_ynh/issues
* App website: https://airsonic.github.io/
* Upstream app repository: https://github.com/airsonic/airsonic
* YunoHost website: https://yunohost.org/
---
## Developer info
## Developers info
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/airsonic_ynh/tree/testing).
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/airsonic_ynh/tree/testing).
To try the testing branch, please proceed like that.
```bash
```
sudo yunohost app install https://github.com/YunoHost-Apps/airsonic_ynh/tree/testing --debug
or
sudo yunohost app upgrade airsonic -u https://github.com/YunoHost-Apps/airsonic_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

51
README_fr.md Normal file
View file

@ -0,0 +1,51 @@
# Airsonic pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/airsonic.svg)](https://dash.yunohost.org/appci/app/airsonic) ![](https://ci-apps.yunohost.org/ci/badges/airsonic.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/airsonic.maintain.svg)
[![Installer Airsonic 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)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Airsonic rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Streamez et gérez votre collection de musique
**Version incluse :** 10.6.2~ynh3
**Démo :** https://airsonic.github.io/demo/
## Captures d'écran
![](./doc/screenshots/screenshot_01.png)
## Avertissements / informations importantes
## 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/
## Documentations et ressources
* Site officiel de l'app : https://airsonic.github.io/
* Documentation officielle de l'admin : https://airsonic.github.io/docs/
* Dépôt de code officiel de l'app : https://github.com/airsonic/airsonic
* Documentation YunoHost pour cette app : https://yunohost.org/app_airsonic
* Signaler un bug : https://github.com/YunoHost-Apps/airsonic_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/airsonic_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/airsonic_ynh/tree/testing --debug
ou
sudo yunohost app upgrade airsonic -u https://github.com/YunoHost-Apps/airsonic_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,9 +1,9 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0)
domain="domain.tld"
path="/path"
admin="john"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1

View file

@ -17,7 +17,14 @@ location __PATH__/ {
# See https://github.com/YunoHost-Apps/airsonic_ynh/issues/4
client_max_body_size 500M;
# Fix last DSub releases not able to connect with LDAP
# See https://github.com/airsonic/airsonic/issues/260
sub_filter_types text/xml application/json;
sub_filter_once off;
sub_filter 'subsonic' 'madsonic';
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
# Removed since sub_filter_once directive is also used in this file
# include conf.d/yunohost_panel.conf.inc;
# proxy_set_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' www.gstatic.com; img-src 'self' *.akamaized.net; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src 'self' fonts.gstatic.com; frame-src 'self'; object-src 'none'";
}

6
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,6 @@
## YunoHost specific features
* YunoHost LDAP accounts supported: **Yes**
* [Multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) handled
* Memory RAM limit set to 256 MB because Airsonic was often killed by lack of RAM (hello OOM killer)
* See https://www.reddit.com/r/airsonic/comments/doscco/jvm_memory_issues/

6
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,6 @@
## 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/

View file

Before

Width:  |  Height:  |  Size: 400 KiB

After

Width:  |  Height:  |  Size: 400 KiB

View file

@ -6,15 +6,22 @@
"en": "Stream and manage your music collection",
"fr": "Streamez et gérez votre collection de musique"
},
"version": "10.6.2~ynh2",
"version": "10.6.2~ynh3",
"url": "http://airsonic.github.io",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://airsonic.github.io/",
"demo": "https://airsonic.github.io/demo/",
"admindoc": "https://airsonic.github.io/docs/",
"code": "https://github.com/airsonic/airsonic"
},
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "Gofannon",
"email": "gofannon@riseup.net"
},
"requirements": {
"yunohost": ">= 4.1.7"
"yunohost": ">= 4.2.4"
},
"multi_instance": true,
"services": [
@ -24,8 +31,7 @@
"install" : [
{
"name": "domain",
"type": "domain",
"example": "example.com"
"type": "domain"
},
{
"name": "path",
@ -35,12 +41,7 @@
},
{
"name": "admin",
"type": "user",
"help": {
"en": "This user will have full control on this application and will be able to configure it.",
"fr": "Cet utilisateur aura le controle total de l'application et pourra la configurer."
},
"example": "johndoe"
"type": "user"
},
{
"name": "is_public",

View file

@ -1,16 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -18,56 +18,3 @@ pkg_dependencies="openjdk-8-jre|openjdk-11-jre ffmpeg"
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
# Install or update the main directory yunohost.multimedia
#
# usage: ynh_multimedia_build_main_dir
ynh_multimedia_build_main_dir () {
local ynh_media_release="v1.2"
local checksum="806a827ba1902d6911095602a9221181"
# Download yunohost.multimedia scripts
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1
# Check the control sum
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|| ynh_die "Corrupt source"
# Check if the package acl is installed. Or install it.
ynh_package_is_installed 'acl' \
|| ynh_package_install acl
# Extract
mkdir yunohost.multimedia-master
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
./yunohost.multimedia-master/script/ynh_media_build.sh
}
# Add a directory in yunohost.multimedia
# This "directory" will be a symbolic link to a existing directory.
#
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
#
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
ynh_multimedia_addfolder () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
local source_dir
local dest_dir
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
}
# Grant write access to multimedia directories to a specified user
#
# usage: ynh_multimedia_addaccess user_name
#
# | arg: user_name - User to be granted write access
ynh_multimedia_addaccess () {
local user_name=$1
groupadd -f multimedia
usermod -a -G multimedia $user_name
}

View file

@ -30,6 +30,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# service_config=$(ynh_app_setting_get --app=$app --key=service_config)
port=$(ynh_app_setting_get --app=$app --key=port)
path_url=$(ynh_app_setting_get --app=$app --key=path)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP

View file

@ -72,6 +72,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=43
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -81,6 +89,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -90,27 +102,18 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
ynh_script_progression --message="Creating a data directory..." --weight=1
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# SPECIFIC SETUP
#=================================================
# CREATE DIRECTORIES
#=================================================
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
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
chmod 764 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
@ -120,6 +123,7 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=3
ynh_multimedia_build_main_dir
ynh_multimedia_addfolder --source_dir="/home/yunohost.app/$app/Podcasts" --dest_dir="share/Podcasts"
ynh_multimedia_addfolder --source_dir="/home/yunohost.app/$app/Playlists" --dest_dir="share/Playlists"
# Allow airsonic to write into these directories
ynh_multimedia_addaccess $app
@ -141,7 +145,7 @@ if [ -x /usr/bin/lame ]; then # Check if 'lame' is installed and executable
fi
# Ensure links belong to the $app user
chown $app: $final_path/transcode
chown $app $final_path/transcode
#=================================================
# SETUP SYSTEMD
@ -159,15 +163,6 @@ ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/defaul
# Copy configuration file of airsonic
ynh_add_config --template="../conf/airsonic.properties" --destination="$final_path/airsonic.properties"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R $app: $final_path
#=================================================
# SETUP LOGROTATE
#=================================================

View file

@ -30,14 +30,13 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
@ -49,6 +48,14 @@ test ! -d $final_path \
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -56,20 +63,9 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files
chown -R $app: $final_path
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# SPECIFIC RESTORATION
@ -99,7 +95,7 @@ if [ -x /usr/bin/lame -a ! -e $final_path/transcode/lame ]; then # Check if 'l
fi
# Ensure links belong to the $app user
chown $app: $final_path/transcode
chown $app $final_path/transcode
#=================================================
# RESTORE SYSTEMD
@ -130,19 +126,18 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# RESTORE DATA
# 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="/home/yunohost.app/$app" --not_mandatory
ynh_restore_file --origin_path="$datadir" --not_mandatory
#=================================================
# RESTORE USER RIGHTS
#=================================================
mkdir -p $datadir
mkdir -p /home/yunohost.app/$app/{Podcasts,Playlists}
chown -R $app:www-data /home/yunohost.app/$app
chmod -R 764 /home/yunohost.app/$app
chmod 764 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
@ -153,7 +148,7 @@ ynh_multimedia_build_main_dir
ynh_multimedia_addfolder --source_dir="/home/yunohost.app/$app/Podcasts" --dest_dir="share/Podcasts"
ynh_multimedia_addfolder --source_dir="/home/yunohost.app/$app/Playlists" --dest_dir="share/Playlists"
# Allow airsonic to write into these directories
ynh_multimedia_addaccess $app
ynh_multimedia_addaccess --user_name=$app
#=================================================
# GENERIC FINALIZATION

View file

@ -18,8 +18,10 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
port=$(ynh_app_setting_get --app=$app --key=port)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK VERSION
@ -27,24 +29,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/opt/yunohost/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -61,6 +45,35 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/opt/yunohost/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# If public_path doesn't exist, create it
if [ -z "$datadir" ]; then
datadir=/home/yunohost.app/$app
mkdir -p $datadir/{Podcasts,Playlists}
chmod 764 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
cp -a "/home/yunohost.$app" "$datadir"
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -70,6 +83,14 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -82,6 +103,10 @@ then
ynh_setup_source --dest_dir="$final_path"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -97,19 +122,17 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=4
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# #=================================================
# # SPECIFIC UPGRADE
# #=================================================
# # CREATE DIRECTORIES
# #=================================================
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
# mkdir -p /home/yunohost.app/$app/{Podcasts,Playlists}
#=================================================
# SPECIFIC UPGRADE
#=================================================
# CREATE DIRECTORIES
#=================================================
# #=================================================
# # SECURING FILES AND DIRECTORIES
# #=================================================
# Rename legacy folder to proper location
if [[ ! -e /home/yunohost.app/$app ]] && [[ -e /home/yunohost.$app ]]
@ -167,7 +190,7 @@ if [ -x /usr/bin/lame -a ! -e $final_path/transcode/lame ]; then # Check if 'l
fi
# Ensure links belong to the $app user
chown $app: $final_path/transcode
chown $app $final_path/transcode
#=================================================
# STORE THE CONFIG FILE CHECKSUM
@ -194,15 +217,6 @@ ynh_add_systemd_config
ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
chown -R $app: $final_path
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================