util-linux/bash-completion/unshare
Adrian Reber be7df01a62
unshare: support the time namespace
This adds support to unshare for time namespaces. With the newly added
options '-t, --time' and '--monotonic' and '--boottime' it is now
possible to change CLOCK_MONOTONIC and CLOCK_BOOTTIME in a new time
namespace.

The time namespace has been merged in kernel version 5.6 and an easy way
to test it is using CLOCK_BOOTTIME and the uptime command:

 # uptime
 11:08:26 up 20:28,  1 user,  load average: 0.00, 0.00, 0.00
 # ./unshare --fork --time --boottime 100000000 uptime
 11:08:29 up 1158 days,  6:15,  1 user,  load average: 0.00, 0.00, 0.00

Signed-off-by: Adrian Reber <areber@redhat.com>
2020-03-08 19:02:00 +01:00

55 lines
936 B
Plaintext

_unshare_module()
{
local cur prev OPTS
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'--propagation')
COMPREPLY=( $(compgen -W "slave shared private unchanged" -- $cur) )
return 0
;;
'-s'|'--setgroups')
COMPREPLY=( $(compgen -W "allow deny" -- $cur) )
return 0
;;
'-h'|'--help'|'-V'|'--version')
return 0
;;
esac
case $cur in
-*)
OPTS="--mount
--uts
--ipc
--net
--pid
--user
--cgroup
--time
--fork
--kill-child
--keep-caps
--mount-proc
--map-current-user
--map-root-user
--propagation
--setgroups
--help
--version
--root
--wd
--monotonic
--boottime
--setuid
--setgid"
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
return 0
;;
esac
compopt -o bashdefault
COMPREPLY=( $(compgen -c -- $cur) )
return 0
}
complete -F _unshare_module unshare