summaryrefslogtreecommitdiff
path: root/package/base-files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-12-22 18:56:09 +0000
committerFelix Fietkau <nbd@openwrt.org>2012-12-22 18:56:09 +0000
commitbbc6694d985ba31fcbc0ffcd26ce2dc847a5187b (patch)
tree9a47b4be3d9dbbc443103584ecadc10c828af243 /package/base-files
parent606173432325a828bd55744857cbfd690ad9c4cf (diff)
downloadmtk-20170518-bbc6694d985ba31fcbc0ffcd26ce2dc847a5187b.zip
mtk-20170518-bbc6694d985ba31fcbc0ffcd26ce2dc847a5187b.tar.gz
mtk-20170518-bbc6694d985ba31fcbc0ffcd26ce2dc847a5187b.tar.bz2
base-files: add basic procd integration, let procd start (and restart) ubus instead of having an ubus init script
SVN-Revision: 34866
Diffstat (limited to 'package/base-files')
-rw-r--r--package/base-files/Makefile2
-rwxr-xr-xpackage/base-files/files/etc/rc.common31
2 files changed, 32 insertions, 1 deletions
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index ec69e0c..63350f8 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -28,7 +28,7 @@ endif
define Package/base-files
SECTION:=base
CATEGORY:=Base system
- DEPENDS:=+netifd +libc
+ DEPENDS:=+netifd +libc +procd
TITLE:=Base filesystem for OpenWrt
URL:=http://openwrt.org/
VERSION:=$(PKG_RELEASE)-$(REVISION)
diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common
index fa2df6c..78e2dd4 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 "$@" && :'