From bbc6694d985ba31fcbc0ffcd26ce2dc847a5187b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 22 Dec 2012 18:56:09 +0000 Subject: base-files: add basic procd integration, let procd start (and restart) ubus instead of having an ubus init script SVN-Revision: 34866 --- package/base-files/files/etc/rc.common | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'package/base-files/files/etc/rc.common') diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common index fa2df6cd25..78e2dd4940 100755 --- a/package/base-files/files/etc/rc.common +++ b/package/base-files/files/etc/rc.common @@ -75,10 +75,41 @@ $EXTRA_HELP EOF } +# for procd +start_service() { + return 0 +} + +stop_service() { + return 0 +} + ${INIT_TRACE:+set -x} . "$initscript" +[ -n "$USE_PROCD" ] && { + . $IPKG_INSTROOT/lib/functions/procd.sh + + rc_procd() { + procd_open_service "$(basename "$initscript")" "$initscript" + "$@" + procd_close_service + } + + start() { + rc_procd start_service "$@" + } + + stop() { + procd_kill "$(basename "$initscript")" "$1" + } + + reload() { + start + } +} + ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}" list_contains ALL_COMMANDS "$action" || action=help [ "$action" = "reload" ] && action='eval reload "$@" || restart "$@" && :' -- cgit v1.2.3