nspawn: rename --user= to --uid= and repurpose --user/--system for runtime scope
Rename nspawn's --user=NAME option to --uid=NAME for selecting the container user. The -u short option is preserved. --user=NAME and --user NAME are still accepted but emit a deprecation warning. A pre-parsing step stitches the space-separated --user NAME form into --user=NAME before getopt sees it, preserving backwards compatibility despite --user now being an optional_argument. Repurpose --user (without argument) and --system as standalone switches for selecting the runtime scope (user vs system service manager). Replace all uses of the arg_privileged boolean with arg_runtime_scope comparisons throughout nspawn. The default scope is auto-detected from the effective UID. Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
Daan De Meyer
parent
1e084aad7d
commit
e7fb7296f5
@@ -69,8 +69,8 @@ _systemd_nspawn() {
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system
|
||||
--keep-unit -n --network-veth -j -x --ephemeral -a --as-pid2 -U --suppress-sync=yes
|
||||
--cleanup'
|
||||
[ARG]='-D --directory -u --user --uuid --capability --drop-capability --link-journal --bind --bind-ro
|
||||
--cleanup --user --system'
|
||||
[ARG]='-D --directory -u --uid --uuid --capability --drop-capability --link-journal --bind --bind-ro
|
||||
-M --machine -S --slice -E --setenv -Z --selinux-context -L --selinux-apifs-context
|
||||
--register --network-interface --network-bridge --personality -i --image --image-policy --tmpfs
|
||||
--volatile --network-macvlan --kill-signal --template --notify-ready --root-hash --chdir
|
||||
@@ -88,7 +88,7 @@ _systemd_nspawn() {
|
||||
compopt -o nospace
|
||||
comps=$(compgen -S/ -A directory -- "$cur" )
|
||||
;;
|
||||
--user|-u)
|
||||
--uid|-u)
|
||||
comps=$( __get_users )
|
||||
;;
|
||||
--uuid|--root-hash)
|
||||
|
||||
Reference in New Issue
Block a user