From: Paul Donald Date: Sat, 10 Feb 2024 17:35:35 +0000 (+0100) Subject: p910nd: init script X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=852746e9c9a6638069e598fa4199599c4639fe0e;p=feed%2Fpackages.git p910nd: init script Don't run procd with a name of p9100d or p9101d etc. Use the original binary name: p910nd. This way, all supplied parameters should be visible via e.g.: ps xargs -0 < /proc/{procid}/cmdline Revise all p910nd strings to the variable DAEMON_NAME or CONFIG where appropriate. Signed-off-by: Paul Donald (cherry picked from commit 3f04d2d791fb18d03e990926955b87198293bb9d) --- diff --git a/net/p910nd/files/p910nd.init b/net/p910nd/files/p910nd.init index 2ddbdc7128..2332d91753 100644 --- a/net/p910nd/files/p910nd.init +++ b/net/p910nd/files/p910nd.init @@ -2,6 +2,8 @@ # Copyright (C) 2007 OpenWrt.org START=99 USE_PROCD=1 +DAEMON_NAME="p910nd" +CONFIG="p910nd" append_bool() { local section="$1" @@ -22,8 +24,8 @@ append_string() { } start_service() { - config_load "p910nd" - config_foreach start_p910nd p910nd + config_load $CONFIG + config_foreach start_p910nd $CONFIG } @@ -33,17 +35,16 @@ start_p910nd() { if [ "$enabled" -gt 0 ]; then args="-d " config_get port "$section" port - name=p910${port}d append_bool "$section" bidirectional "-b" append_string "$section" device "-f " append_string "$section" bind "-i " append_string "$section" port "" - procd_open_instance $name - procd_set_param command /usr/sbin/p910nd $args + procd_open_instance $DAEMON_NAME + procd_set_param command /usr/sbin/$DAEMON_NAME $args procd_set_param respawn config_get_bool runas_root "$section" runas_root 0 - [ "$runas_root" -ne 1 ] && procd_set_param user p910nd + [ "$runas_root" -ne 1 ] && procd_set_param user $DAEMON_NAME config_get_bool "mdns" "$section" "mdns" '0' config_get mdns_note "$section" mdns_note @@ -61,6 +62,6 @@ start_p910nd() { service_triggers() { procd_open_trigger - procd_add_config_trigger "config.change" "p910nd" /etc/init.d/p910nd reload + procd_add_config_trigger "config.change" $DAEMON_NAME /etc/init.d/$DAEMON_NAME reload procd_close_trigger }