diff --git a/manifest.toml b/manifest.toml index dee3bc3..e8f9d09 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "minidlna" diff --git a/scripts/_common.sh b/scripts/_common.sh index b02fb07..e97e4ad 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,13 +8,12 @@ # PACKAGE CHECK BYPASSING... #================================================= -IS_PACKAGE_CHECK () { - if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ] - then - return 0 - else - return 1 - fi +IS_PACKAGE_CHECK() { + if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then + return 0 + else + return 1 + fi } #================================================= diff --git a/scripts/install b/scripts/install index 70bc14a..8c01510 100644 --- a/scripts/install +++ b/scripts/install @@ -14,8 +14,8 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Storing installation settings..." --weight=2 -ynh_app_setting_set --app=$app --key=overwrite_settings --value=1 -ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 +ynh_app_setting_set --app="$app" --key=overwrite_settings --value=1 +ynh_app_setting_set --app="$app" --key=admin_mail_html --value=1 #================================================= # STANDARD MODIFICATIONS @@ -44,9 +44,8 @@ ynh_script_progression --message="Increasing inotify's limits..." --weight=1 # 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 # LXC doesn't allow sysctl to play with kernel options. -then - sysctl -p /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 #================================================= @@ -57,11 +56,11 @@ ynh_script_progression --message="Configuring MiniDLNA..." --weight=2 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=$app --key=friendly_name --value="$friendly_name" +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 --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_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 @@ -72,7 +71,7 @@ ynh_store_file_checksum --file="/etc/minidlna.conf" #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --log="/var/log/$app.log" --needs_exposed_ports="1900" +yunohost service add "$app" --log="/var/log/$app.log" --needs_exposed_ports="1900" #================================================= # START SYSTEMD SERVICE @@ -80,7 +79,7 @@ yunohost service add $app --log="/var/log/$app.log" --needs_exposed_ports="1900" 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" +ynh_systemd_action --service_name="$app" --action="restart" --log_path="/var/log/$app.log" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index c49e70d..4fb59d4 100755 --- a/scripts/remove +++ b/scripts/remove @@ -16,10 +16,9 @@ source /usr/share/yunohost/helpers #================================================= # 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 $app service integration..." - yunohost service remove $app +if ynh_exec_warn_less yunohost service status $app >/dev/null; then + ynh_script_progression --message="Removing $app service integration..." + yunohost service remove $app fi #================================================= @@ -36,12 +35,12 @@ ynh_exec_fully_quiet yunohost firewall disallow UDP 1900 ynh_script_progression --message="Removing various files..." --weight=1 if [ -e "/etc/sysctl.d/90-inotify_minidlna.conf" ]; then - ynh_secure_remove --file="/etc/sysctl.d/90-inotify_minidlna.conf" - # Reload the kernel configuration. - 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 + ynh_secure_remove --file="/etc/sysctl.d/90-inotify_minidlna.conf" + # Reload the kernel configuration. + 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 #================================================= diff --git a/scripts/restore b/scripts/restore index 1e42e58..c8370de 100644 --- a/scripts/restore +++ b/scripts/restore @@ -33,9 +33,8 @@ ynh_multimedia_build_main_dir 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 # LXC doesn't allow sysctl to play with kernel options. -then - sysctl -p /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" @@ -46,14 +45,14 @@ ynh_restore_file --origin_path="/etc/minidlna.conf" #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --log="/var/log/$app.log" --needs_exposed_ports="1900" +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" +ynh_systemd_action --service_name="$app" --action=restart --log_path="/var/log/$app.log" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml index d64ef3c..953b195 100644 --- a/tests.toml +++ b/tests.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + test_format = 1.0 [default]