1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mopidy_ynh.git synced 2024-09-03 19:46:21 +02:00

manifest v2

This commit is contained in:
Salamandar 2024-01-14 22:29:35 +01:00
parent cfc42dd55c
commit 42389c8374
17 changed files with 311 additions and 724 deletions

View file

@ -1,25 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
path="/path"
is_public=1
mpd_ext=1
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
# 3.1.1~ynh2
# upgrade=1 from_commit=bc421d01d57a273a59287cf7500e94a89de0abed
# 3.2.0~ynh1
# upgrade=1 from_commit=31c5de684273794e4f4837d5dccc5a663ce9fb45
backup_restore=1
multi_instance=0
port_already_use=0
change_url=1
;;; Options
Email=
Notification=none

View file

@ -2,9 +2,9 @@
# http://docs.mopidy.com/ # http://docs.mopidy.com/
[core] [core]
cache_dir = __DATADIR__/cache cache_dir = __DATA_DIR__/cache
#config_dir = #config_dir =
data_dir = __DATADIR__/data data_dir = __DATA_DIR__/data
#max_tracklist_length = 10000 #max_tracklist_length = 10000
#restore_state = false #restore_state = false
@ -168,7 +168,7 @@ retries = 3
[podcast] [podcast]
enabled = true enabled = true
browse_root = __DATADIR__/data/podcast/bbc.opml browse_root = __DATA_DIR__/data/podcast/bbc.opml
#browse_order = desc #browse_order = desc
#lookup_order = asc #lookup_order = asc
#cache_size = 64 #cache_size = 64
@ -185,4 +185,4 @@ auth_token = ?
[mpd] [mpd]
enabled = __MPD_STATE__ enabled = __MPD_STATE__
hostname = 0.0.0.0 hostname = 0.0.0.0
port = __MPD_PORT__ port = __PORT_MPD__

View file

@ -1,41 +1,41 @@
location /mopidy/ws { location /mopidy/ws {
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 604800; proxy_read_timeout 604800;
proxy_send_timeout 604800; proxy_send_timeout 604800;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} }
location __PATH__/ { location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__/musicbox_webclient/; proxy_pass http://127.0.0.1:__PORT__/musicbox_webclient/;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }
location /musicbox_webclient/ { location /musicbox_webclient/ {
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }
location /local/ { location /local/ {
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }

View file

@ -1,8 +1,6 @@
[raspberry-gpio] [raspberry-gpio]
enabled = false enabled = false
bcm5 = play_pause,active_low,250 bcm5 = play_pause,active_low,250
bcm6 = volume_down,active_low,250 bcm6 = volume_down,active_low,250
bcm16 = next,active_low,250 bcm16 = next,active_low,250
bcm20 = volume_up,active_low,250 bcm20 = volume_up,active_low,250

View file

@ -11,7 +11,7 @@ After=sound.target
[Service] [Service]
User=__APP__ User=__APP__
PermissionsStartOnly=true PermissionsStartOnly=true
ExecStart=__FINALPATH__/env/bin/__APP__ --config __FINALPATH__/__APP__.conf ExecStart=__INSTALL_DIR__/env/bin/__APP__ --config __INSTALL_DIR__/__APP__.conf
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

14
doc/ADMIN.md Normal file
View file

@ -0,0 +1,14 @@
* This installation is shipped with various extensions:
* [MusicBox-Webclient](https://mopidy.com/ext/musicbox-webclient/) to control mopidy from your web browser
* [local](https://mopidy.com/ext/local/) to make your private music collection on `/home/yunohost.multimedia/share/Music/` browseable and searchable
* [YouTube](https://pypi.org/project/Mopidy-YouTube/) to play sound from YouTube
* [YTMusic](https://music.youtube.com/) to access Googles streaming music named [YouTube Music](https://music.youtube.com/)
* [Podcast-iTunes](https://mopidy.com/ext/podcast-itunes/) to search and browse podcasts from the Apple iTunes Store.
* [RadioNet](https://mopidy.com/ext/radionet/) to play radio channels from the [radio.net](https://www.radio.net/).
* [Podcast](https://mopidy.com/ext/podcast/) to browse RSS feeds of podcasts and stream the episodes.
* [Soundcloud](https://pypi.org/project/Mopidy-SoundCloud/) to play music from the [SoundCloud](https://soundcloud.com/) service \([authentication token](https://pypi.org/project/Mopidy-SoundCloud/) needed\).
* [MPD](https://mopidy.com/ext/mpd/) can be activated in order to use apps that control mopidy via this protocol. (This will open port 6600.)
* All streams are played on the servers local audio hardware. The web interface is only a kind of remote control. Threrefore it should not be used with VPS or other servers that have no real audio hardware
* To rebuild the database of your local music collection enter `sudo mopidyctl local scan`.
* To list current settings enter `sudo mopidyctl config`.
* Edit the file `/opt/yunohost/mopidy/mopidy.conf` to adjust Mopidy's configuration.

View file

@ -1,14 +0,0 @@
* This installation is shipped with various extensions:
* [MusicBox-Webclient](https://mopidy.com/ext/musicbox-webclient/) to control mopidy from your web browser
* [local](https://mopidy.com/ext/local/) to make your private music collection on `/home/yunohost.multimedia/share/Music/` browseable and searchable
* [YouTube](https://pypi.org/project/Mopidy-YouTube/) to play sound from YouTube
* [YTMusic](https://music.youtube.com/) to access Googles streaming music named [YouTube Music](https://music.youtube.com/)
* [Podcast-iTunes](https://mopidy.com/ext/podcast-itunes/) to search and browse podcasts from the Apple iTunes Store.
* [RadioNet](https://mopidy.com/ext/radionet/) to play radio channels from the [radio.net](https://www.radio.net/).
* [Podcast](https://mopidy.com/ext/podcast/) to browse RSS feeds of podcasts and stream the episodes.
* [Soundcloud](https://pypi.org/project/Mopidy-SoundCloud/) to play music from the [SoundCloud](https://soundcloud.com/) service \([authentication token](https://pypi.org/project/Mopidy-SoundCloud/) needed\).
* [MPD](https://mopidy.com/ext/mpd/) can be activated in order to use apps that control mopidy via this protocol. (This will open port 6600.)
* All streams are played on the servers local audio hardware. The web interface is only a kind of remote control. Threrefore it should not be used with VPS or other servers that have no real audio hardware
* To rebuild the database of your local music collection enter `sudo mopidyctl local scan`.
* To list current settings enter `sudo mopidyctl config`.
* Edit the file `/opt/yunohost/mopidy/mopidy.conf` to adjust Mopidy's configuration.

View file

@ -1,65 +0,0 @@
{
"id": "mopidy",
"name": "Mopidy",
"packaging_format": 1,
"description": {
"en": "Play music, podcasts and radio programs from local disk and various streaming services",
"fr": "Écouter de la musique, des podcasts et des programmes radio depuis le disque local et divers services de streaming"
},
"version": "3.4.2~ynh3",
"url": "https://www.mopidy.com",
"upstream": {
"license": "Apache-2.0",
"website": "https://www.mopidy.com",
"admindoc": "https://docs.mopidy.com/en/latest",
"code": "https://github.com/mopidy/mopidy"
},
"license": "Apache-2.0",
"maintainer": {
"name": "siwinter",
"email": "siegfried.winter@arcor.de"
},
"previous_maintainer": {
"name": "cyp",
"email": "cyp@rouquin.me"
},
"requirements": {
"yunohost": ">= 11.2"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/mopidy",
"default": "/mopidy"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "Public app can be used by anonymous visitors.",
"fr": "L'application publique peut être utilisée par des visiteurs anonymes."
},
"default": false
},
{
"name": "mpd_ext",
"type": "boolean",
"ask": {
"en": "Activate MPD extension (this will open port 6600)",
"fr": "Activer l'extension MPD (cela ouvrira le port 6600)"
},
"default": false
}
]
}
}

93
manifest.toml Normal file
View file

@ -0,0 +1,93 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "mopidy"
name = "Mopidy"
description.en = "Play music, podcasts and radio programs from local disk and various streaming services"
description.fr = "Écouter de la musique, des podcasts et des programmes radio depuis le disque local et divers services de streaming"
version = "3.4.2~ynh4"
maintainers = ["siwinter"]
[upstream]
license = "Apache-2.0"
website = "https://www.mopidy.com"
admindoc = "https://docs.mopidy.com/en/latest"
code = "https://github.com/mopidy/mopidy"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 11.2"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
multi_instance = false
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
[install]
[install.domain]
type = "domain"
[install.path]
type = "path"
default = "/mopidy"
[install.init_main_permission]
help.en = "Public app can be used by anonymous visitors."
help.fr = "L'application publique peut être utilisée par des visiteurs anonymes."
type = "group"
default = false
[install.mpd_ext]
ask.en = "Activate MPD extension (this will open port 6600)"
ask.fr = "Activer l'extension MPD (cela ouvrira le port 6600)"
type = "boolean"
default = false
[resources]
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
subdirs = ["data", "cache"]
[resources.permissions]
main.url = "/"
[resources.ports]
main.default = 6680
mpd.default = 6600
[resources.apt]
packages = [
"acl",
"build-essential",
"debconf",
"gir1.2-gst-plugins-base-1.0",
"gir1.2-gstreamer-1.0",
"git",
"gstreamer1.0-alsa",
"gstreamer1.0-plugins-good",
"gstreamer1.0-plugins-ugly",
"gstreamer1.0-pulseaudio",
"gstreamer1.0-tools",
"libcairo2-dev",
"libgirepository1.0-dev",
"lsb-base",
"postgresql-contrib",
"postgresql",
"python3-dev",
"python3-gst-1.0",
"python3-pip",
"python3-pkg-resources",
"python3-pykka",
"python3-requests",
"python3-tornado",
"python3-venv",
]

View file

@ -4,46 +4,36 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app boolstr=(false true)
pkg_dependencies="acl build-essential python3-dev python3-pip python3-venv git postgresql postgresql-contrib \
gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly lsb-base \ cmd_file="/usr/local/bin/mopidyctl"
python3-gst-1.0 python3-tornado debconf python3-pkg-resources python3-pykka python3-requests \
gstreamer1.0-alsa gstreamer1.0-pulseaudio gstreamer1.0-tools libgirepository1.0-dev libcairo2-dev" media_dir="/home/yunohost.multimedia/share/Music"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)" _mopidy_install() {
python3 -m venv --upgrade "$install_dir/venv"
chown -R "$app" "$install_dir"
myynh_install() { venvpy="$install_dir/venv/bin/python3"
python3 -m venv "${final_path}/env"
chown -R "$app" "$final_path"
#run source in a 'sub shell' ynh_exec_as "$app" "$venvpy" -m pip install --upgrade --no-cache-dir pip
(
set +o nounset
source "${final_path}/env/bin/activate"
set -o nounset
ynh_exec_as $app $final_path/env/bin/pip install --upgrade --no-cache-dir pip
# to make Gstreamer visible in Python environment # install essential packages
# $final_path/env/bin/python3 -m pip install vext ynh_exec_as "$app" "$venvpy" -m pip install --no-cache-dir \
# $final_path/env/bin/python3 -m pip install --no-binary=:all: vext.gi Mopidy=="$(ynh_app_upstream_version)" \
$final_path/env/bin/python3 -m pip install PyGObject Mopidy-local==3.2.1 \
Mopidy-MusicBox-Webclient==3.1.0 \
# install essential packages Mopidy-YouTube==3.7 \
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy==$(ynh_app_upstream_version) Mopidy-YTMusic==0.3.8 \
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-local==3.2.1 Mopidy-RadioNet==0.2.2 \
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-MusicBox-Webclient==3.1.0 Mopidy-Podcast==3.0.1 \
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-YouTube==3.7 Mopidy-Podcast-iTunes==3.0.1 \
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-YTMusic==0.3.8 Mopidy-SoundCloud==3.0.2 \
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-RadioNet==0.2.2 Mopidy-MPD==3.3.0
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-Podcast==3.0.1
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-Podcast-iTunes==3.0.1
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-SoundCloud==3.0.2
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-MPD==3.3.0
)
} }
#================================================= #=================================================

View file

@ -10,24 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================
@ -37,13 +19,13 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$final_path" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE DATA DIR # BACKUP THE DATA DIR
#================================================= #=================================================
ynh_backup --src_path="$datadir" --is_big ynh_backup --src_path="$data_dir" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION

View file

@ -9,62 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=path)
# Add settings here as needed by your application
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=15
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -79,33 +23,14 @@ ynh_systemd_action --service_name=$app --action="stop"
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=15 ynh_script_progression --message="Updating NGINX web server configuration..." --weight=15
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf ynh_change_url_nginx_config
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX # Change the domain for NGINX
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]; then
then #adapt permissions for additional URIs
# Delete file checksum for the old conf file location ynh_permission_url --permission="main" --add_url="$new_domain/mopidy/ws" --remove_url="$old_domain/mopidy/ws"
ynh_delete_file_checksum --file="$nginx_conf_path" ynh_permission_url --permission="main" --add_url="$new_domain/local" --remove_url="$old_domain/local"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf ynh_permission_url --permission="main" --add_url="$new_domain/musicbox_webclient" --remove_url="$old_domain/musicbox_webclient"
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
#adapt permissions for additional URIs
ynh_permission_url --permission="main" --add_url="$new_domain/mopidy/ws" --remove_url="$old_domain/mopidy/ws"
ynh_permission_url --permission="main" --add_url="$new_domain/local" --remove_url="$old_domain/local"
ynh_permission_url --permission="main" --add_url="$new_domain/musicbox_webclient" --remove_url="$old_domain/musicbox_webclient"
fi fi
#================================================= #=================================================
@ -115,14 +40,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" ynh_systemd_action --service_name="$app" --action="start"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,151 +10,50 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # INITIALIZE AND STORE SETTINGS
#================================================= #=================================================
ynh_clean_setup () { mpd_state="${boolstr[mpdext]}"
ynh_clean_check_starting ynh_app_setting_set --app=$app --key=mpd_state --value=$mpd_state
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
mpd_port=$YNH_APP_ARG_MPD_EXT
app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS ynh_script_progression --message="Setting up source files..." --weight=1
#=================================================
ynh_script_progression --message="Validating installation parameters..."
final_path=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..."
# Find an available port
port=$(ynh_find_port --port=6680)
ynh_app_setting_set --app=$app --key=port --value=$port
if [ $mpd_port -eq 1 ]; then
mpd_port=$(ynh_find_port --port=6600)
ynh_app_setting_set --app=$app --key=mpd_port --value=$mpd_port
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $mpd_port
mpd_state="true"
else
mpd_state="false"
fi
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=30
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell --groups="audio"
#================================================= #=================================================
# INSTALL MOPIDY IN PYTHON ENVIRONMENT # INSTALL MOPIDY IN PYTHON ENVIRONMENT
#================================================= #=================================================
ynh_script_progression --message="Install in Python environment..." --weight=30 ynh_script_progression --message="Install in Python environment..." --weight=30
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
myynh_install myynh_install
patch -u $final_path/env/lib/python$python_version/site-packages/mopidy/__main__.py -i ../sources/patches/__main__.patch --forward patch -u $install_dir/env/lib/python$python_version/site-packages/mopidy/__main__.py -i ../sources/patches/__main__.patch --forward
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R "$app:www-data" "$install_dir"
#================================================= chmod -R o-rwx "$data_dir"
# NGINX CONFIGURATION chown -R "$app:www-data" "$data_dir"
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# BUILD MULTIMEDIA
#=================================================
ynh_script_progression --message="Building multimedia directory..."
media_dir="/home/yunohost.multimedia/share/Music"
ynh_multimedia_build_main_dir # /home/yunohost.multimedia
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..."
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir
mkdir -p "$datadir/data" # /home/yunohost.app/mopidy/data
mkdir -p "$datadir/cache" # /home/yunohost.app/mopidy/cache
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." ynh_script_progression --message="Adding a configuration file..."
ynh_add_config --template="../conf/app.conf" --destination="$final_path/$app.conf" ynh_add_config --template="app.conf" --destination="$install_dir/$app.conf"
chmod 400 "$final_path/$app.conf" chmod 400 "$install_dir/$app.conf"
chown $app:$app "$final_path/$app.conf" chown "$app:$app" "$install_dir/$app.conf"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
ynh_add_systemd_config
#================================================= #=================================================
# PROVIDE ADDITIONAL SHELL COMMAND # PROVIDE ADDITIONAL SHELL COMMAND
#================================================= #=================================================
ynh_script_progression --message="Provide additional shell command..." ynh_script_progression --message="Provide additional shell command..."
cmd_file="/usr/local/bin/mopidyctl"
ynh_add_config --template="../sources/extra_files/mopidyctl" --destination="$cmd_file" ynh_add_config --template="../sources/extra_files/mopidyctl" --destination="$cmd_file"
chmod +x "$cmd_file" chmod +x "$cmd_file"
@ -166,69 +65,78 @@ chmod +x "$cmd_file"
media_dir="/home/yunohost.multimedia/share/Music" media_dir="/home/yunohost.multimedia/share/Music"
# provide example m3u-playlist # provide example m3u-playlist
mkdir -p "$datadir/data/m3u/" mkdir -p "$data_dir/data/m3u/"
cp -a ../sources/extra_files/radio_international.m3u "$datadir/data/m3u/radio_international.m3u" cp -a ../sources/extra_files/radio_international.m3u "$data_dir/data/m3u/radio_international.m3u"
#provide example podcasts #provide example podcasts
mkdir -p "$datadir/data/podcast" mkdir -p "$data_dir/data/podcast"
cp -a ../sources/extra_files/bbc.opml "$datadir/data/podcast/bbc.opml" cp -a ../sources/extra_files/bbc.opml "$data_dir/data/podcast/bbc.opml"
#provide example local music file #provide example local music file
if [ "$(ls -A "$media_dir" 2> /dev/null)" == "" ]; then # copy example.mp3 to mediadir if empty (for test purpose) if [ "$(ls -A "$media_dir" 2> /dev/null)" == "" ]; then # copy example.mp3 to mediadir if empty (for test purpose)
cp -a ../sources/extra_files/Tryad_Beauty.mp3 "$media_dir" cp -a ../sources/extra_files/Tryad_Beauty.mp3 "$media_dir"
fi fi
#=================================================
# SPECIFIC SETUP
#=================================================
# BUILD MULTIMEDIA
#=================================================
ynh_script_progression --message="Building multimedia directory..."
media_dir="/home/yunohost.multimedia/share/Music"
ynh_multimedia_build_main_dir # /home/yunohost.multimedia
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
if [ "$mpd_ext" -eq 1 ]; then
yunohost service add "$app" --description="Mopidy music server" --needs_exposed_ports="$port_mpd"
else
yunohost service add "$app" --description="Mopidy music server"
fi
#=================================================
# OPEN PORT
#=================================================
if [ "$mpd_ext" -eq 1 ]; then
ynh_script_progression --message="Opening MPD-port $port_mpd..." --weight=1
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP "$port_mpd"
fi
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring domain-wide permissions..."
ynh_permission_url --permission="main" --add_url="$domain/mopidy/ws"
ynh_permission_url --permission="main" --add_url="$domain/musicbox_webclient"
ynh_permission_url --permission="main" --add_url="$domain/local"
#=================================================
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
#================================================= #=================================================
# SCAN LOCAL MEDIA DIRECTORY # SCAN LOCAL MEDIA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Scan local media directory..." ynh_script_progression --message="Running the initial local media directory..."
"$cmd_file" local scan 2>&1 "$cmd_file" local scan 2>&1
#=================================================
# GENERIC FINALIZATION
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
if [ $mpd_port -ne 0 ]; then
yunohost service add $app --description="Mopidy music server" --needs_exposed_ports=$mpd_port
else
yunohost service add $app --description="Mopidy music server"
fi
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" ynh_systemd_action --service_name="$app" --action="start"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi
ynh_permission_url --permission="main" --add_url="$domain/mopidy/ws"
ynh_permission_url --permission="main" --add_url="$domain/musicbox_webclient"
ynh_permission_url --permission="main" --add_url="$domain/local"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,91 +10,24 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=4
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `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 integration..." --weight=1
ynh_script_progression --message="Removing $app service integration..." --weight=1 yunohost service remove "$app"
yunohost service remove $app
fi fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=4
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=2
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=42
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $mpd_port$"
then
ynh_script_progression --message="Closing port $mpd_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $mpd_port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
ynh_secure_remove --file="/usr/local/bin/mopidyctl" ynh_secure_remove --file="/usr/local/bin/mopidyctl"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=2
# Delete a system user
ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -10,133 +10,62 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
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)
mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=3
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# 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" --use_shell --groups="audio"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# RESTORE THE DATA DIRECTORY # RESTORE THE DATA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Restoring the data directory..." ynh_script_progression --message="Restoring the data directory..."
ynh_restore_file --origin_path="$datadir" --not_mandatory ynh_restore_file --origin_path="$data_dir" --not_mandatory
mkdir -p $datadir chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir"
chmod 750 "$datadir" chown -R "$app:www-data" "$data_dir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#================================================= #=================================================
# SPECIFIC RESTORATION # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
# REINSTALL DEPENDENCIES ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=50
# Define and install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/usr/local/bin/mopidyctl" # /usr/local/bin/mopidyctl
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable "$app.service" --quiet
if [ "$mpd_ext" -eq 1 ]; then
yunohost service add "$app" --description="Mopidy music server" --needs_exposed_ports=$port_mpd
else
yunohost service add "$app" --description="Mopidy music server"
fi
#================================================= #=================================================
# OPEN PORT # OPEN PORT
#================================================= #=================================================
if [ $mpd_port -ne 0 ]; then if [ "$mpd_ext" -eq 1 ]; then
ynh_script_progression --message="open MPD-port $mpd_port..." --weight=1 ynh_script_progression --message="Opening MPD-port $port_mpd..." --weight=1
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $mpd_port ynh_exec_warn_less yunohost firewall allow --no-upnp TCP "$port_mpd"
fi fi
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/usr/local/bin/mopidyctl" # /usr/local/bin/mopidyctl
#=================================================
# 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
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
if [ $mpd_port -ne 0 ]; then
yunohost service add $app --description="Mopidy music server" --needs_exposed_ports=$mpd_port
else
yunohost service add $app --description="Mopidy music server"
fi
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start"
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -10,43 +10,13 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # STANDARD UPGRADE STEPS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=2 # ENSURE DOWNWARD COMPATIBILITY
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)
port=$(ynh_app_setting_get --app=$app --key=port)
mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
# other variables
media_dir="/home/yunohost.multimedia/share/Music"
cmd_file="/usr/local/bin/mopidyctl"
#================================================= #=================================================
# CHECK VERSION ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) ynh_secure_remove "$install_dir/env"
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=7
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -55,79 +25,28 @@ ynh_abort_if_errors
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" ynh_systemd_action --service_name="$app" --action="stop"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If mpd_port doesn't exist, create it
if [ -z "$mpd_port" ]; then
mpd_port=0
ynh_app_setting_set --app=$app --key=mpd_port --value=$mpd_port
fi
if [ $mpd_port -eq 0 ]; then
mpd_state="false"
else
mpd_state="true"
fi
# If datadir doesn't exist, create it
if [ -z "$datadir" ]; then
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
fi
#=================================================
# 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" --use_shell --groups="audio"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..."
if [ "$upgrade_type" == "UPGRADE_APP" ] myynh_install
then
ynh_script_progression --message="Upgrading source files..."
myynh_install
fi
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R "$app:www-data" "$install_dir"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=11
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template="../conf/app.conf" --destination="$final_path/$app.conf" ynh_add_config --template="../conf/app.conf" --destination="$install_dir/$app.conf"
chmod 400 "$final_path/$app.conf" chmod 400 "$install_dir/$app.conf"
chown $app:$app "$final_path/$app.conf" chown "$app:$app" "$install_dir/$app.conf"
#================================================= #=================================================
# PROVIDE ADDITIONAL SHELL COMMAND # PROVIDE ADDITIONAL SHELL COMMAND
@ -135,28 +54,30 @@ chown $app:$app "$final_path/$app.conf"
ynh_script_progression --message="Provide additional shell comand..." ynh_script_progression --message="Provide additional shell comand..."
ynh_add_config --template="../sources/extra_files/mopidyctl" --destination="$cmd_file" ynh_add_config --template="../sources/extra_files/mopidyctl" --destination="$cmd_file"
chmod +x "$cmd_file" chmod +x "$cmd_file"
#================================================= #=================================================
# SETUP SYSTEMD # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=3 ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
if [ "$mpd_ext" -eq 1 ]; then
#================================================= yunohost service add "$app" --description="Mopidy music server" --needs_exposed_ports="$port_mpd"
# GENERIC FINALIZATION
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
if [ $mpd_port -ne 0 ]; then
yunohost service add $app --description="Mopidy music server" --needs_exposed_ports=$mpd_port
else else
yunohost service add $app --description="Mopidy music server" yunohost service add "$app" --description="Mopidy music server"
fi
#=================================================
# OPEN PORT
#=================================================
if [ "$mpd_ext" -eq 1 ]; then
ynh_script_progression --message="Opening MPD-port $port_mpd..." --weight=1
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP "$port_mpd"
fi fi
#================================================= #=================================================
@ -164,14 +85,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" ynh_systemd_action --service_name="$app" --action="start"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

12
tests.toml Normal file
View file

@ -0,0 +1,12 @@
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------
args.superuser = "package_checker"
test_upgrade_from.bc421d01d57a273a59287cf7500e94a89de0abed.name = "3.1.1~ynh2"
test_upgrade_from.31c5de684273794e4f4837d5dccc5a663ce9fb45.name = "3.2.0~ynh1"