Transition period for init script migration was long enough, let's
make USE_PROCD=1 default now so there's enough time to convert the
remaining services/init scripts for the next release.

Signed-off-by: Petr Štetiar <[email protected]>
---
 package/base-files/files/etc/rc.common | 113 ++++++++++---------------
 1 file changed, 47 insertions(+), 66 deletions(-)

diff --git a/package/base-files/files/etc/rc.common 
b/package/base-files/files/etc/rc.common
index 4fdf7485096c..b8dbe123ca18 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -1,25 +1,15 @@
 #!/bin/sh
 # Copyright (C) 2006-2012 OpenWrt.org
 
+initscript=$1
+
 . $IPKG_INSTROOT/lib/functions.sh
 . $IPKG_INSTROOT/lib/functions/service.sh
+. $IPKG_INSTROOT/lib/functions/procd.sh
 
-initscript=$1
 action=${2:-help}
 shift 2
 
-start() {
-       return 0
-}
-
-stop() {
-       return 0
-}
-
-reload() {
-       restart
-}
-
 restart() {
        trap '' TERM
        stop "$@"
@@ -73,11 +63,10 @@ Available commands:
        reload  Reload configuration files (or restart if service does not 
implement reload)
        enable  Enable service autostart
        disable Disable service autostart
-$EXTRA_HELP
+       running Check if service is running
 EOF
 }
 
-# for procd
 start_service() {
        return 0
 }
@@ -104,57 +93,49 @@ ${INIT_TRACE:+set -x}
 
 . "$initscript"
 
-[ -n "$USE_PROCD" ] && {
-       EXTRA_COMMANDS="${EXTRA_COMMANDS} running trace"
-       EXTRA_HELP="\
-       running Check if service is running
-       "
-
-       . $IPKG_INSTROOT/lib/functions/procd.sh
-       basescript=$(readlink "$initscript")
-       rc_procd() {
-               local method="set"
-               [ -n "$2" ] && method="add"
-               procd_open_service "$(basename ${basescript:-$initscript})" 
"$initscript"
-               "$@"
-               procd_close_service "$method"
-       }
-
-       start() {
-               rc_procd start_service "$@"
-               if eval "type service_started" 2>/dev/null >/dev/null; then
-                       service_started
-               fi
-       }
-
-       trace() {
-               TRACE_SYSCALLS=1
-               start "$@"
-       }
-
-       stop() {
+basescript=$(readlink "$initscript")
+rc_procd() {
+       local method="set"
+       [ -n "$2" ] && method="add"
+       procd_open_service "$(basename ${basescript:-$initscript})" 
"$initscript"
+       "$@"
+       procd_close_service "$method"
+}
+
+start() {
+       rc_procd start_service "$@"
+       if eval "type service_started" 2>/dev/null >/dev/null; then
+               service_started
+       fi
+}
+
+trace() {
+       TRACE_SYSCALLS=1
+       start "$@"
+}
+
+stop() {
+       procd_lock
+       stop_service "$@"
+       procd_kill "$(basename ${basescript:-$initscript})" "$1"
+       if eval "type service_stopped" 2>/dev/null >/dev/null; then
+               service_stopped
+       fi
+}
+
+reload() {
+       if eval "type reload_service" 2>/dev/null >/dev/null; then
                procd_lock
-               stop_service "$@"
-               procd_kill "$(basename ${basescript:-$initscript})" "$1"
-               if eval "type service_stopped" 2>/dev/null >/dev/null; then
-                       service_stopped
-               fi
-       }
-
-       reload() {
-               if eval "type reload_service" 2>/dev/null >/dev/null; then
-                       procd_lock
-                       reload_service "$@"
-               else
-                       start
-               fi
-       }
-
-       running() {
-               service_running "$@"
-       }
-}
-
-ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled 
depends ${EXTRA_COMMANDS}"
+               reload_service "$@"
+       else
+               start
+       fi
+}
+
+running() {
+       service_running "$@"
+}
+
+ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled 
depends running trace"
 list_contains ALL_COMMANDS "$action" || action=help
 $action "$@"

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to