1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minidlna_ynh.git synced 2024-09-03 19:36:34 +02:00
This commit is contained in:
Salamandar 2024-01-24 18:29:11 +01:00
parent c96fb76d9f
commit ff4797a659
6 changed files with 31 additions and 31 deletions

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2 packaging_format = 2
id = "minidlna" id = "minidlna"

View file

@ -9,8 +9,7 @@
#================================================= #=================================================
IS_PACKAGE_CHECK() { IS_PACKAGE_CHECK() {
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ] if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then
then
return 0 return 0
else else
return 1 return 1

View file

@ -14,8 +14,8 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2 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=overwrite_settings --value=1
ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 ynh_app_setting_set --app="$app" --key=admin_mail_html --value=1
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -44,8 +44,7 @@ ynh_script_progression --message="Increasing inotify's limits..." --weight=1
# 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 # LXC doesn't allow sysctl to play with kernel options. if ! IS_PACKAGE_CHECK; then # 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
@ -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="^#*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="^#*port=.*" --replace_string="port=$port" --target_file=/etc/minidlna.conf
friendly_name="Yunohost DLNA" 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 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 --match_string="^#*root_container=.*" --replace_string="root_container=$root_container" --target_file=/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_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 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
@ -72,7 +71,7 @@ ynh_store_file_checksum --file="/etc/minidlna.conf"
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 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 # 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 ynh_script_progression --message="Starting a systemd service..." --weight=4
# Start a systemd service # 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 # END OF SCRIPT

View file

@ -16,8 +16,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # 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 if ynh_exec_warn_less yunohost service status $app >/dev/null; then
then
ynh_script_progression --message="Removing $app service integration..." ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app yunohost service remove $app
fi fi

View file

@ -33,8 +33,7 @@ ynh_multimedia_build_main_dir
ynh_script_progression --message="Restoring various files..." --weight=1 ynh_script_progression --message="Restoring various files..." --weight=1
ynh_restore_file --origin_path="/etc/sysctl.d/90-inotify_minidlna.conf" 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. if ! IS_PACKAGE_CHECK; then # 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
# 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
@ -46,14 +45,14 @@ ynh_restore_file --origin_path="/etc/minidlna.conf"
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 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 # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 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 # END OF SCRIPT

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0 test_format = 1.0
[default] [default]