# systemd-nspawn(1) completion -*- shell-script -*-
+# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
-# Copyright 2014 Thomas H.P. Andersen
+# Copyright © 2014 Thomas H.P. Andersen
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
}
__get_interfaces(){
- cut -f 1 -d ' ' /proc/net/dev | tail -n +3 | tr -s '\n' | tr -d ':' | xargs
+ { cd /sys/class/net && echo *; } | \
+ while read -d' ' -r name; do
+ [[ "$name" != "lo" ]] && echo "$name"
+ done
}
_systemd_nspawn() {
local i verb comps
local -A OPTS=(
- [STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system --keep-unit --network-veth -j'
- [ARG]='-D --directory -u --user --uuid --capability --drop-capability --link-journal --bind --bind-ro -M --machine
- -S --slice --setenv -Z --selinux-context -L --selinux-apifs-context --register --network-interface --network-bridge
- --personality -i --image --tmpfs --volatile
- --network-macvlan --kill-signal'
+ [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 --private-users-chown -U'
+ [ARG]='-D --directory -u --user --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 --tmpfs --volatile --network-macvlan --kill-signal --template --notify-ready --root-hash
+ --chdir --pivot-root --property --private-users --network-namespace-path --network-ipvlan --network-veth-extra
+ --network-zone -p --port --system-call-filter --overlay --overlay-ro --settings'
)
_init_completion || return
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
- --directory|-D)
+ --directory|-D|--template)
compopt -o nospace
comps=$(compgen -S/ -A directory -- "$cur" )
;;
--user|-u)
comps=$( __get_users )
;;
- --uuid)
+ --uuid|--root-hash)
comps=''
;;
--capability)
--slice|-S)
comps=$( __get_slices )
;;
- --setenv)
+ --setenv|-E)
comps=$( __get_env )
;;
--selinux-context|-Z)
comps=$( compgen -A file -- "$cur" )
;;
--kill-signal)
- comps=$(compgen -A signal)
+ _signals
+ return
+ ;;
+ --notify-ready)
+ comps='yes no'
+ ;;
+ --private-users)
+ comps='yes no pick'
+ ;;
+ --network-namespace-path)
+ comps=$( compgen -A file -- "$cur" )
+ ;;
+ --settings)
+ comps='yes no override trusted'
;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )