1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minidlna_ynh.git synced 2024-09-03 19:36:34 +02:00

Merge pull request #33 from YunoHost-Apps/version-2

Version 2
This commit is contained in:
Salamandar 2024-01-24 18:39:40 +01:00 committed by GitHub
commit ca83714127
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 134 additions and 485 deletions

View file

@ -16,21 +16,17 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
MiniDLNA is a simple media server software, with the aim of being fully compliant with DLNA/UPnP-AV clients.
**Shipped version:** 1.0~ynh9
## Disclaimers / important information
## Configuration
Edit the file `/etc/minidlna.conf` to adjust the configuration of MiniDLNA.
MiniDLNA is a lightweight [DLNA](https://fr.wikipedia.org/wiki/Digital_Living_Network_Alliance) server.
It allows to easily share multimedia files with any compatible devices present on the LAN.
MiniDLNA does not have a graphical interface, but does not require any special configuration.
## YunoHost specific features
* Use shared Multimedia Directories
* Linked to transmission, Nextcloud and all other app which use Multimedia Directories.
**Shipped version:** 1.3.0~ynh1
## Documentation and resources
* Official app website: <http://minidlna.sourceforge.net>

View file

@ -16,21 +16,17 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
## Vue densemble
MiniDLNA est un simple serveur multimédia, dont le but est d'être entièrement compatible avec les clients DLNA/UPnP-AV.
**Version incluse :** 1.0~ynh9
## Avertissements / informations importantes
## Configuration
Éditez le fichier `/etc/minidlna.conf` pour ajuster la configuration de MiniDLNA.
MiniDLNA est un serveur [DLNA](https://fr.wikipedia.org/wiki/Digital_Living_Network_Alliance) ultra léger.
Il permet de partager très simplement les fichiers multimédias avec tout les appareils compatibles présent sur le réseau local.
Minidlna ne dispose pas d'une interface graphique, mais ne nécessite pas de configuration particulière.
## Fonctionnalités spécifiques à YunoHost
* Utilise les répertoires multimédia partagés.
* Lié à transmission, Nextcloud et toute autre application qui utilise les répertoires multimédia.
**Version incluse :** 1.3.0~ynh1
## Documentations et ressources
* Site officiel de lapp : <http://minidlna.sourceforge.net>

View file

@ -1,11 +1,5 @@
# MiniDLNA
MiniDLNA is a lightweight [DLNA](https://fr.wikipedia.org/wiki/Digital_Living_Network_Alliance) server.
It allows to easily share multimedia files with any compatible devices present on the LAN.
MiniDLNA does not have a graphical interface, but does not require any special configuration.
### What multimedia files are shared?
MiniDLNA is sharing the folder `/home/yunohost.multimedia/share`, which is common to each user in `/home/$USER/Multimedia/Share`.
[More information about multimedia files here.](https://github.com/YunoHost-Apps/yunohost.multimedia)

View file

@ -1,11 +1,4 @@
# MiniDLNA
MiniDLNA est un serveur [DLNA](https://fr.wikipedia.org/wiki/Digital_Living_Network_Alliance) ultra léger.
Il permet de partager très simplement les fichiers multimédias avec tout les appareils compatibles présent sur le réseau local.
Minidlna ne dispose pas d'une interface graphique, mais ne nécessite pas de configuration particulière.
### Quels fichiers multimédias sont partagés?
### Quels fichiers multimédias sont partagés ?
Minidlna partage le dossier `/home/yunohost.multimedia/share`, qui est commun à chaque utilisateur dans le dossier `/home/$USER/Multimedia/Share`.

View file

@ -1,21 +0,0 @@
;; Test paquet stable
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=0
setup_nourl=1
setup_private=0
setup_public=0
upgrade=1
#upgrade=1 from_commit=2c107b09144c9829be5cc94b202d0f766b2a0db4
#upgrade=1 from_commit=7fa6b0a84e0cb24cd5a26d2f5d64f68875862f42
backup_restore=1
multi_instance=0
change_url=0
;;; Upgrade options
; commit=2c107b09144c9829be5cc94b202d0f766b2a0db4
name=01 May 2017 2c107b09144c9829be5cc94b202d0f766b2a0db4
manifest_arg=version=A. Version of the Debian repositories - recommended&
; commit=7fa6b0a84e0cb24cd5a26d2f5d64f68875862f42
name=20 Jun 2019 7fa6b0a84e0cb24cd5a26d2f5d64f68875862f42
manifest_arg=version=B. Latest version available for Debian&

View file

@ -1,19 +0,0 @@
version = "0.1"
name = "Minidlna configuration panel"
[main]
name = "Minidlna configuration"
[main.minidlna_configuration]
name = "Minidlna configuration"
[main.minidlna_configuration.root_container]
ask = "Type of directory shown to the clients ?"
choices = ["Standard container", "Browse Directory", "Music", "Pictures", "Video"]
default = "Browse Directory"
[main.minidlna_configuration.friendly_name]
ask = "Name of DLNA server shown to clients ?"
type = "text"
default = "Yunohost DLNA"

5
doc/ADMIN.md Normal file
View file

@ -0,0 +1,5 @@
## Configuration
Edit the file `/etc/minidlna.conf` to adjust the configuration of MiniDLNA.
MiniDLNA is going to serve the files present in the directory `/home/yunohost.multimedia/share

5
doc/ADMIN_fr.md Normal file
View file

@ -0,0 +1,5 @@
## Configuration
Éditez le fichier `/etc/minidlna.conf` pour ajuster la configuration de MiniDLNA.
MiniDLNA va servir les fichiers présents dans le répertoire `/home/yunohost.multimedia/share`

View file

@ -1 +1,8 @@
MiniDLNA is a simple media server software, with the aim of being fully compliant with DLNA/UPnP-AV clients.
MiniDLNA is a lightweight [DLNA](https://fr.wikipedia.org/wiki/Digital_Living_Network_Alliance) server.
It allows to easily share multimedia files with any compatible devices present on the LAN.
MiniDLNA does not have a graphical interface, but does not require any special configuration.
## YunoHost specific features
* Use shared Multimedia Directories
* Linked to transmission, Nextcloud and all other app which use Multimedia Directories.

View file

@ -1 +1,8 @@
MiniDLNA est un simple serveur multimédia, dont le but est d'être entièrement compatible avec les clients DLNA/UPnP-AV.
MiniDLNA est un serveur [DLNA](https://fr.wikipedia.org/wiki/Digital_Living_Network_Alliance) ultra léger.
Il permet de partager très simplement les fichiers multimédias avec tout les appareils compatibles présent sur le réseau local.
Minidlna ne dispose pas d'une interface graphique, mais ne nécessite pas de configuration particulière.
## Fonctionnalités spécifiques à YunoHost
* Utilise les répertoires multimédia partagés.
* Lié à transmission, Nextcloud et toute autre application qui utilise les répertoires multimédia.

View file

@ -1,8 +0,0 @@
## Configuration
Edit the file `/etc/minidlna.conf` to adjust the configuration of MiniDLNA.
## YunoHost specific features
* Use shared Multimedia Directories
* Linked to transmission, Nextcloud and all other app which use Multimedia Directories.

View file

@ -1,8 +0,0 @@
## Configuration
Éditez le fichier `/etc/minidlna.conf` pour ajuster la configuration de MiniDLNA.
## Fonctionnalités spécifiques à YunoHost
* Utilise les répertoires multimédia partagés.
* Lié à transmission, Nextcloud et toute autre application qui utilise les répertoires multimédia.

View file

@ -1,32 +0,0 @@
{
"name": "MiniDLNA",
"id": "minidlna",
"packaging_format": 1,
"description": {
"en": "Light DLNA server to share media files over the LAN",
"fr": "Serveur DLNA léger pour partager les fichiers multimédia sur le réseau local"
},
"version": "1.0~ynh9",
"url": "http://minidlna.sourceforge.net/",
"upstream": {
"license": "GPL-2.0",
"website": "http://minidlna.sourceforge.net"
},
"license": "GPL-2.0",
"maintainer": {
"name": "",
"email": ""
},
"previous_maintainers": [{
"name": "Maniack Crudelis",
"email": "maniackc_dev@crudelis.fr"
}],
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [],
"arguments": {
"install" : []
}
}

46
manifest.toml Normal file
View file

@ -0,0 +1,46 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "minidlna"
name = "MiniDLNA"
description.en = "Light DLNA server to share media files over the LAN"
description.fr = "Serveur DLNA léger pour partager les fichiers multimédia sur le réseau local"
version = "1.3.0~ynh1"
maintainers = []
[upstream]
license = "GPL-2.0"
website = "http://minidlna.sourceforge.net"
cpe = "cpe:2.3:a:readymedia_project:readymedia"
[integration]
yunohost = ">= 11.2"
architectures = "all"
multi_instance = false
ldap = false
sso = false
disk = "50M"
ram.build = "250M"
ram.runtime = "50M"
[install]
[resources]
[resources.system_user]
[resources.install_dir]
[resources.permissions]
[resources.ports]
main.default = 48200
main.exposed = "TCP"
[resources.apt]
packages = "minidlna"

View file

@ -4,20 +4,16 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="minidlna"
#=================================================
# PACKAGE CHECK BYPASSING...
#=================================================
IS_PACKAGE_CHECK () {
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]
then
return 0
else
return 1
fi
IS_PACKAGE_CHECK() {
if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then
return 0
else
return 1
fi
}
#=================================================
@ -28,142 +24,3 @@ IS_PACKAGE_CHECK () {
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
# Send an email to inform the administrator
#
# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
# | arg: -m --app_message= - The file with the content to send to the administrator.
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
# example: "root admin@domain"
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
# example: "root admin@domain user1 user2"
# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
ynh_send_readme_to_admin() {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
local app_message
local recipients
local type
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
app_message="${app_message:-}"
recipients="${recipients:-root}"
type="${type:-install}"
# Get the value of admin_mail_html
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
admin_mail_html="${admin_mail_html:-0}"
# Retrieve the email of users
find_mails () {
local list_mails="$1"
local mail
local recipients=" "
# Read each mail in argument
for mail in $list_mails
do
# Keep root or a real email address as it is
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
then
recipients="$recipients $mail"
else
# But replace an user name without a domain after by its email
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
then
recipients="$recipients $mail"
fi
fi
done
echo "$recipients"
}
recipients=$(find_mails "$recipients")
# Subject base
local mail_subject="☁️🆈🅽🅷☁️: \`$app\`"
# Adapt the subject according to the type of mail required.
if [ "$type" = "backup" ]; then
mail_subject="$mail_subject has just been backup."
elif [ "$type" = "change_url" ]; then
mail_subject="$mail_subject has just been moved to a new URL!"
elif [ "$type" = "remove" ]; then
mail_subject="$mail_subject has just been removed!"
elif [ "$type" = "restore" ]; then
mail_subject="$mail_subject has just been restored!"
elif [ "$type" = "upgrade" ]; then
mail_subject="$mail_subject has just been upgraded!"
else # install
mail_subject="$mail_subject has just been installed!"
fi
local mail_message="This is an automated message from your beloved YunoHost server.
Specific information for the application $app.
$(if [ -n "$app_message" ]
then
cat "$app_message"
else
echo "...No specific information..."
fi)
---
Automatic diagnosis data from YunoHost
__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
# Store the message into a file for further modifications.
echo "$mail_message" > mail_to_send
# If a html email is required. Apply html tags to the message.
if [ "$admin_mail_html" -eq 1 ]
then
# Insert 'br' tags at each ending of lines.
ynh_replace_string "$" "<br>" mail_to_send
# Insert starting HTML tags
sed --in-place '1s@^@<!DOCTYPE html>\n<html>\n<head></head>\n<body>\n@' mail_to_send
# Keep tabulations
ynh_replace_string " " "\&#160;\&#160;" mail_to_send
ynh_replace_string "\t" "\&#160;\&#160;" mail_to_send
# Insert url links tags
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
# Insert pre tags
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
# Insert finishing HTML tags
echo -e "\n</body>\n</html>" >> mail_to_send
# Otherwise, remove tags to keep a plain text.
else
# Remove URL tags
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
# Remove PRE tags
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
fi
# Define binary to use for mail command
if [ -e /usr/bin/bsd-mailx ]
then
local mail_bin=/usr/bin/bsd-mailx
else
local mail_bin=/usr/bin/mail.mailutils
fi
if [ "$admin_mail_html" -eq 1 ]
then
content_type="text/html"
else
content_type="text/plain"
fi
# Send the email to the recipients
cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
}

View file

@ -6,24 +6,9 @@
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# 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
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================

View file

@ -9,26 +9,13 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
app=$YNH_APP_INSTANCE_NAME
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=overwrite_settings --value=1
ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
ynh_app_setting_set --app="$app" --key=overwrite_settings --value=1
ynh_app_setting_set --app="$app" --key=admin_mail_html --value=1
#=================================================
# STANDARD MODIFICATIONS
@ -37,21 +24,8 @@ ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
#=================================================
ynh_script_progression --message="Configuring firewall..." --weight=15
# Find a free port
port=$(ynh_find_port --port=48200)
# Open ports
ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port
# Discovery Protocol SSDP for UPNP.
ynh_exec_fully_quiet yunohost firewall allow --no-upnp UDP 1900
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=45
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC SETUP
@ -65,14 +39,13 @@ ynh_multimedia_build_main_dir
#=================================================
# INCREASE INOTIFY'S LIMITS
#=================================================
ynh_script_progression --message="Increasing inotify's limits..."
ynh_script_progression --message="Increasing inotify's limits..." --weight=1
# Increase the maximum number of files inotify can monitor.
cp -a ../conf/90-inotify_minidlna.conf /etc/sysctl.d/
# Then, reload the kernel configuration.
if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
if ! IS_PACKAGE_CHECK; then # LXC doesn't allow sysctl to play with kernel options.
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi
#=================================================
@ -83,11 +56,11 @@ ynh_script_progression --message="Configuring MiniDLNA..." --weight=2
ynh_replace_string --match_string="^#*media_dir=.*" --replace_string="media_dir=/home/yunohost.multimedia/share" --target_file=/etc/minidlna.conf
ynh_replace_string --match_string="^#*port=.*" --replace_string="port=$port" --target_file=/etc/minidlna.conf
friendly_name="Yunohost DLNA"
ynh_app_setting_set --app=$app --key=friendly_name --value="$friendly_name"
ynh_app_setting_set --app="$app" --key=friendly_name --value="$friendly_name"
ynh_replace_string --match_string="^#*friendly_name=.*" --replace_string="friendly_name=$friendly_name" --target_file=/etc/minidlna.conf
root_container="B"
ynh_replace_string --match_string="^#*root_container=.*" --replace_string="root_container=$root_container" --target_file=/etc/minidlna.conf
ynh_app_setting_set --app=$app --key=root_container --value="$root_container"
ynh_app_setting_set --app="$app" --key=root_container --value="$root_container"
ynh_replace_string --match_string="^#wide_links=.*" --replace_string="wide_links=yes" --target_file=/etc/minidlna.conf
# Calculate and store the config file checksum into the app settings
@ -96,9 +69,9 @@ ynh_store_file_checksum --file="/etc/minidlna.conf"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --log="/var/log/$app.log" --needs_exposed_ports="1900"
yunohost service add "$app" --log="/var/log/$app.log" --needs_exposed_ports="1900"
#=================================================
# START SYSTEMD SERVICE
@ -106,23 +79,7 @@ yunohost service add $app --log="/var/log/$app.log" --needs_exposed_ports="1900"
ynh_script_progression --message="Starting a systemd service..." --weight=4
# Start a systemd service
ynh_systemd_action --service_name=$app --action="restart" --log_path="/var/log/$app.log"
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
echo "You can find a config file at /etc/minidlna.conf
MiniDLNA is going to serve the files present in the directory /home/yunohost.multimedia/share
Please have a look to the documentation to learn more how to use MiniDLNA, https://yunohost.org/#/app_minidlna
" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=install
ynh_systemd_action --service_name="$app" --action="restart" --log_path="/var/log/$app.log"
#=================================================
# END OF SCRIPT

View file

@ -9,15 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# STANDARD REMOVE
#=================================================
@ -25,30 +16,15 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
if ynh_exec_warn_less yunohost service status $app >/dev/null; then
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
ynh_exec_fully_quiet yunohost firewall disallow UDP 1900
#=================================================
@ -56,15 +32,15 @@ ynh_exec_fully_quiet yunohost firewall disallow UDP 1900
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
ynh_script_progression --message="Removing various files..." --weight=1
if [ -e "/etc/sysctl.d/90-inotify_minidlna.conf" ]; then
ynh_secure_remove --file="/etc/sysctl.d/90-inotify_minidlna.conf"
# Reload the kernel configuration.
if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi
ynh_secure_remove --file="/etc/sysctl.d/90-inotify_minidlna.conf"
# Reload the kernel configuration.
if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi
fi
#=================================================

View file

@ -10,25 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# SPECIFIC RESTORE
#=================================================
@ -36,7 +17,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
ynh_script_progression --message="Configuring firewall..." --weight=15
ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port
# Discovery Protocol SSDP for UPNP.
ynh_exec_fully_quiet yunohost firewall allow --no-upnp UDP 1900
@ -47,56 +27,32 @@ ynh_script_progression --message="Creating yunohost.multimedia directory..." --w
ynh_multimedia_build_main_dir
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=45
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_script_progression --message="Restoring various files..." --weight=1
ynh_restore_file --origin_path="/etc/sysctl.d/90-inotify_minidlna.conf"
if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
if ! IS_PACKAGE_CHECK; then # LXC doesn't allow sysctl to play with kernel options.
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi
# Delete the current config of minidlna, in order to replace it by the version from the backup
ynh_secure_remove --file="/etc/minidlna.conf"
ynh_restore_file --origin_path="/etc/minidlna.conf"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --log="/var/log/$app.log" --needs_exposed_ports="1900"
yunohost service add "$app" --log="/var/log/$app.log" --needs_exposed_ports="1900"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app.log"
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
echo "You can find a config file at /etc/minidlna.conf
MiniDLNA is going to serve the files present in the directory /home/yunohost.multimedia/share
Please have a look to the documentation to learn more how to use MiniDLNA, https://yunohost.org/#/app_minidlna
" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=restore
ynh_systemd_action --service_name="$app" --action=restart --log_path="/var/log/$app.log"
#=================================================
# END OF SCRIPT

View file

@ -9,77 +9,41 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME
version=$(ynh_app_setting_get --app=$app --key=version)
port=$(ynh_app_setting_get --app=$app --key=port)
overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
root_container=$(ynh_app_setting_get --app=$app --key=root_container)
friendly_name=$(ynh_app_setting_get --app=$app --key=friendly_name)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# 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..."
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If overwrite_settings doesn't exist, create it
if [ -z "$overwrite_settings" ]; then
if [ -z "${overwrite_settings:-}" ]; then
overwrite_settings=1
ynh_app_setting_set --app=$app --key=overwrite_settings --value=$overwrite_settings
fi
# If root_container doesn't exist, create it
if [ -z "$root_container" ]; then
if [ -z "${root_container:-}" ]; then
root_container="B"
ynh_app_setting_set --app=$app --key=root_container --value=$root_container
fi
# If friendly_name doesn't exist, create it
if [ -z "$friendly_name" ]; then
friendly_name="Yunohost DLNA"
if [ -z "${friendly_name:-}" ]; then
friendly_name="YunoHost DLNA"
ynh_app_setting_set --app=$app --key=friendly_name --value=$friendly_name
fi
# If version exists, remove the backport source list, as it's no longer used.
if [ -n "$version" ]; then
if [ -n "${version:-}" ]; then
ynh_secure_remove --file="/etc/apt/sources.list.d/minidlna.list"
ynh_app_setting_delete --app=$app --key=version
fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=3
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC UPGRADE
#=================================================
@ -126,7 +90,7 @@ fi
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --log="/var/log/$app.log" --needs_exposed_ports="1900"
@ -137,22 +101,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=7
ynh_systemd_action --service_name=$app --action="restart" --log_path="/var/log/$app.log"
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
echo "You can find a config file at /etc/minidlna.conf
MiniDLNA is going to serve the files present in the directory /home/yunohost.multimedia/share
Please have a look to the documentation to learn more how to use MiniDLNA, https://yunohost.org/#/app_minidlna
" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=upgrade
#=================================================
# END OF SCRIPT
#=================================================

9
tests.toml Normal file
View file

@ -0,0 +1,9 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------