
Fixes containers/bubblewrap#91 Add the ability to overwrite argv[0] when starting a process in a container. Using --argv0 to be consistent with ld.so --argv0. Overwriting argv[0] is useful as some tools change their behavior based on the value of argv[0]. For example, when bash is symlinked to sh it behaves as sh. Similarly, unxz is a symlink to xz and changes the default from compressing to decompressing. An extreme example is on many systems, date, df, cat and so on are all symlinks to the coreutils binary. Example usage: bwrap --bind / / --argv0 sh bash Signed-off-by: Jonathan Wright <quaggy@gmail.com>
77 lines
1.1 KiB
Bash
77 lines
1.1 KiB
Bash
# shellcheck shell=bash
|
|
|
|
# bash completion file for bubblewrap commands
|
|
#
|
|
|
|
_bwrap() {
|
|
local cur prev words cword
|
|
_init_completion || return
|
|
|
|
# Please keep sorted in LC_ALL=C order
|
|
local boolean_options="
|
|
--as-pid-1
|
|
--assert-userns-disabled
|
|
--clearenv
|
|
--disable-userns
|
|
--help
|
|
--new-session
|
|
--unshare-all
|
|
--unshare-cgroup
|
|
--unshare-cgroup-try
|
|
--unshare-ipc
|
|
--unshare-net
|
|
--unshare-pid
|
|
--unshare-user
|
|
--unshare-user-try
|
|
--unshare-uts
|
|
--version
|
|
"
|
|
|
|
# Please keep sorted in LC_ALL=C order
|
|
local options_with_args="
|
|
$boolean_optons
|
|
--add-seccomp-fd
|
|
--args
|
|
--argv0
|
|
--bind
|
|
--bind-data
|
|
--block-fd
|
|
--cap-add
|
|
--cap-drop
|
|
--chdir
|
|
--chmod
|
|
--dev
|
|
--dev-bind
|
|
--die-with-parent
|
|
--dir
|
|
--exec-label
|
|
--file
|
|
--file-label
|
|
--gid
|
|
--hostname
|
|
--info-fd
|
|
--lock-file
|
|
--perms
|
|
--proc
|
|
--remount-ro
|
|
--ro-bind
|
|
--seccomp
|
|
--setenv
|
|
--size
|
|
--symlink
|
|
--sync-fd
|
|
--uid
|
|
--unsetenv
|
|
--userns-block-fd
|
|
"
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
complete -F _bwrap bwrap
|
|
|
|
# vim:set ft=bash:
|