base-files: add basic procd integration, let procd start (and restart) ubus instead of having an ubus init script

SVN-Revision: 34866
owl
Felix Fietkau 2012-12-22 18:56:09 +00:00
parent 6061734323
commit bbc6694d98
3 changed files with 33 additions and 3 deletions

View File

@ -28,7 +28,7 @@ endif
define Package/base-files define Package/base-files
SECTION:=base SECTION:=base
CATEGORY:=Base system CATEGORY:=Base system
DEPENDS:=+netifd +libc DEPENDS:=+netifd +libc +procd
TITLE:=Base filesystem for OpenWrt TITLE:=Base filesystem for OpenWrt
URL:=http://openwrt.org/ URL:=http://openwrt.org/
VERSION:=$(PKG_RELEASE)-$(REVISION) VERSION:=$(PKG_RELEASE)-$(REVISION)

View File

@ -75,10 +75,41 @@ $EXTRA_HELP
EOF EOF
} }
# for procd
start_service() {
return 0
}
stop_service() {
return 0
}
${INIT_TRACE:+set -x} ${INIT_TRACE:+set -x}
. "$initscript" . "$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}" ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}"
list_contains ALL_COMMANDS "$action" || action=help list_contains ALL_COMMANDS "$action" || action=help
[ "$action" = "reload" ] && action='eval reload "$@" || restart "$@" && :' [ "$action" = "reload" ] && action='eval reload "$@" || restart "$@" && :'

View File

@ -63,8 +63,7 @@ define Package/ubus/install
endef endef
define Package/ubusd/install define Package/ubusd/install
$(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) ./files/ubus.init $(1)/etc/init.d/ubus
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/ubusd $(1)/sbin/ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ubusd $(1)/sbin/
endef endef