diff --git a/Makefile b/Makefile index 3729d1b..f55a9a2 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ all: rm -f src/_jaildk-completion.bash install: - sh jaildk setup $JAILDIR + sh jaildk setup $(JAILDIR) clean: rm -f jaildk diff --git a/TODO b/TODO index caa4105..622b3ab 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -- fix the 3 mode commands to use -m so completion works correctly - vnet ipv6 doesnt work anymore UPDATE: with auto_linklocal seems to work after some seconds - on reboot, no pf will be started diff --git a/src/completions.sh b/src/completions.sh index 2cc6723..ee64dba 100644 --- a/src/completions.sh +++ b/src/completions.sh @@ -21,6 +21,17 @@ reply_version() { COMPREPLY=( $(compgen -W "${versions[*]}" -- "$cur") ) } +# we're taking the easy path here. There might be cases where the +# $name_enable variable doesn't match the actual rc-Script, which +# we will not catch the way we're doing it here, but these are rare +# and the user can specify something manually as well. Also this +# method is way faster than executing rcorder inside the jail +reply_rcscripts() { + local jail=${COMP_WORDS[2]} + local scripts=$(ls $JAILDIR/run/$jail/usr/local/etc/rc.d) + COMPREPLY=( $(compgen -W "${scripts[*]}" -- "$cur") ) +} + functions='mount,ports,mtree,pf' modes='start,stop,status,restart' @@ -69,7 +80,7 @@ subcmd_opts_status=(-v) subcmd_args_status=@jail ### sub cmd rc -subcmd_opts_rc=(-m:$modes -r) +subcmd_opts_rc=(-m:$modes -r:@rcscripts) subcmd_args_rc=@jail ### sub cmd ipfw diff --git a/src/jaildk.sh b/src/jaildk.sh index 0a4b49c..aa09bc7 100755 --- a/src/jaildk.sh +++ b/src/jaildk.sh @@ -1353,7 +1353,7 @@ jaildk_jail() { case $mode in *) service jail $mode $jail - jaildk_ipfw $jail $mode + jaildk_ipfw $jail -m $mode ;; esac fi