include $(TOPDIR)/rules.mk
PKG_NAME:=procd
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
+PKG_SOURCE_URL=$(LEDE_GIT)/project/procd.git
PKG_SOURCE_DATE:=2018-01-23
-PKG_SOURCE_VERSION:=653629f19e591a0827ab39de07b4526bb119a57a
-PKG_MIRROR_HASH:=2e0c3ae45521eea456a8411c8d9ef19ed9a5ed6c0ab38b9496555625fb4ba6a2
+PKG_SOURCE_VERSION:=9a4036fb1b7412ab2ea4f360d2cc7e6a5e0fa6b5
+PKG_MIRROR_HASH:=669f062e9c5228ef9d09cc9904d8ce4651f0b8506a6c2fff27b21e83b26f0abb
CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
+PKG_FLAGS:=nonshared
+
PKG_CONFIG_DEPENDS:= \
CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP \
- CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
+ CONFIG_NAND_SUPPORT CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \
CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp
include $(INCLUDE_DIR)/package.mk
define Package/procd
SECTION:=base
CATEGORY:=Base system
- DEPENDS:=+ubusd +ubus +libjson-script +flock +ubox +USE_GLIBC:librt +libubox +libubus
+ DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +NAND_SUPPORT:procd-nand
TITLE:=OpenWrt system process manager
endef
TITLE:=OpenWrt process seccomp helper + utrace
endef
+define Package/procd-nand
+ SECTION:=utils
+ CATEGORY:=Utilities
+ DEPENDS:=@NAND_SUPPORT +ubi-utils
+ TITLE:=OpenWrt sysupgrade nand helper
+endef
+
+define Package/procd-nand-firstboot
+ SECTION:=utils
+ CATEGORY:=Utilities
+ DEPENDS:=procd-nand
+ TITLE:=OpenWrt firstboot nand helper
+endef
+
define Package/procd/config
menu "Configuration"
depends on PACKAGE_procd
endef
+ifeq ($(CONFIG_NAND_SUPPORT),y)
+ CMAKE_OPTIONS += -DBUILD_UPGRADED=1
+endif
+
ifeq ($(CONFIG_PROCD_SHOW_BOOT),y)
CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1
endif
define Package/procd/install
$(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger,upgraded} $(1)/sbin/
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger} $(1)/sbin/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib
$(INSTALL_BIN) ./files/reload_config $(1)/sbin/
$(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/
$(INSTALL_DIR) $(1)/sbin $(1)/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-seccomp.so $(1)/lib
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/utrace $(1)/sbin/
- $(LN) utrace $(1)/sbin/seccomp-trace
+ ln -s utrace $(1)/sbin/seccomp-trace
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib
endef
+define Package/procd-nand/install
+ $(INSTALL_DIR) $(1)/sbin $(1)/lib/upgrade
+
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upgraded $(1)/sbin/
+ $(INSTALL_DATA) ./files/nand.sh $(1)/lib/upgrade/
+endef
+
+define Package/procd-nand-firstboot/install
+ $(INSTALL_DIR) $(1)/lib/preinit
+
+ $(INSTALL_DATA) ./files/nand-preinit.sh $(1)/lib/preinit/60-nand-firstboot.sh
+endef
+
$(eval $(call BuildPackage,procd))
$(eval $(call BuildPackage,procd-ujail))
$(eval $(call BuildPackage,procd-seccomp))
+$(eval $(call BuildPackage,procd-nand))
+$(eval $(call BuildPackage,procd-nand-firstboot))
[ "if",
[ "and",
[ "has", "MAJOR" ],
- [ "has", "MINOR" ]
+ [ "has", "MINOR" ],
],
[
[ "if",
[ "eq", "DEVNAME",
- [ "null", "full", "ptmx", "zero", "tty", "net", "random", "urandom" ]
+ [ "null", "full", "ptmx", "zero", "tty", "net", "random", "urandom" ],
],
[
[ "makedev", "/dev/%DEVNAME%", "0666" ],
- [ "return" ]
+ [ "return" ],
]
],
[ "if",
[ "regex", "DEVNAME", "^snd" ],
- [ "makedev", "/dev/%DEVNAME%", "0660", "audio" ]
+ [ "makedev", "/dev/%DEVNAME%", "0660", "audio" ],
],
[ "if",
[ "has", "DEVNAME" ],
- [ "makedev", "/dev/%DEVNAME%", "0600" ]
- ]
- ]
+ [ "makedev", "/dev/%DEVNAME%", "0600" ],
+ ],
+ ],
],
[ "if",
[ "has", "FIRMWARE" ],
[ "load-firmware", "/lib/firmware" ],
[ "return" ]
]
- ]
+ ],
],
"remove" : [
[ "if",
[ "and",
[ "has", "DEVNAME" ],
[ "has", "MAJOR" ],
- [ "has", "MINOR" ]
+ [ "has", "MINOR" ],
],
[ "rm", "/dev/%DEVNAME%" ]
]
[ "if",
[ "and",
[ "has", "BUTTON" ],
- [ "eq", "SUBSYSTEM", "button" ]
+ [ "eq", "SUBSYSTEM", "button" ],
],
[ "button", "/etc/rc.button/%BUTTON%" ]
],
[ "isdir", "/etc/hotplug.d/%SUBSYSTEM%" ],
[ "exec", "/sbin/hotplug-call", "%SUBSYSTEM%" ]
]
- ]
+ ],
]
# Send a signal to a service instance (or all instances)
#
-. "$IPKG_INSTROOT/usr/share/libubox/jshn.sh"
+. $IPKG_INSTROOT/usr/share/libubox/jshn.sh
PROCD_RELOAD_DELAY=1000
_PROCD_SERVICE=
-procd_lock() {
- local basescript=$(readlink "$initscript")
- local service_name="$(basename ${basescript:-$initscript})"
-
- flock -n 1000 &> /dev/null
- if [ "$?" != "0" ]; then
- exec 1000>"$IPKG_INSTROOT/var/lock/procd_${service_name}.lock"
- flock 1000
- if [ "$?" != "0" ]; then
- logger "warning: procd flock for $service_name failed"
- fi
- fi
-}
-
_procd_call() {
local old_cb
}
_procd_wrapper() {
- procd_lock
while [ -n "$1" ]; do
eval "$1() { _procd_call _$1 \"\$@\"; }"
shift
_procd_open_trigger
service_triggers
_procd_close_trigger
- _procd_open_data
- service_data
- _procd_close_data
_procd_ubus_call ${1:-set}
}
json_close_array
}
-_procd_open_data() {
- let '_procd_data_open = _procd_data_open + 1'
- [ "$_procd_data_open" -gt 1 ] && return
- json_add_object "data"
-}
-
-_procd_close_data() {
- let '_procd_data_open = _procd_data_open - 1'
- [ "$_procd_data_open" -lt 1 ] || return
- json_close_object
-}
-
_procd_open_validate() {
json_select ..
json_add_array "validate"
json_add_string "" "$@"
json_close_array
;;
- nice|term_timeout)
+ nice)
json_add_int "$type" "$1"
;;
reload_signal)
local instance="$2"
local signal="$3"
- case "$signal" in
- [A-Z]*) signal="$(kill -l "$signal" 2>/dev/null)" || return 1;;
- esac
-
json_init
json_add_string name "$service"
[ -n "$instance" -a "$instance" != "*" ] && json_add_string instance "$instance"