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 #27 from YunoHost-Apps/example

Example
This commit is contained in:
yalh76 2022-03-14 20:27:22 +01:00 committed by GitHub
commit deb45495a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 166 additions and 179 deletions

View file

@ -1,3 +1,8 @@
<!--
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.
-->
# MiniDLNA for YunoHost
[![Integration level](https://dash.yunohost.org/integration/minidlna.svg)](https://dash.yunohost.org/appci/app/minidlna) ![](https://ci-apps.yunohost.org/ci/badges/minidlna.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/minidlna.maintain.svg)
@ -5,58 +10,38 @@
*[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install MiniDLNA 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.*
> *This package allows you to install MiniDLNA 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
MiniDLNA is a simple media server software, with the aim of being fully compliant with DLNA/UPnP-AV clients.
**Shipped version:** Debian repositories versions. Currently 1.2.1
## Screenshots
**Shipped version:** 1.0~ynh8
## Demo
No demo available.
## Disclaimers / important information
## Configuration
Edit the file `/etc/minidlna.conf` to adjust the configuration of MiniDLNA.
## Documentation
* YunoHost documentation: https://yunohost.org/#/app_minidlna
## YunoHost specific features
* Use shared Multimedia Directories
* Linked to transmission, Nextcloud and all other app which use Multimedia Directories.
#### Multi-users support
## Documentation and resources
Not relevant.
* Official app website: http://minidlna.sourceforge.net
* YunoHost documentation for this app: https://yunohost.org/app_minidlna
* Report a bug: https://github.com/YunoHost-Apps/minidlna_ynh/issues
#### Supported architectures
## Developer info
* x86-64 - [![](https://ci-apps.yunohost.org/ci/logs/minidlna%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/minidlna/)
* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/minidlna%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/minidlna/)
## Limitations
## Additionnal informations
## Links
* Report a bug: https://github.com/YunoHost-Apps/minidlna_ynh/issues
* MiniDLNA website: http://minidlna.sourceforge.net/
* YunoHost website: https://yunohost.org/
---
## Developers infos
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing).
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
@ -64,3 +49,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/minidlna_ynh/tree/tes
or
sudo yunohost app upgrade minidlna -u https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

View file

@ -4,63 +4,46 @@
[![Installer MiniDLNA avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=minidlna)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer MiniDLNA rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/#/install_fr) pour savoir comment l'installer et en profiter.*
> *Ce package vous permet d'installer MiniDLNA 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.*
## Résumé
## Vue d'ensemble
MiniDLNA est un simple serveur multimédia, dont le but est d'être entièrement compatible avec les clients DLNA/UPnP-AV.
**Version embarquée :** Versions des dépôts Debian. Actuellement 1.2.1
## Captures d'écran
**Version incluse :** 1.0~ynh8
## Démo
Aucune démo pour cette application.
## Avertissements / informations importantes
## Configuration
Éditez le fichier `/etc/minidlna.conf` pour ajuster la configuration de MiniDLNA.
## Documentation
* Documentation YunoHost : https://yunohost.org/#/app_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.
#### Support multi-utilisateurs
## Documentations et ressources
Non applicable.
* Site officiel de l'app : http://minidlna.sourceforge.net
* Documentation YunoHost pour cette app : https://yunohost.org/app_minidlna
* Signaler un bug : https://github.com/YunoHost-Apps/minidlna_ynh/issues
#### Architectures supportées.
* x86-64 - [![](https://ci-apps.yunohost.org/ci/logs/minidlna%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/minidlna/)
* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/minidlna%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/minidlna/)
## Limitations
## Informations additionnelles
## Liens
* Reporter un bug : https://github.com/YunoHost-Apps/minidlna_ynh/issues
* Site de MiniDLNA : http://minidlna.sourceforge.net/
* Site de YunoHost : https://yunohost.org/
---
## Informations à l'intention des développeurs
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing).
Pour tester la branche testing, merci de procéder ainsi.
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing --debug
ou
sudo yunohost app upgrade minidlna -u https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
MiniDLNA is a simple media server software, with the aim of being fully compliant with DLNA/UPnP-AV clients.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
MiniDLNA est un simple serveur multimédia, dont le but est d'être entièrement compatible avec les clients DLNA/UPnP-AV.

8
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,8 @@
## 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.

8
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,8 @@
## 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.

0
doc/screenshots/.gitkeep Normal file
View file

View file

@ -6,8 +6,12 @@
"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~ynh7",
"version": "1.0~ynh8",
"url": "http://minidlna.sourceforge.net/",
"upstream": {
"license": "GPL-2.0",
"website": "http://minidlna.sourceforge.net"
},
"license": "GPL-2.0",
"maintainer": {
"name": "",
@ -18,7 +22,7 @@
"email": "maniackc_dev@crudelis.fr"
}],
"requirements": {
"yunohost": ">= 4.2.4"
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [],

View file

@ -1,30 +1,11 @@
#!/bin/bash
#=================================================
# PERSONAL HELPERS
# COMMON VARIABLES
#=================================================
#=================================================
# BACKUP
#=================================================
HUMAN_SIZE () { # Transforme une taille en Ko en une taille lisible pour un humain
human=$(numfmt --to=iec --from-unit=1K $1)
echo $human
}
CHECK_SIZE () { # Vérifie avant chaque backup que l'espace est suffisant
file_to_analyse=$1
backup_size=$(du --summarize "$file_to_analyse" | cut -f1)
free_space=$(df --output=avail "/home/yunohost.backup" | sed 1d)
if [ $free_space -le $backup_size ]
then
ynh_print_err "Espace insuffisant pour sauvegarder $file_to_analyse."
ynh_print_err "Espace disponible: $(HUMAN_SIZE $free_space)"
ynh_die "Espace nécessaire: $(HUMAN_SIZE $backup_size)"
fi
}
# dependencies used by the app
pkg_dependencies="minidlna"
#=================================================
# PACKAGE CHECK BYPASSING...

View file

@ -33,9 +33,9 @@ ynh_script_progression --message="Resetting the database..." --weight=9
# Get the last value for `db_dir` in the config file of minidlna
db_directory=$(tac /etc/minidlna.conf | grep --max-count=1 "db_dir=" | cut -d'=' -f 2)
ynh_systemd_action --action=stop --service_name=minidlna
ynh_systemd_action --action=stop --service_name=$app
ynh_secure_remove --file="$db_directory/files.db"
ynh_systemd_action --action=start --service_name=minidlna
ynh_systemd_action --action=start --service_name=$app
#=================================================
# END OF SCRIPT

View file

@ -6,6 +6,7 @@
# 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
@ -29,15 +30,11 @@ app=$YNH_APP_INSTANCE_NAME
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP OF INOTIFY'S CONFIG
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/sysctl.d/90-inotify_minidlna.conf"
#=================================================
# BACKUP OF MINIDLNA CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/minidlna.conf"
#=================================================

View file

@ -118,7 +118,7 @@ apply_config() {
if [ $restart_minidlna -eq 1 ]
then
ynh_systemd_action --action=restart --service_name=minidlna
ynh_systemd_action --service_name=$app --action="restart"
fi
# Set overwrite_settings

View file

@ -1,7 +1,7 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -10,7 +10,7 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE FAILURE OF THE SCRIPT
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
@ -46,6 +46,15 @@ ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port
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
#=================================================
# CREATE YUNOHOST.MULTIMEDIA DIRECTORY
#=================================================
@ -53,15 +62,6 @@ ynh_script_progression --message="Creating yunohost.multimedia directory..." --w
ynh_multimedia_build_main_dir
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL MINIDLNA
#=================================================
ynh_script_progression --message="Installing MiniDLNA..." --weight=45
ynh_install_app_dependencies minidlna
#=================================================
# INCREASE INOTIFY'S LIMITS
#=================================================
@ -75,12 +75,6 @@ then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add minidlna --log="/var/log/minidlna.log" --needs_exposed_ports="1900"
#=================================================
# CONFIGURE MINIDLNA
#=================================================
@ -100,11 +94,19 @@ ynh_replace_string --match_string="^#wide_links=.*" --replace_string="wide_links
ynh_store_file_checksum --file="/etc/minidlna.conf"
#=================================================
# RESTART MINIDLNA
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Restarting MiniDLNA..." --weight=4
ynh_script_progression --message="Integrating service in YunoHost..."
ynh_systemd_action --action=restart --service_name=minidlna
yunohost service add $app --log="/var/log/$app.log" --needs_exposed_ports="1900"
#=================================================
# START SYSTEMD SERVICE
#=================================================
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
@ -130,4 +132,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of MiniDLNA completed" --last
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -1,7 +1,7 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -21,37 +21,42 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Check if the service is declared in YunoHost
if ynh_exec_fully_quiet yunohost service status minidlna
# 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 MiniDLNA service..."
yunohost service remove minidlna
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi
#=================================================
# CLOSE PORTS
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Closing ports $port and 1900..." --weight=15
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 TCP $port
ynh_exec_fully_quiet yunohost firewall disallow UDP 1900
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE MINIDNLA
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing MiniDLNA..." --weight=6
ynh_remove_app_dependencies
#=================================================
# REMOVE INOTIFY'S CONFIG
#=================================================
ynh_script_progression --message="Removing inotify's config..."
ynh_script_progression --message="Removing various files..."
if [ -e "/etc/sysctl.d/90-inotify_minidlna.conf" ]; then
ynh_secure_remove --file="/etc/sysctl.d/90-inotify_minidlna.conf"
@ -66,4 +71,4 @@ fi
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of MiniDLNA completed" --last
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -6,6 +6,7 @@
# 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
@ -13,13 +14,16 @@ 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 settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -44,38 +48,39 @@ ynh_script_progression --message="Creating yunohost.multimedia directory..." --w
ynh_multimedia_build_main_dir
#=================================================
# INSTALL MINIDLNA
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing MiniDLNA" --weight=45
ynh_script_progression --message="Reinstalling dependencies..." --weight=45
ynh_install_app_dependencies minidlna
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE INOTIFY'S CONFIG
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring inotify's config..."
ynh_script_progression --message="Restoring various files..."
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
fi
#=================================================
# RESTORE MINIDLNA CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring MiniDLNA configuration..." --weight=7
# 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"
ynh_systemd_action --action=restart --service_name=minidlna
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="/var/log/$app.log" --needs_exposed_ports="1900"
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
yunohost service add minidlna --log="/var/log/minidlna.log" --needs_exposed_ports="1900"
ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app.log"
#=================================================
# SEND A README FOR THE ADMIN
@ -101,4 +106,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for MiniDLNA" --last
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -1,7 +1,7 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -25,9 +25,25 @@ 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
#=================================================
@ -58,19 +74,14 @@ if [ -n "$version" ]; then
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=2
ynh_script_progression --message="Upgrading dependencies..." --weight=3
# 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
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPGRADE THE YUNOHOST.MULTIMEDIA DIRECTORY
#=================================================
@ -78,13 +89,6 @@ ynh_script_progression --message="Upgrading the yunohost.multimedia directory...
ynh_multimedia_build_main_dir
#=================================================
# UPGRADE MINIDLNA
#=================================================
ynh_script_progression --message="Upgrading MiniDLNA..." --weight=3
ynh_install_app_dependencies minidlna
#=================================================
# INCREASE INOTIFY'S LIMITS
#=================================================
@ -98,12 +102,6 @@ then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add minidlna --log="/var/log/minidlna.log" --needs_exposed_ports="1900"
#=================================================
# CONFIGURE MINIDLNA
#=================================================
@ -126,11 +124,18 @@ then
fi
#=================================================
# RESTART MINIDLNA'S SERVICE
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Restarting MiniDLNA..." --weight=7
ynh_script_progression --message="Integrating service in YunoHost..."
ynh_systemd_action --action=restart --service_name=minidlna
yunohost service add $app --log="/var/log/$app.log" --needs_exposed_ports="1900"
#=================================================
# START SYSTEMD SERVICE
#=================================================
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
@ -164,4 +169,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of MiniDLNA completed" --last
ynh_script_progression --message="Upgrade of $app completed" --last