procd: do not overwrite service data by default
authorFelix Fietkau <nbd@nbd.name>
Tue, 17 Dec 2024 20:21:37 +0000 (21:21 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 17 Dec 2024 20:54:54 +0000 (21:54 +0100)
Allows a running servie to manage its own data if untouched by the init script

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/base-files/files/etc/rc.common
package/system/procd/files/procd.sh

index d7473038444cb1b6b4f58f408e3cbd2bfdd94f4b..abf72ea3372fe80b920d0c9a03b3e7d30b1a5ff9 100755 (executable)
@@ -100,10 +100,6 @@ service_triggers() {
        return 0
 }
 
-service_data() {
-       return 0
-}
-
 service_running() {
        local instance="${1:-*}"
 
index 5dc8ec42b7a4ef7bdffba23acd3b8fbe28915cd9..59e002036d9558fb3afa83bb562a4ee8e90ed36a 100644 (file)
@@ -101,9 +101,11 @@ _procd_close_service() {
        _procd_open_trigger
        service_triggers
        _procd_close_trigger
-       _procd_open_data
-       service_data
-       _procd_close_data
+       type service_data >/dev/null 2>&1 && {
+               _procd_open_data
+               service_data
+               _procd_close_data
+       }
        _procd_ubus_call ${1:-set}
 }