mirror of
https://github.com/YunoHost-Apps/minidlna_ynh.git
synced 2024-09-03 19:36:34 +02:00
Apply last example_ynh
This commit is contained in:
parent
721a17e944
commit
b907359818
15 changed files with 133 additions and 116 deletions
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal 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
1
doc/DESCRIPTION_fr.md
Normal 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
8
doc/DISCLAIMER.md
Normal 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
8
doc/DISCLAIMER_fr.md
Normal 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
0
doc/screenshots/.gitkeep
Normal 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": [],
|
||||
|
|
|
@ -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...
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue