procd: update to git HEAD (#7670)

* procd: update to git HEAD

 2dcefbd jail: add support for cgroup devices as in OCI run-time spec

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

* procd: update to git HEAD

 0ee73b2 uxc: implement support for rootfs overlay in containers
 b0a8ea1 jail: do not hack /etc/resolv.conf on container rootfs
 92aba53 jail: increase max additional env records to 64
 15997e6 jail: allow rootfs to be a symbolic link
 0114c6f jail: open() extroot folder before mounting
 ed96eda uxc: check for required blockd mounts

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

* procd: update to git HEAD

 0545905 jail: make use of realpath() for rootfs and overlaydir

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

* procd: update to git HEAD

 9bd1b7f jail: refactor directory handling for rootfs and overlaydir

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

* procd: update to git HEAD

 772292e uxc: don't restart containers when mount shows up
 3a9d910 uxc: resolve volume UUIDs by name of UCI fstab section

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

* procd: update to git HEAD

 f26233e watchdog: Add an info message if the watchdog reset the system

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

* procd: update to git HEAD

Fix build on glibc targets and address a bunch of compiler warnings.

 93fc089 jail: cgroups-bpf: don't use sys/reg.h when building with glibc
 548d057 jail: don't ignore return value of seteuid()
 220b716 jail: ignore return value when creating default /dev symlinks
 78d5baa hotplug-dispatch: don't ignore asprintf() return value
 736aee5 uxc: always handle asprintf() return value
 2b20456 hotplug-dispatch: replace wrongly used assert()
 bfc86a2 jail: cgroups: replace wrongly used assert()
 516bdf2 jail: don't ignore return value of write()

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

* procd: update to git HEAD and add new script helpers

 e10de28 jail: cgroups-bpf: fix compile with musl 1.2
 f5d9b14 hotplug-dispatch: fix rare memory leaks in error paths

Add new init script helpers:
 procd_add_start_mount_trigger
 procd_add_reload_mount_trigger
 procd_get_mountpoints

Both trigger helpers expect a list of paths which are checked against
the mount targets configured in /etc/config/fstab and a trigger for all
mountpoints covered by the list of paths is setup.

procd_get_mountpoints is useful to find out if and which mountpoints
are covered by a list of paths.

Example:
  DATADIRS="/mnt/data/foo /mnt/data/bar /etc/foo/baz /var/lib/doe"

  start_service() {
    [ "$_BOOT" = "1" ] &&
      [ "$(procd_get_mountpoints $DATADIRS)" ] && return 0

    procd_open_instance
    # ...
    procd_close_instance
  }

  boot() {
    _BOOT=1 start
  }

  service_triggers() {
    procd_add_start_mount_trigger $DATADIRS
  }

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

* procd: change procd_add_start_mount_trigger to do restart

Change procd_add_start_mount_trigger to procd_add_restart_mount_trigger
and make it call 'restart' instead of 'start'.
This is more useful as it allows to handle both cases, intial start of
a services as well as restarting services. Calling 'restart' on a
service which has not yet been started has the same result as calling
'start'.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

* procd: update to git HEAD

 9f233f5 system: make rootfs type accessible through board call

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

Co-authored-by: Daniel Golle <daniel@makrotopia.org>
Co-authored-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Beginner 2021-08-13 23:17:18 +08:00 committed by GitHub
parent fc77756bf9
commit f575350b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 83 additions and 4 deletions

View File

@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
PKG_SOURCE_DATE:=2021-05-05 PKG_SOURCE_DATE:=2021-08-13
PKG_SOURCE_VERSION:=021ece84de430fca988acd6934f6046ea59d8c37 PKG_SOURCE_VERSION:=9f233f555f80d1c416656c04ab81d19edc738f07
PKG_MIRROR_HASH:=edbe464cadbae000f4a48a6f1e6a0f5d27ae3ad521e308205252ad89639b6f9d PKG_MIRROR_HASH:=01cdadba9e3a8848342f40383ff61cdc91516c9198790ca49dcc6837cdd83351
CMAKE_INSTALL:=1 CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
@ -90,7 +90,7 @@ endef
define Package/uxc define Package/uxc
SECTION:=base SECTION:=base
CATEGORY:=Base system CATEGORY:=Base system
DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json +blockd
TITLE:=OpenWrt container management TITLE:=OpenWrt container management
MAINTAINER:=Daniel Golle <daniel@makrotopia.org> MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
endef endef

View File

@ -320,6 +320,78 @@ _procd_add_config_trigger() {
json_close_array json_close_array
} }
_procd_add_mount_trigger() {
json_add_array
_procd_add_array_data "$1"
local action="$2"
local multi=0
shift ; shift
json_add_array
_procd_add_array_data "if"
if [ "$2" ]; then
json_add_array
_procd_add_array_data "or"
multi=1
fi
while [ "$1" ]; do
json_add_array
_procd_add_array_data "eq" "target" "$1"
shift
json_close_array
done
[ $multi = 1 ] && json_close_array
json_add_array
_procd_add_array_data "run_script" /etc/init.d/$name $action
json_close_array
json_close_array
_procd_add_timeout
json_close_array
}
_procd_add_action_mount_trigger() {
local script=$(readlink "$initscript")
local name=$(basename ${script:-$initscript})
local action="$1"
local mpath
shift
_procd_open_trigger
_procd_add_mount_trigger mount.add $action "$@"
_procd_close_trigger
}
procd_get_mountpoints() {
(
__procd_check_mount() {
local cfg="$1"
local path="${2%%/}/"
local target
config_get target "$cfg" target
target="${target%%/}/"
[ "$path" != "${path##$target}" ] && echo "${target%%/}"
}
config_load fstab
for mpath in "$@"; do
config_foreach __procd_check_mount mount "$mpath"
done
) | sort -u
}
_procd_add_restart_mount_trigger() {
_procd_add_action_mount_trigger restart $(procd_get_mountpoints "$@")
}
_procd_add_reload_mount_trigger() {
_procd_add_action_mount_trigger reload $(procd_get_mountpoints "$@")
}
_procd_add_raw_trigger() { _procd_add_raw_trigger() {
json_add_array json_add_array
_procd_add_array_data "$1" _procd_add_array_data "$1"
@ -551,8 +623,11 @@ _procd_wrapper \
procd_add_raw_trigger \ procd_add_raw_trigger \
procd_add_config_trigger \ procd_add_config_trigger \
procd_add_interface_trigger \ procd_add_interface_trigger \
procd_add_mount_trigger \
procd_add_reload_trigger \ procd_add_reload_trigger \
procd_add_reload_interface_trigger \ procd_add_reload_interface_trigger \
procd_add_reload_mount_trigger \
procd_add_restart_mount_trigger \
procd_open_trigger \ procd_open_trigger \
procd_close_trigger \ procd_close_trigger \
procd_open_instance \ procd_open_instance \

View File

@ -16,3 +16,7 @@ boot() {
__BOOT_UXC=1 __BOOT_UXC=1
start start
} }
service_triggers() {
procd_add_raw_trigger "mount.add" 3000 /etc/init.d/uxc boot
}