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

Apply last example_ynh
This commit is contained in:
yalh76 2022-03-16 00:17:07 +01:00 committed by GitHub
commit 7570b11b22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 237 additions and 179 deletions

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

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

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

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

View file

@ -1,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 # 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) [![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)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install MiniDLNA quickly and simply on a YunoHost server. > *This package allows 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.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
MiniDLNA is a simple media server software, with the aim of being fully compliant with DLNA/UPnP-AV clients. 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 ## Configuration
Edit the file `/etc/minidlna.conf` to adjust the configuration of MiniDLNA. Edit the file `/etc/minidlna.conf` to adjust the configuration of MiniDLNA.
## Documentation
* YunoHost documentation: https://yunohost.org/#/app_minidlna
## YunoHost specific features ## YunoHost specific features
* Use shared Multimedia Directories * Use shared Multimedia Directories
* Linked to transmission, Nextcloud and all other app which use 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/) Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing).
* 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).
To try the testing branch, please proceed like that. 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 or
sudo yunohost app upgrade minidlna -u https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing --debug 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) [![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)* *[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. > *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.* 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. 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 ## Configuration
Éditez le fichier `/etc/minidlna.conf` pour ajuster la configuration de MiniDLNA. É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 ## Fonctionnalités spécifiques à YunoHost
* Utilise les répertoires multimédia partagés. * Utilise les répertoires multimédia partagés.
* Lié à transmission, Nextcloud et toute autre application qui utilise les répertoires multimédia. * 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. ## Informations pour les développeurs
* 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
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing). 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 sudo yunohost app install https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade minidlna -u https://github.com/YunoHost-Apps/minidlna_ynh/tree/testing --debug 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", "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" "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/", "url": "http://minidlna.sourceforge.net/",
"upstream": {
"license": "GPL-2.0",
"website": "http://minidlna.sourceforge.net"
},
"license": "GPL-2.0", "license": "GPL-2.0",
"maintainer": { "maintainer": {
"name": "", "name": "",
@ -18,7 +22,7 @@
"email": "maniackc_dev@crudelis.fr" "email": "maniackc_dev@crudelis.fr"
}], }],
"requirements": { "requirements": {
"yunohost": ">= 4.2.4" "yunohost": ">= 4.3.0"
}, },
"multi_instance": false, "multi_instance": false,
"services": [], "services": [],

View file

@ -1,30 +1,11 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# PERSONAL HELPERS # COMMON VARIABLES
#================================================= #=================================================
#================================================= # dependencies used by the app
# BACKUP pkg_dependencies="minidlna"
#=================================================
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
}
#================================================= #=================================================
# PACKAGE CHECK BYPASSING... # 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 # 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) 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_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 # END OF SCRIPT

View file

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -29,15 +30,11 @@ app=$YNH_APP_INSTANCE_NAME
ynh_print_info --message="Declaring files to be backed up..." 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" ynh_backup --src_path="/etc/sysctl.d/90-inotify_minidlna.conf"
#=================================================
# BACKUP OF MINIDLNA CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/minidlna.conf" ynh_backup --src_path="/etc/minidlna.conf"
#================================================= #=================================================

View file

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

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# GENERIC STARTING # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
@ -10,7 +10,7 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE FAILURE OF THE SCRIPT # MANAGE SCRIPT FAILURE
#================================================= #=================================================
# Exit if an error occurs during the execution of the script # 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_exec_fully_quiet yunohost firewall allow --no-upnp UDP 1900
ynh_app_setting_set --app=$app --key=port --value=$port 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 # CREATE YUNOHOST.MULTIMEDIA DIRECTORY
#================================================= #=================================================
@ -53,15 +62,6 @@ ynh_script_progression --message="Creating yunohost.multimedia directory..." --w
ynh_multimedia_build_main_dir 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 # INCREASE INOTIFY'S LIMITS
#================================================= #=================================================
@ -75,12 +75,6 @@ then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi fi
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add minidlna --log="/var/log/minidlna.log" --needs_exposed_ports="1900"
#================================================= #=================================================
# CONFIGURE MINIDLNA # 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" 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 # 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 # 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 #!/bin/bash
#================================================= #=================================================
# GENERIC STARTING # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
@ -21,37 +21,42 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
# REMOVE SERVICE FROM ADMIN PANEL # REMOVE SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
# Check if the service is declared in YunoHost # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_fully_quiet yunohost service status minidlna if ynh_exec_warn_less yunohost service status $app >/dev/null
then then
ynh_script_progression --message="Removing MiniDLNA service..." ynh_script_progression --message="Removing $app service integration..."
yunohost service remove minidlna yunohost service remove $app
fi 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 ynh_exec_fully_quiet yunohost firewall disallow UDP 1900
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
# REMOVE MINIDNLA # REMOVE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Removing MiniDLNA..." --weight=6 ynh_script_progression --message="Removing various files..."
ynh_remove_app_dependencies
#=================================================
# REMOVE INOTIFY'S CONFIG
#=================================================
ynh_script_progression --message="Removing inotify's config..."
if [ -e "/etc/sysctl.d/90-inotify_minidlna.conf" ]; then if [ -e "/etc/sysctl.d/90-inotify_minidlna.conf" ]; then
ynh_secure_remove --file="/etc/sysctl.d/90-inotify_minidlna.conf" ynh_secure_remove --file="/etc/sysctl.d/90-inotify_minidlna.conf"
@ -66,4 +71,4 @@ fi
# END OF SCRIPT # 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 # IMPORT GENERIC HELPERS
#================================================= #=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,13 +14,16 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -44,38 +48,39 @@ ynh_script_progression --message="Creating yunohost.multimedia directory..." --w
ynh_multimedia_build_main_dir 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" 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. if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi 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 # 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_secure_remove --file="/etc/minidlna.conf"
ynh_restore_file --origin_path="/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 # 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 # 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 #!/bin/bash
#================================================= #=================================================
# GENERIC STARTING # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
@ -25,9 +25,25 @@ friendly_name=$(ynh_app_setting_get --app=$app --key=friendly_name)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) 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 # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -58,19 +74,14 @@ if [ -n "$version" ]; then
fi 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_install_app_dependencies $pkg_dependencies
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
#=================================================
# SPECIFIC UPGRADE
#================================================= #=================================================
# UPGRADE THE YUNOHOST.MULTIMEDIA DIRECTORY # UPGRADE THE YUNOHOST.MULTIMEDIA DIRECTORY
#================================================= #=================================================
@ -78,13 +89,6 @@ ynh_script_progression --message="Upgrading the yunohost.multimedia directory...
ynh_multimedia_build_main_dir ynh_multimedia_build_main_dir
#=================================================
# UPGRADE MINIDLNA
#=================================================
ynh_script_progression --message="Upgrading MiniDLNA..." --weight=3
ynh_install_app_dependencies minidlna
#================================================= #=================================================
# INCREASE INOTIFY'S LIMITS # INCREASE INOTIFY'S LIMITS
#================================================= #=================================================
@ -98,12 +102,6 @@ then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi fi
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add minidlna --log="/var/log/minidlna.log" --needs_exposed_ports="1900"
#================================================= #=================================================
# CONFIGURE MINIDLNA # CONFIGURE MINIDLNA
#================================================= #=================================================
@ -126,11 +124,18 @@ then
fi 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 # 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 # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of MiniDLNA completed" --last ynh_script_progression --message="Upgrade of $app completed" --last