diff --git a/README.md b/README.md index 07a8ee1..7574763 100644 --- a/README.md +++ b/README.md @@ -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. -**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 @@ -39,9 +39,9 @@ Not relevant. #### Supported architectures -* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/minidlna%20%28Community%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/) -* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/minidlna%20%28Community%29.svg)](https://ci-stretch.nohost.me/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%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/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 diff --git a/README_fr.md b/README_fr.md index cc23a73..34ae5a3 100644 --- a/README_fr.md +++ b/README_fr.md @@ -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. -**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 @@ -39,9 +39,9 @@ Non applicable. #### 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/) -* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/minidlna%20%28Community%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/) +* 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%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/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 diff --git a/app_minidlna.md b/app_minidlna.md index ff6ea67..ad8f366 100644 --- a/app_minidlna.md +++ b/app_minidlna.md @@ -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. ### What multimedia files are shared? -Minidlna 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) +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/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? 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. 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**. diff --git a/app_minidlna_fr.md b/app_minidlna_fr.md index f48a73d..aa04874 100644 --- a/app_minidlna_fr.md +++ b/app_minidlna_fr.md @@ -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? 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? Pour voir et lire les fichiers multimédias, il suffit de disposer d'un client compatible DLNA/UPNP. diff --git a/check_process b/check_process index db8b294..8daa3b8 100644 --- a/check_process +++ b/check_process @@ -29,17 +29,7 @@ port_already_use=0 change_url=0 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: Pas de gestion des utilisateurs - Level 4=na Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email= Notification=down diff --git a/manifest.json b/manifest.json index 505e146..3d86281 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "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~ynh5", + "version": "1.0~ynh6", "url": "http://minidlna.sourceforge.net/", "license": "GPL-2.0", "maintainer": { @@ -14,7 +14,7 @@ "email": "maniackc_dev@crudelis.fr" }, "requirements": { - "yunohost": ">= 3.4" + "yunohost": ">= 3.5" }, "multi_instance": false, "services": [], diff --git a/scripts/actions/install_backports b/scripts/actions/install_backports index f30c2bf..bfaabd1 100755 --- a/scripts/actions/install_backports +++ b/scripts/actions/install_backports @@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS #================================================= -ynh_script_progression --message="Retrieve arguments from the manifest" 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 ] 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 #================================================= @@ -34,16 +33,16 @@ fi #================================================= # 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 ynh_package_remove minidlna # Then install the version from backports 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/ ynh_apt update ynh_package_install -t $codename-backports minidlna diff --git a/scripts/actions/install_standard b/scripts/actions/install_standard index a361a31..ddaca6e 100755 --- a/scripts/actions/install_standard +++ b/scripts/actions/install_standard @@ -23,7 +23,7 @@ source /usr/share/yunohost/helpers if [ ! -e /etc/apt/sources.list.d/minidlna.list ] 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 #================================================= @@ -31,11 +31,11 @@ fi #================================================= # 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 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_package_install minidlna diff --git a/scripts/actions/reset_db b/scripts/actions/reset_db index 2e608aa..fb43cd2 100755 --- a/scripts/actions/reset_db +++ b/scripts/actions/reset_db @@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS #================================================= -ynh_script_progression --message="Retrieve arguments from the manifest" app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} @@ -29,13 +28,13 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} #================================================= # 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 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_secure_remove "$db_directory/files.db" +ynh_secure_remove --file="$db_directory/files.db" ynh_systemd_action --action=start --service_name=minidlna #================================================= diff --git a/scripts/backup b/scripts/backup index cd1d53f..0a22646 100644 --- a/scripts/backup +++ b/scripts/backup @@ -19,11 +19,11 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Load settings" +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -version=$(ynh_app_setting_get $app version) +version=$(ynh_app_setting_get --app=$app --key=version) #================================================= # SPECIFIC BACKUP @@ -33,26 +33,26 @@ version=$(ynh_app_setting_get $app version) if [ $version = "B" ] then - ynh_script_progression --message="Backup of the APT source" - ynh_backup "/etc/apt/sources.list.d/minidlna.list" + ynh_script_progression --message="Backing up the APT source file..." + ynh_backup --src_path="/etc/apt/sources.list.d/minidlna.list" fi #================================================= # 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 #================================================= -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 #================================================= -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 diff --git a/scripts/config b/scripts/config index 504dbf7..1056658 100644 --- a/scripts/config +++ b/scripts/config @@ -47,13 +47,11 @@ old_friendly_name="$(get_config_value friendly_name)" friendly_name="${YNH_CONFIG_MAIN_MINIDLNA_CONFIGURATION_FRIENDLY_NAME:-$old_friendly_name}" # Overwrite settings.json file -old_overwrite_settings="$(ynh_app_setting_get $app overwrite_settings)" -old_overwrite_settings=$(bool_to_true_false $old_overwrite_settings) +old_overwrite_settings="$(ynh_app_setting_get --app=$app --key=overwrite_settings)" overwrite_settings="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS:-$old_overwrite_settings}" # Type of admin mail configuration -old_admin_mail_html="$(ynh_app_setting_get $app admin_mail_html)" -old_admin_mail_html=$(bool_to_true_false $old_admin_mail_html) +old_admin_mail_html="$(ynh_app_setting_get --app=$app --key=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 root_container="Video" fi - echo "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_ROOT_CONTAINER=$root_container" + 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 if [ "$root_container" != "$old_root_container" ] then - ynh_replace_string "root_container=.*" "root_container=$root_container" "$config_file" - ynh_app_setting_set $app root_container "$root_container" + ynh_replace_string --match_string="root_container=.*" --replace_string="root_container=$root_container" --target_file="$config_file" + ynh_app_setting_set --app=$app --key=root_container --value="$root_container" restart_minidlna=1 fi # friendly_name if [ "$friendly_name" != "$old_friendly_name" ] then - ynh_replace_string "friendly_name=.*" "friendly_name=$friendly_name" "$config_file" - ynh_app_setting_set $app friendly_name "$friendly_name" + ynh_replace_string --match_string="friendly_name=.*" --replace_string="friendly_name=$friendly_name" --target_file="$config_file" + ynh_app_setting_set --app=$app --key=friendly_name --value="$friendly_name" restart_minidlna=1 fi @@ -124,12 +122,10 @@ apply_config() { fi # Set overwrite_settings - overwrite_settings=$(bool_to_01 $overwrite_settings) - ynh_app_setting_set $app overwrite_settings "$overwrite_settings" + ynh_app_setting_set --app=$app --key=overwrite_settings --value="$overwrite_settings" # Set admin_mail_html - admin_mail_html=$(bool_to_01 $admin_mail_html) - ynh_app_setting_set $app admin_mail_html "$admin_mail_html" + ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html" } #================================================= diff --git a/scripts/install b/scripts/install index 1b8344c..2ebc3c6 100644 --- a/scripts/install +++ b/scripts/install @@ -19,49 +19,49 @@ ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -ynh_script_progression --message="Retrieve arguments from the manifest" version="$YNH_APP_ARG_VERSION" + app=$YNH_APP_INSTANCE_NAME #================================================= # 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 admin_mail_html "1" +ynh_app_setting_set --app=$app --key=overwrite_settings --value=1 +ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 #================================================= # CHECK DEBIAN'S CODENAME #================================================= -ynh_script_progression --message="Check debian's codename" +ynh_script_progression --message="Checking debian's codename..." codename=$(ynh_debian_release) -test -z "$codename" && (ynh_die "codename empty") +test -z "$codename" && (ynh_die --message="codename empty") #================================================= # STANDARD MODIFICATIONS #================================================= # 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 -port=$(ynh_find_port 48200) +port=$(ynh_find_port --port=48200) # Open ports ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port # Discovery Protocol SSDP for UPNP. 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 #================================================= -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 @@ -70,12 +70,12 @@ ynh_multimedia_build_main_dir #================================================= # INSTALL MINIDLNA #================================================= -ynh_script_progression --message="Install minidlna" --weight=45 +ynh_script_progression --message="Installing minidlna..." --weight=45 if [ ${version:0:1} = "B" ] then # 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/ ynh_apt update ynh_package_install -t $codename-backports minidlna @@ -84,17 +84,18 @@ else ynh_apt update ynh_package_install minidlna 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 #================================================= -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. cp -a ../conf/90-inotify_minidlna.conf /etc/sysctl.d/ # 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 fi @@ -107,25 +108,25 @@ yunohost service add minidlna --log "/var/log/minidlna.log" #================================================= # 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 "^#*port=.*" "port=$port" /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 --match_string="^#*port=.*" --replace_string="port=$port" --target_file=/etc/minidlna.conf friendly_name="Yunohost DLNA" -ynh_app_setting_set $app friendly_name "$friendly_name" -ynh_replace_string "^#*friendly_name=.*" "friendly_name=$friendly_name" /etc/minidlna.conf +ynh_app_setting_set --app=$app --key=friendly_name --value="$friendly_name" +ynh_replace_string --match_string="^#*friendly_name=.*" --replace_string="friendly_name=$friendly_name" --target_file=/etc/minidlna.conf root_container="B" -ynh_replace_string "^#*root_container=.*" "root_container=$root_container" /etc/minidlna.conf -ynh_app_setting_set $app root_container "$root_container" -ynh_replace_string "^#wide_links=.*" "wide_links=yes" /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=$app --key=root_container --value="$root_container" +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 -ynh_store_file_checksum "/etc/minidlna.conf" +ynh_store_file_checksum --file="/etc/minidlna.conf" #================================================= # 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 @@ -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 -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 #================================================= -ynh_script_progression --message="Installation completed" --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index bc1f48e..153301e 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,11 +12,11 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Load settings" --weight=2 +ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME -port=$(ynh_app_setting_get $app port) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # STANDARD REMOVE @@ -27,14 +27,14 @@ port=$(ynh_app_setting_get $app port) # Check if the service is declared in YunoHost if ynh_exec_fully_quiet yunohost service status minidlna then - ynh_print_info "Remove minidlna service" >&2 + ynh_script_progression --message="Removing $app service..." yunohost service remove minidlna fi #================================================= # 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 UDP 1900 @@ -44,21 +44,21 @@ ynh_exec_fully_quiet yunohost firewall disallow UDP 1900 #================================================= # REMOVE MINIDNLA #================================================= -ynh_script_progression --message="Remove MiniDLNA" --weight=6 +ynh_script_progression --message="Removing MiniDLNA..." --weight=6 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 #================================================= -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 - ynh_print_info "Delete kernel config" >&2 - ynh_secure_remove "/etc/sysctl.d/90-inotify_minidlna.conf" + ynh_secure_remove --file="/etc/sysctl.d/90-inotify_minidlna.conf" # 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 fi fi @@ -67,4 +67,4 @@ fi # END OF SCRIPT #================================================= -ynh_script_progression --message="Deletion completed" --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index fb97f4a..73f8ad3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -19,19 +19,19 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Load settings" +ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME -version=$(ynh_app_setting_get $app version) -port=$(ynh_app_setting_get $app port) +version=$(ynh_app_setting_get --app=$app --key=version) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # SPECIFIC RESTORE #================================================= # 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 # Discovery Protocol SSDP for UPNP. @@ -40,21 +40,21 @@ ynh_exec_fully_quiet yunohost firewall allow --no-upnp UDP 1900 #================================================= # 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 #================================================= # INSTALL MINIDLNA #================================================= -ynh_script_progression --message="Install minidlna" --weight=45 +ynh_script_progression --message="Installing minidlna" --weight=45 if [ ${version:0:1} = "B" ] then # Install the backport version. (If you have issues with the standard version from the stable repository) codename=$(ynh_debian_release) - ynh_restore_file "/etc/apt/sources.list.d/minidlna.list" - ynh_replace_string " [a-z]*-backports" " $codename-backports" /etc/apt/sources.list.d/minidlna.list + ynh_restore_file --origin_path="/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_package_install -t $codename-backports minidlna else @@ -66,21 +66,22 @@ fi #================================================= # 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" -if ! IS_PACKAGE_CHECK; then +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="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 -ynh_secure_remove "/etc/minidlna.conf" -ynh_restore_file "/etc/minidlna.conf" +ynh_secure_remove --file="/etc/minidlna.conf" +ynh_restore_file --origin_path="/etc/minidlna.conf" 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 -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 #================================================= -ynh_script_progression --message="Restoration completed" --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 04f45aa..f6a0b20 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Load settings" --weight=2 +ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME -version=$(ynh_app_setting_get $app version) -port=$(ynh_app_setting_get $app port) -overwrite_settings=$(ynh_app_setting_get $app overwrite_settings) -root_container=$(ynh_app_setting_get $app root_container) -friendly_name=$(ynh_app_setting_get $app friendly_name) +version=$(ynh_app_setting_get --app=$app --key=version) +port=$(ynh_app_setting_get --app=$app --key=port) +overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings) +root_container=$(ynh_app_setting_get --app=$app --key=root_container) +friendly_name=$(ynh_app_setting_get --app=$app --key=friendly_name) #================================================= # CHECK VERSION @@ -31,30 +31,30 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # 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 [ -z "$overwrite_settings" ]; then 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 # If root_container doesn't exist, create it if [ -z "$root_container" ]; then 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 # If friendly_name doesn't exist, create it if [ -z "$friendly_name" ]; then 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 #================================================= # 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 ynh_backup_before_upgrade @@ -68,20 +68,20 @@ ynh_abort_if_errors #================================================= # 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 #================================================= # UPGRADE MINIDLNA #================================================= -ynh_script_progression --message="Upgrade MiniDLNA" --weight=3 +ynh_script_progression --message="Upgrading MiniDLNA..." --weight=3 if [ $version = "B" ] then # Install the backport version. (If you have issues with the standard version from the stable repository) 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/ ynh_apt update ynh_package_install -t $codename-backports minidlna @@ -94,12 +94,13 @@ fi #================================================= # 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. cp -a ../conf/90-inotify_minidlna.conf /etc/sysctl.d/ # 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 fi @@ -112,28 +113,28 @@ yunohost service add minidlna --log "/var/log/minidlna.log" #================================================= # 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 if [ $overwrite_settings -eq 1 ] then # 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 "^#*port=.*" "port=$port" /etc/minidlna.conf - ynh_replace_string "^#*friendly_name=.*" "friendly_name=$friendly_name" /etc/minidlna.conf - ynh_replace_string "^#*root_container=.*" "root_container=$root_container" /etc/minidlna.conf - ynh_replace_string "^#wide_links=.*" "wide_links=yes" /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 --match_string="^#*port=.*" --replace_string="port=$port" --target_file=/etc/minidlna.conf + ynh_replace_string --match_string="^#*friendly_name=.*" --replace_string="friendly_name=$friendly_name" --target_file=/etc/minidlna.conf + ynh_replace_string --match_string="^#*root_container=.*" --replace_string="root_container=$root_container" --target_file=/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 - ynh_store_file_checksum "/etc/minidlna.conf" + ynh_store_file_checksum --file="/etc/minidlna.conf" fi #================================================= # 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 @@ -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: $(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 #================================================= -ynh_script_progression --message="Upgrade completed" --last +ynh_script_progression --message="Upgrade of $app completed" --last