base-files: fix service_running check
[openwrt/staging/wigyori.git] / package / base-files / files / etc / rc.common
index f39b69464eac98f92012ecc6f1566531049081b6..e950ec209dc6d2cbdfc9ab6ee996e82a33d7eb4e 100755 (executable)
@@ -55,7 +55,12 @@ enable() {
 
 enabled() {
        name="$(basename "${initscript}")"
-       [ -x "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" ]
+       name="${name##[SK][0-9][0-9]}"
+       {
+               [ -z "${START:-}" ] || [ -L "$IPKG_INSTROOT/etc/rc.d/S${START}$name" ]
+       } && {
+               [ -z "${STOP:-}" ] || [ -L "$IPKG_INSTROOT/etc/rc.d/K${STOP}$name" ]
+       }
 }
 
 depends() {
@@ -100,9 +105,9 @@ service_data() {
 }
 
 service_running() {
-       local service="${1:-$(basename $initscript)}"
-       local instance="${2:-*}"
-       procd_running "$service" "$instance" "$@"
+       local instance="${1:-*}"
+
+       procd_running "$(basename $initscript)" "$instance"
 }
 
 ${INIT_TRACE:+set -x}