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

Update to last standard

This commit is contained in:
maniack 2020-03-14 20:28:04 +01:00
parent 438fbf903e
commit a6b7cb708c
15 changed files with 131 additions and 144 deletions

View file

@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
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.1.2 and 1.1.6 **Shipped version:** Debian repositories versions. Currently 1.1.6 and 1.2.1
## Screenshots ## Screenshots
@ -39,9 +39,9 @@ Not relevant.
#### Supported architectures #### Supported architectures
* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/minidlna%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/minidlna/) * x86-64b - [![](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%28Community%29.svg)](https://ci-apps-arm.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/)
* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/minidlna%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/minidlna/) * Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/minidlna%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/minidlna/)
## Limitations ## Limitations

View file

@ -12,7 +12,7 @@ Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/#/inst
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.1.2 et 1.1.6 **Version embarquée:** Versions des dépôts Debian. Actuellement 1.1.6 et 1.2.1
## Captures d'écran ## Captures d'écran
@ -39,9 +39,9 @@ Non applicable.
#### Architectures supportées. #### Architectures supportées.
* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/minidlna%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/minidlna/) * x86-64b - [![](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%28Community%29.svg)](https://ci-apps-arm.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/)
* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/minidlna%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/minidlna/) * Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/minidlna%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/minidlna/)
## Limitations ## Limitations

View file

