mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Holger Assmann <h.assmann@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Holger Assmann <h.assmann@pengutronix.de>
Subject: [ptxdist] [PATCH] util-linux: add option for building setpriv
Date: Thu, 27 Nov 2025 08:41:10 +0100	[thread overview]
Message-ID: <20251127074110.3943109-1-h.assmann@pengutronix.de> (raw)

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 <h.assmann@pengutronix.de>
---
 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	other threads:[~2025-11-27  7:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251127074110.3943109-1-h.assmann@pengutronix.de \
    --to=h.assmann@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox