mirror of
https://github.com/YunoHost-Apps/minidlna_ynh.git
synced 2024-09-03 19:36:34 +02:00
61 lines
2.3 KiB
Bash
61 lines
2.3 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# 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
|
|
|
|
#=================================================
|
|
# SPECIFIC RESTORE
|
|
#=================================================
|
|
# OPEN PORTS
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring firewall..." --weight=15
|
|
|
|
# Discovery Protocol SSDP for UPNP.
|
|
ynh_exec_fully_quiet yunohost firewall allow --no-upnp UDP 1900
|
|
|
|
#=================================================
|
|
# CREATE YUNOHOST.MULTIMEDIA DIRECTORY
|
|
#=================================================
|
|
ynh_script_progression --message="Creating yunohost.multimedia directory..." --weight=6
|
|
|
|
ynh_multimedia_build_main_dir
|
|
|
|
#=================================================
|
|
# RESTORE 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; 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..." --weight=1
|
|
|
|
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=1
|
|
|
|
ynh_systemd_action --service_name="$app" --action=restart --log_path="/var/log/$app.log"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|