The util-linux implementation of setpriv vastly differs from the one
already provided by busybox: Whilst the latter one only provides
functionality to act on certain Linux capabilities, the version by
util-linux also allows for more sophisticated operations like UID/GID
management or environment handling.

Signed-off-by: Holger Assmann <[email protected]>
---
 rules/util-linux.in   | 11 +++++++++++
 rules/util-linux.make |  3 ++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/rules/util-linux.in b/rules/util-linux.in
index 6ff817997..5f7fbd269 100644
--- a/rules/util-linux.in
+++ b/rules/util-linux.in
@@ -5,6 +5,7 @@ menuconfig UTIL_LINUX
        prompt "util-linux                    "
        select GCCLIBS_GCC_S
        select LIBC_CRYPT                       if UTIL_LINUX_SULOGIN
+       select LIBCAP_NG                        if UTIL_LINUX_SETPRIV
        select HOST_MESON
        select UTIL_LINUX_LIBBLKID
        select UTIL_LINUX_LIBUUID               if UTIL_LINUX_MKSWAP_UUID
@@ -555,6 +556,16 @@ config UTIL_LINUX_SWAPON
 comment "BusyBox' swapon is selected!"
        depends on BUSYBOX_SWAPON
 
+config UTIL_LINUX_SETPRIV
+       bool
+       depends on !BUSYBOX_SETPRIV
+       prompt "setpriv"
+       help
+         Run a program with different Linux privilege settings.
+
+comment "BusyBox' setpriv is selected!"
+       depends on BUSYBOX_SETPRIV
+
 config UTIL_LINUX_SETSID
        bool
        depends on !BUSYBOX_SETSID
diff --git a/rules/util-linux.make b/rules/util-linux.make
index bcf36b195..9e7f0f2f0 100644
--- a/rules/util-linux.make
+++ b/rules/util-linux.make
@@ -143,7 +143,7 @@ UTIL_LINUX_CONF_OPT := \
        -Dbuild-script=disabled \
        -Dbuild-scriptutils=disabled \
        -Dbuild-setarch=disabled \
-       -Dbuild-setpriv=disabled \
+       -Dbuild-setpriv=$(call ptx/endis, PTXCONF_UTIL_LINUX_SETPRIV)d \
        -Dbuild-setterm=$(call ptx/endis, PTXCONF_UTIL_LINUX_SETTERM)d \
        -Dbuild-su=disabled \
        -Dbuild-sulogin=$(call ptx/endis, PTXCONF_UTIL_LINUX_SULOGIN)d \
@@ -271,6 +271,7 @@ UTIL_LINUX_BIN-$(PTXCONF_UTIL_LINUX_READPROFILE)    += 
sbin/readprofile
 UTIL_LINUX_BIN-$(PTXCONF_UTIL_LINUX_RFKILL)            += sbin/rfkill
 UTIL_LINUX_BIN-$(PTXCONF_UTIL_LINUX_SWAPON)            += sbin/swapoff 
sbin/swapon
 UTIL_LINUX_BIN-$(PTXCONF_UTIL_LINUX_PIPESZ)            += bin/pipesz
+UTIL_LINUX_BIN-$(PTXCONF_UTIL_LINUX_SETPRIV)           += bin/setpriv
 UTIL_LINUX_BIN-$(PTXCONF_UTIL_LINUX_SETSID)            += bin/setsid
 UTIL_LINUX_BIN-$(PTXCONF_UTIL_LINUX_SWITCH_ROOT)       += sbin/switch_root
 UTIL_LINUX_BIN-$(PTXCONF_UTIL_LINUX_UMOUNT)            += bin/umount
-- 
2.47.3


Reply via email to