@ -6,10 +6,10 @@ It allows to easily share multimedia files with any compatible devices present o
Minidlna does not have a graphical interface, but does not require any special configuration. Minidlna does not have a graphical interface, but does not require any special configuration.
### What multimedia files are shared? ### What multimedia files are shared?
Minidlna sharing the folder /home/yunohost.multimedia/share, which is common to each user in /home/$USER/Multimedia/Share. 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/maniackcrudelis/yunohost.multimedia) [More information about multimedia files here.](https://github.com/YunoHost-Apps/yunohost.multimedia)
If [transmission](https://github.com/Kloadut/transmission_ynh) is installed, the downloaded media will be available in dlna. If [transmission](https://github.com/YunoHost-Apps/transmission_ynh) is installed, the downloaded media will be available in dlna.
### How to view and play media files shared by minidlna? ### How to view and play media files shared by minidlna?
To view and play media files, all you need is a compatible client DLNA/UPNP. To view and play media files, all you need is a compatible client DLNA/UPNP.
@ -17,7 +17,7 @@ To view and play media files, all you need is a compatible client DLNA/UPNP.
The majority of set-top boxes provided by ISPs are DLNA compatible, simply look for sources of external media. The majority of set-top boxes provided by ISPs are DLNA compatible, simply look for sources of external media.
This is also true for the latest generation game consoles connected to internet. This is also true for the latest generation game consoles connected to internet.
Some TV and blu-ray player is also DLNA compatible. Some TV and blu-ray player are also DLNA compatible.
In any case, it is generally sufficient to seek external sources, USB etc, to find the DLNA server, displayed under the name **Yunohost DLNA**. In any case, it is generally sufficient to seek external sources, USB etc, to find the DLNA server, displayed under the name **Yunohost DLNA**.

View file

@ -7,9 +7,9 @@ Minidlna ne dispose pas d'une interface graphique, mais ne nécessite pas de con
### 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. Minidlna partage le dossier /home/yunohost.multimedia/share, qui est commun à chaque utilisateur dans le dossier /home/$USER/Multimedia/Share.
[Plus d'informations sur les dossiers multimedia ici.](https://github.com/maniackcrudelis/yunohost.multimedia) [Plus d'informations sur les dossiers multimedia ici.](https://github.com/YunoHost-Apps/yunohost.multimedia)
Si [transmission](https://github.com/Kloadut/transmission_ynh) est installé, les médias téléchargés seront disponible en dlna. Si [transmission](https://github.com/YunoHost-Apps/transmission_ynh) est installé, les médias téléchargés seront disponible en dlna.
### Comment consulter et lire les fichiers multimédias partagés par minidlna? ### Comment consulter et lire les fichiers multimédias partagés par minidlna?
Pour voir et lire les fichiers multimédias, il suffit de disposer d'un client compatible DLNA/UPNP. Pour voir et lire les fichiers multimédias, il suffit de disposer d'un client compatible DLNA/UPNP.

View file

@ -29,17 +29,7 @@
port_already_use=0 port_already_use=0
change_url=0 change_url=0
;;; Levels ;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4: Pas de gestion des utilisateurs
Level 4=na
Level 5=auto Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email= Email=
Notification=down Notification=down

View file

@ -6,7 +6,7 @@
"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~ynh5", "version": "1.0~ynh6",
"url": "http://minidlna.sourceforge.net/", "url": "http://minidlna.sourceforge.net/",
"license": "GPL-2.0", "license": "GPL-2.0",
"maintainer": { "maintainer": {
@ -14,7 +14,7 @@
"email": "maniackc_dev@crudelis.fr" "email": "maniackc_dev@crudelis.fr"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.4" "yunohost": ">= 3.5"
}, },
"multi_instance": false, "multi_instance": false,
"services": [], "services": [],

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
#================================================= #=================================================
ynh_script_progression --message="Retrieve arguments from the manifest"
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
@ -26,7 +25,7 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
if [ -e /etc/apt/sources.list.d/minidlna.list ] if [ -e /etc/apt/sources.list.d/minidlna.list ]
then then
ynh_die "You are already using the version from backports repository." 0 ynh_die --message="You are already using the version from backports repository." --ret_code=0
fi fi
#================================================= #=================================================
@ -34,16 +33,16 @@ fi
#================================================= #=================================================
# RE-INSTALL MINIDLNA FROM BACKPORTS # RE-INSTALL MINIDLNA FROM BACKPORTS
#================================================= #=================================================
ynh_script_progression --message="Re-install minidlna from backports" --weight=9 ynh_script_progression --message="Re-installing minidlna from backports..." --weight=9
# Remove the current version of minidlna # Remove the current version of minidlna
ynh_package_remove minidlna ynh_package_remove minidlna
# Then install the version from backports # Then install the version from backports
codename=$(ynh_debian_release) codename=$(ynh_debian_release)
test -z "$codename" && (ynh_die "codename empty") test -z "$codename" && (ynh_die --message="codename empty")
ynh_replace_string "__CODENAME__" "$codename" /etc/yunohost/apps/$app/conf/minidlna.list ynh_replace_string --match_string="__CODENAME__" --replace_string="$codename" --target_file=/etc/yunohost/apps/$app/conf/minidlna.list
cp -a /etc/yunohost/apps/$app/conf/minidlna.list /etc/apt/sources.list.d/ cp -a /etc/yunohost/apps/$app/conf/minidlna.list /etc/apt/sources.list.d/
ynh_apt update ynh_apt update
ynh_package_install -t $codename-backports minidlna ynh_package_install -t $codename-backports minidlna

View file

@ -23,7 +23,7 @@ source /usr/share/yunohost/helpers
if [ ! -e /etc/apt/sources.list.d/minidlna.list ] if [ ! -e /etc/apt/sources.list.d/minidlna.list ]
then then
ynh_die "You are already using the version from the stable repository." 0 ynh_die --message="You are already using the version from the stable repository." --ret_code=0
fi fi
#================================================= #=================================================
@ -31,11 +31,11 @@ fi
#================================================= #=================================================
# RE-INSTALL MINIDLNA FROM STABLE # RE-INSTALL MINIDLNA FROM STABLE
#================================================= #=================================================
ynh_script_progression --message="Re-install minidlna from stable" --weight=9 ynh_script_progression --message="Re-installing minidlna from stable..." --weight=9
# Remove the current version of minidlna # Remove the current version of minidlna
ynh_package_remove minidlna ynh_package_remove minidlna
ynh_secure_remove "/etc/apt/sources.list.d/minidlna.list" ynh_secure_remove --file="/etc/apt/sources.list.d/minidlna.list"
ynh_apt update ynh_apt update
ynh_package_install minidlna ynh_package_install minidlna

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
#================================================= #=================================================
ynh_script_progression --message="Retrieve arguments from the manifest"
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
@ -29,13 +28,13 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
#================================================= #=================================================
# RESET THE DATABASE # RESET THE DATABASE
#================================================= #=================================================
ynh_script_progression --message="Reset the database" --weight=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=minidlna
ynh_secure_remove "$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=minidlna
#================================================= #=================================================

View file

@ -19,11 +19,11 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
version=$(ynh_app_setting_get $app version) version=$(ynh_app_setting_get --app=$app --key=version)
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
@ -33,26 +33,26 @@ version=$(ynh_app_setting_get $app version)
if [ $version = "B" ] if [ $version = "B" ]
then then
ynh_script_progression --message="Backup of the APT source" ynh_script_progression --message="Backing up the APT source file..."
ynh_backup "/etc/apt/sources.list.d/minidlna.list" ynh_backup --src_path="/etc/apt/sources.list.d/minidlna.list"
fi fi
#================================================= #=================================================
# BACKUP OF INOTIFY'S CONFIG # BACKUP OF INOTIFY'S CONFIG
#================================================= #=================================================
ynh_script_progression --message="Backup of inotify's config" ynh_script_progression --message="Backing up inotify's config..."
ynh_backup "/etc/sysctl.d/90-inotify_minidlna.conf" ynh_backup --src_path="/etc/sysctl.d/90-inotify_minidlna.conf"
#================================================= #=================================================
# BACKUP OF MINIDLNA CONFIGURATION # BACKUP OF MINIDLNA CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backup of minidlna configuration" ynh_script_progression --message="Backing up minidlna configuration..."
ynh_backup "/etc/minidlna.conf" ynh_backup --src_path="/etc/minidlna.conf"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup completed" --last ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last

View file

@ -47,13 +47,11 @@ old_friendly_name="$(get_config_value friendly_name)"
friendly_name="${YNH_CONFIG_MAIN_MINIDLNA_CONFIGURATION_FRIENDLY_NAME:-$old_friendly_name}" friendly_name="${YNH_CONFIG_MAIN_MINIDLNA_CONFIGURATION_FRIENDLY_NAME:-$old_friendly_name}"
# Overwrite settings.json file # Overwrite settings.json file
old_overwrite_settings="$(ynh_app_setting_get $app overwrite_settings)" old_overwrite_settings="$(ynh_app_setting_get --app=$app --key=overwrite_settings)"
old_overwrite_settings=$(bool_to_true_false $old_overwrite_settings)
overwrite_settings="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS:-$old_overwrite_settings}" overwrite_settings="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS:-$old_overwrite_settings}"
# Type of admin mail configuration # Type of admin mail configuration
old_admin_mail_html="$(ynh_app_setting_get $app admin_mail_html)" old_admin_mail_html="$(ynh_app_setting_get --app=$app --key=admin_mail_html)"
old_admin_mail_html=$(bool_to_true_false $old_admin_mail_html)
admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}" admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}"
#================================================= #=================================================
@ -75,12 +73,12 @@ show_config() {
elif [ "$root_container" = "V" ]; then elif [ "$root_container" = "V" ]; then
root_container="Video" root_container="Video"
fi fi
echo "YNH_CONFIG_MAIN_MINIDLNA_CONFIGURATION_ROOT_CONTAINER=$root_container" ynh_return "YNH_CONFIG_MAIN_MINIDLNA_CONFIGURATION_ROOT_CONTAINER=$root_container"
echo "YNH_CONFIG_MAIN_MINIDLNA_CONFIGURATION_FRIENDLY_NAME=$friendly_name" ynh_return "YNH_CONFIG_MAIN_MINIDLNA_CONFIGURATION_FRIENDLY_NAME=$friendly_name"
echo "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS=$overwrite_settings" ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS=$overwrite_settings"
echo "YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE=$admin_mail_html" ynh_return "YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE=$admin_mail_html"
} }
#================================================= #=================================================
@ -105,16 +103,16 @@ apply_config() {
fi fi
if [ "$root_container" != "$old_root_container" ] if [ "$root_container" != "$old_root_container" ]
then then
ynh_replace_string "root_container=.*" "root_container=$root_container" "$config_file" ynh_replace_string --match_string="root_container=.*" --replace_string="root_container=$root_container" --target_file="$config_file"
ynh_app_setting_set $app root_container "$root_container" ynh_app_setting_set --app=$app --key=root_container --value="$root_container"
restart_minidlna=1 restart_minidlna=1
fi fi
# friendly_name # friendly_name
if [ "$friendly_name" != "$old_friendly_name" ] if [ "$friendly_name" != "$old_friendly_name" ]
then then
ynh_replace_string "friendly_name=.*" "friendly_name=$friendly_name" "$config_file" ynh_replace_string --match_string="friendly_name=.*" --replace_string="friendly_name=$friendly_name" --target_file="$config_file"
ynh_app_setting_set $app friendly_name "$friendly_name" ynh_app_setting_set --app=$app --key=friendly_name --value="$friendly_name"
restart_minidlna=1 restart_minidlna=1
fi fi
@ -124,12 +122,10 @@ apply_config() {
fi fi
# Set overwrite_settings # Set overwrite_settings
overwrite_settings=$(bool_to_01 $overwrite_settings) ynh_app_setting_set --app=$app --key=overwrite_settings --value="$overwrite_settings"
ynh_app_setting_set $app overwrite_settings "$overwrite_settings"
# Set admin_mail_html # Set admin_mail_html
admin_mail_html=$(bool_to_01 $admin_mail_html) ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html"
ynh_app_setting_set $app admin_mail_html "$admin_mail_html"
} }
#================================================= #=================================================

View file

@ -19,49 +19,49 @@ ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Retrieve arguments from the manifest"
version="$YNH_APP_ARG_VERSION" version="$YNH_APP_ARG_VERSION"
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Store settings from manifest" --weight=2 ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set $app version ${version:0:1} ynh_app_setting_set --app=$app --key=version --value=${version:0:1}
ynh_app_setting_set $app overwrite_settings "1" ynh_app_setting_set --app=$app --key=overwrite_settings --value=1
ynh_app_setting_set $app admin_mail_html "1" ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
#================================================= #=================================================
# CHECK DEBIAN'S CODENAME # CHECK DEBIAN'S CODENAME
#================================================= #=================================================
ynh_script_progression --message="Check debian's codename" ynh_script_progression --message="Checking debian's codename..."
codename=$(ynh_debian_release) codename=$(ynh_debian_release)
test -z "$codename" && (ynh_die "codename empty") test -z "$codename" && (ynh_die --message="codename empty")
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Find and open a port" --weight=15 ynh_script_progression --message="Configuring firewall..." --weight=15
# Find a free port # Find a free port
port=$(ynh_find_port 48200) port=$(ynh_find_port --port=48200)
# Open ports # Open ports
ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port
# Discovery Protocol SSDP for UPNP. # Discovery Protocol SSDP for UPNP.
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 port $port ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# CREATE YUNOHOST.MULTIMEDIA DIRECTORY # CREATE YUNOHOST.MULTIMEDIA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Create yunohost.multimedia directory" --weight=8 ynh_script_progression --message="Creating yunohost.multimedia directory..." --weight=8
ynh_multimedia_build_main_dir ynh_multimedia_build_main_dir
@ -70,12 +70,12 @@ ynh_multimedia_build_main_dir
#================================================= #=================================================
# INSTALL MINIDLNA # INSTALL MINIDLNA
#================================================= #=================================================
ynh_script_progression --message="Install minidlna" --weight=45 ynh_script_progression --message="Installing minidlna..." --weight=45
if [ ${version:0:1} = "B" ] if [ ${version:0:1} = "B" ]
then then
# Install the backport version. (If you have issues with the standard version from the stable repository) # Install the backport version. (If you have issues with the standard version from the stable repository)
ynh_replace_string "__CODENAME__" "$codename" ../conf/minidlna.list ynh_replace_string --match_string="__CODENAME__" --replace_string="$codename" --target_file=../conf/minidlna.list
cp -a ../conf/minidlna.list /etc/apt/sources.list.d/ cp -a ../conf/minidlna.list /etc/apt/sources.list.d/
ynh_apt update ynh_apt update
ynh_package_install -t $codename-backports minidlna ynh_package_install -t $codename-backports minidlna
@ -84,17 +84,18 @@ else
ynh_apt update ynh_apt update
ynh_package_install minidlna ynh_package_install minidlna
fi fi
ynh_app_setting_set $app version ${version:0:1} ynh_app_setting_set --app=$app --key=version --value=${version:0:1}
#================================================= #=================================================
# INCREASE INOTIFY'S LIMITS # INCREASE INOTIFY'S LIMITS
#================================================= #=================================================
ynh_script_progression --message="Increase inotify's limits" ynh_script_progression --message="Increasing inotify's limits..."
# Increase the maximum number of files inotify can monitor. # Increase the maximum number of files inotify can monitor.
cp -a ../conf/90-inotify_minidlna.conf /etc/sysctl.d/ cp -a ../conf/90-inotify_minidlna.conf /etc/sysctl.d/
# Then, reload the kernel configuration. # Then, reload the kernel configuration.
if ! IS_PACKAGE_CHECK; then if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi fi
@ -107,25 +108,25 @@ yunohost service add minidlna --log "/var/log/minidlna.log"
#================================================= #=================================================
# CONFIGURE MINIDLNA # CONFIGURE MINIDLNA
#================================================= #=================================================
ynh_script_progression --message="Configure MiniDLNA" --weight=2 ynh_script_progression --message="Configuring MiniDLNA..." --weight=2
ynh_replace_string "^#*media_dir=.*" "media_dir=/home/yunohost.multimedia/share" /etc/minidlna.conf ynh_replace_string --match_string="^#*media_dir=.*" --replace_string="media_dir=/home/yunohost.multimedia/share" --target_file=/etc/minidlna.conf
ynh_replace_string "^#*port=.*" "port=$port" /etc/minidlna.conf ynh_replace_string --match_string="^#*port=.*" --replace_string="port=$port" --target_file=/etc/minidlna.conf
friendly_name="Yunohost DLNA" friendly_name="Yunohost DLNA"
ynh_app_setting_set $app friendly_name "$friendly_name" ynh_app_setting_set --app=$app --key=friendly_name --value="$friendly_name"
ynh_replace_string "^#*friendly_name=.*" "friendly_name=$friendly_name" /etc/minidlna.conf ynh_replace_string --match_string="^#*friendly_name=.*" --replace_string="friendly_name=$friendly_name" --target_file=/etc/minidlna.conf
root_container="B" root_container="B"
ynh_replace_string "^#*root_container=.*" "root_container=$root_container" /etc/minidlna.conf ynh_replace_string --match_string="^#*root_container=.*" --replace_string="root_container=$root_container" --target_file=/etc/minidlna.conf
ynh_app_setting_set $app root_container "$root_container" ynh_app_setting_set --app=$app --key=root_container --value="$root_container"
ynh_replace_string "^#wide_links=.*" "wide_links=yes" /etc/minidlna.conf 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 # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "/etc/minidlna.conf" ynh_store_file_checksum --file="/etc/minidlna.conf"
#================================================= #=================================================
# RESTART MINIDLNA # RESTART MINIDLNA
#================================================= #=================================================
ynh_script_progression --message="Restart MiniDLNA" --weight=4 ynh_script_progression --message="Restarting MiniDLNA..." --weight=4
ynh_systemd_action --action=restart --service_name=minidlna ynh_systemd_action --action=restart --service_name=minidlna
@ -147,10 +148,10 @@ You can also find some specific actions for this app by using the experimental _
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/minidlna_ynh__URL_TAG3__." > mail_to_send If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/minidlna_ynh__URL_TAG3__." > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type="install" ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=install
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation completed" --last ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,11 +12,11 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=2 ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -27,14 +27,14 @@ port=$(ynh_app_setting_get $app port)
# Check if the service is declared in YunoHost # Check if the service is declared in YunoHost
if ynh_exec_fully_quiet yunohost service status minidlna if ynh_exec_fully_quiet yunohost service status minidlna
then then
ynh_print_info "Remove minidlna service" >&2 ynh_script_progression --message="Removing $app service..."
yunohost service remove minidlna yunohost service remove minidlna
fi fi
#================================================= #=================================================
# CLOSE PORTS # CLOSE PORTS
#================================================= #=================================================
ynh_script_progression --message="Close ports" --weight=15 ynh_script_progression --message="Closing ports $port and 1900..." --weight=15
ynh_exec_fully_quiet yunohost firewall disallow TCP $port 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
@ -44,21 +44,21 @@ ynh_exec_fully_quiet yunohost firewall disallow UDP 1900
#================================================= #=================================================
# REMOVE MINIDNLA # REMOVE MINIDNLA
#================================================= #=================================================
ynh_script_progression --message="Remove MiniDLNA" --weight=6 ynh_script_progression --message="Removing MiniDLNA..." --weight=6
ynh_apt purge minidlna ynh_apt purge minidlna
ynh_secure_remove "/etc/apt/sources.list.d/minidlna.list" ynh_secure_remove --file="/etc/apt/sources.list.d/minidlna.list"
#================================================= #=================================================
# REMOVE INOTIFY'S CONFIG # REMOVE INOTIFY'S CONFIG
#================================================= #=================================================
ynh_script_progression --message="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_print_info "Delete kernel config" >&2 ynh_secure_remove --file="/etc/sysctl.d/90-inotify_minidlna.conf"
ynh_secure_remove "/etc/sysctl.d/90-inotify_minidlna.conf"
# Reload the kernel configuration. # Reload the kernel configuration.
if ! IS_PACKAGE_CHECK; then if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi fi
fi fi
@ -67,4 +67,4 @@ fi
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Deletion completed" --last ynh_script_progression --message="Removal of $app completed" --last

View file

@ -19,19 +19,19 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
version=$(ynh_app_setting_get $app version) version=$(ynh_app_setting_get --app=$app --key=version)
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# SPECIFIC RESTORE # SPECIFIC RESTORE
#================================================= #=================================================
# OPEN PORTS # OPEN PORTS
#================================================= #=================================================
ynh_script_progression --message="Open ports" --weight=15 ynh_script_progression --message="Configuring firewall..." --weight=15
ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port
# Discovery Protocol SSDP for UPNP. # Discovery Protocol SSDP for UPNP.
@ -40,21 +40,21 @@ ynh_exec_fully_quiet yunohost firewall allow --no-upnp UDP 1900
#================================================= #=================================================
# CREATE YUNOHOST.MULTIMEDIA DIRECTORY # CREATE YUNOHOST.MULTIMEDIA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Create yunohost.multimedia directory" --weight=6 ynh_script_progression --message="Creating yunohost.multimedia directory..." --weight=6
ynh_multimedia_build_main_dir ynh_multimedia_build_main_dir
#================================================= #=================================================
# INSTALL MINIDLNA # INSTALL MINIDLNA
#================================================= #=================================================
ynh_script_progression --message="Install minidlna" --weight=45 ynh_script_progression --message="Installing minidlna" --weight=45
if [ ${version:0:1} = "B" ] if [ ${version:0:1} = "B" ]
then then
# Install the backport version. (If you have issues with the standard version from the stable repository) # Install the backport version. (If you have issues with the standard version from the stable repository)
codename=$(ynh_debian_release) codename=$(ynh_debian_release)
ynh_restore_file "/etc/apt/sources.list.d/minidlna.list" ynh_restore_file --origin_path="/etc/apt/sources.list.d/minidlna.list"
ynh_replace_string " [a-z]*-backports" " $codename-backports" /etc/apt/sources.list.d/minidlna.list ynh_replace_string --match_string=" [a-z]*-backports" --replace_string=" $codename-backports" --target_file=/etc/apt/sources.list.d/minidlna.list
ynh_apt update ynh_apt update
ynh_package_install -t $codename-backports minidlna ynh_package_install -t $codename-backports minidlna
else else
@ -66,21 +66,22 @@ fi
#================================================= #=================================================
# RESTORE INOTIFY'S CONFIG # RESTORE INOTIFY'S CONFIG
#================================================= #=================================================
ynh_script_progression --message="Restore inotify's config" ynh_script_progression --message="Restoring inotify's config..."
ynh_restore_file "/etc/sysctl.d/90-inotify_minidlna.conf" ynh_restore_file --origin_path="/etc/sysctl.d/90-inotify_minidlna.conf"
if ! IS_PACKAGE_CHECK; then if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi fi
#================================================= #=================================================
# RESTORE MINIDLNA CONFIGURATION # RESTORE MINIDLNA CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restore MiniDLNA configuration" --weight=7 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 "/etc/minidlna.conf" ynh_secure_remove --file="/etc/minidlna.conf"
ynh_restore_file "/etc/minidlna.conf" ynh_restore_file --origin_path="/etc/minidlna.conf"
ynh_systemd_action --action=restart --service_name=minidlna ynh_systemd_action --action=restart --service_name=minidlna
#================================================= #=================================================
@ -107,10 +108,10 @@ You can also find some specific actions for this app by using the experimental _
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/minidlna_ynh__URL_TAG3__." > mail_to_send If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/minidlna_ynh__URL_TAG3__." > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type="restore" ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=restore
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed" --last ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=2 ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
version=$(ynh_app_setting_get $app version) version=$(ynh_app_setting_get --app=$app --key=version)
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get --app=$app --key=port)
overwrite_settings=$(ynh_app_setting_get $app overwrite_settings) overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
root_container=$(ynh_app_setting_get $app root_container) root_container=$(ynh_app_setting_get --app=$app --key=root_container)
friendly_name=$(ynh_app_setting_get $app friendly_name) friendly_name=$(ynh_app_setting_get --app=$app --key=friendly_name)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -31,30 +31,30 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensure downward compatibility" ynh_script_progression --message="Ensuring downward compatibility..."
# If overwrite_settings doesn't exist, create it # If overwrite_settings doesn't exist, create it
if [ -z "$overwrite_settings" ]; then if [ -z "$overwrite_settings" ]; then
overwrite_settings=1 overwrite_settings=1
ynh_app_setting_set $app overwrite_settings $overwrite_settings ynh_app_setting_set --app=$app --key=overwrite_settings --value=$overwrite_settings
fi fi
# If root_container doesn't exist, create it # If root_container doesn't exist, create it
if [ -z "$root_container" ]; then if [ -z "$root_container" ]; then
root_container="B" root_container="B"
ynh_app_setting_set $app root_container $root_container ynh_app_setting_set --app=$app --key=root_container --value=$root_container
fi fi
# If friendly_name doesn't exist, create it # If friendly_name doesn't exist, create it
if [ -z "$friendly_name" ]; then if [ -z "$friendly_name" ]; then
friendly_name="Yunohost DLNA" friendly_name="Yunohost DLNA"
ynh_app_setting_set $app friendly_name $friendly_name ynh_app_setting_set --app=$app --key=friendly_name --value=$friendly_name
fi fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backup the app before upgrading" --weight=2 ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=2
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -68,20 +68,20 @@ ynh_abort_if_errors
#================================================= #=================================================
# UPGRADE THE YUNOHOST.MULTIMEDIA DIRECTORY # UPGRADE THE YUNOHOST.MULTIMEDIA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Upgrade the yunohost.multimedia directory" --weight=3 ynh_script_progression --message="Upgrading the yunohost.multimedia directory..." --weight=3
ynh_multimedia_build_main_dir ynh_multimedia_build_main_dir
#================================================= #=================================================
# UPGRADE MINIDLNA # UPGRADE MINIDLNA
#================================================= #=================================================
ynh_script_progression --message="Upgrade MiniDLNA" --weight=3 ynh_script_progression --message="Upgrading MiniDLNA..." --weight=3
if [ $version = "B" ] if [ $version = "B" ]
then then
# Install the backport version. (If you have issues with the standard version from the stable repository) # Install the backport version. (If you have issues with the standard version from the stable repository)
codename=$(ynh_debian_release) codename=$(ynh_debian_release)
ynh_replace_string "__CODENAME__" "$codename" ../conf/minidlna.list ynh_replace_string --match_string="__CODENAME__" --replace_string="$codename" --target_file=../conf/minidlna.list
cp -a ../conf/minidlna.list /etc/apt/sources.list.d/ cp -a ../conf/minidlna.list /etc/apt/sources.list.d/
ynh_apt update ynh_apt update
ynh_package_install -t $codename-backports minidlna ynh_package_install -t $codename-backports minidlna
@ -94,12 +94,13 @@ fi
#================================================= #=================================================
# INCREASE INOTIFY'S LIMITS # INCREASE INOTIFY'S LIMITS
#================================================= #=================================================
ynh_script_progression --message="Increase inotify's limits" --weight=2 ynh_script_progression --message="Increasing inotify's limits..." --weight=2
# Increase the maximum number of files inotify can monitor. # Increase the maximum number of files inotify can monitor.
cp -a ../conf/90-inotify_minidlna.conf /etc/sysctl.d/ cp -a ../conf/90-inotify_minidlna.conf /etc/sysctl.d/
# Then, reload the kernel configuration. # Then, reload the kernel configuration.
if ! IS_PACKAGE_CHECK; then if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options.
then
sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf
fi fi
@ -112,28 +113,28 @@ yunohost service add minidlna --log "/var/log/minidlna.log"
#================================================= #=================================================
# CONFIGURE MINIDLNA # CONFIGURE MINIDLNA
#================================================= #=================================================
ynh_script_progression --message="Reconfigure MiniDLNA" --weight=2 ynh_script_progression --message="Reconfiguring MiniDLNA..." --weight=2
# Overwrite the settings config file only if it's allowed # Overwrite the settings config file only if it's allowed
if [ $overwrite_settings -eq 1 ] if [ $overwrite_settings -eq 1 ]
then then
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. # Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
ynh_backup_if_checksum_is_different "/etc/minidlna.conf" ynh_backup_if_checksum_is_different --file="/etc/minidlna.conf"
ynh_replace_string "^#*media_dir=.*" "media_dir=/home/yunohost.multimedia/share" /etc/minidlna.conf ynh_replace_string --match_string="^#*media_dir=.*" --replace_string="media_dir=/home/yunohost.multimedia/share" --target_file=/etc/minidlna.conf
ynh_replace_string "^#*port=.*" "port=$port" /etc/minidlna.conf ynh_replace_string --match_string="^#*port=.*" --replace_string="port=$port" --target_file=/etc/minidlna.conf
ynh_replace_string "^#*friendly_name=.*" "friendly_name=$friendly_name" /etc/minidlna.conf ynh_replace_string --match_string="^#*friendly_name=.*" --replace_string="friendly_name=$friendly_name" --target_file=/etc/minidlna.conf
ynh_replace_string "^#*root_container=.*" "root_container=$root_container" /etc/minidlna.conf ynh_replace_string --match_string="^#*root_container=.*" --replace_string="root_container=$root_container" --target_file=/etc/minidlna.conf
ynh_replace_string "^#wide_links=.*" "wide_links=yes" /etc/minidlna.conf 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 # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "/etc/minidlna.conf" ynh_store_file_checksum --file="/etc/minidlna.conf"
fi fi
#================================================= #=================================================
# RESTART MINIDLNA'S SERVICE # RESTART MINIDLNA'S SERVICE
#================================================= #=================================================
ynh_script_progression --message="Restart MiniDLNA" --weight=7 ynh_script_progression --message="Restarting MiniDLNA..." --weight=7
ynh_systemd_action --action=restart --service_name=minidlna ynh_systemd_action --action=restart --service_name=minidlna
@ -163,10 +164,10 @@ If you're facing an issue or want to improve this app, please open a new issue i
Changelog since your last upgrade: Changelog since your last upgrade:
$(cat changelog)" > mail_to_send $(cat changelog)" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type="upgrade" ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=upgrade
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade completed" --last ynh_script_progression --message="Upgrade of $app completed" --last