summaryrefslogtreecommitdiff
path: root/Completion/Linux/Command/_selinux
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2024-03-18 21:34:11 +0100
committerOliver Kiddle <opk@zsh.org>2024-03-18 21:34:38 +0100
commit93334b207ff7a7b0fe7d85ccea5b0aeccab0a4da (patch)
treebfb5d2586f506bf3b90f94562be2919dd1317367 /Completion/Linux/Command/_selinux
parent1e995cbb384ddc931ba025a0f1cbc210d259f588 (diff)
downloadzsh-93334b207ff7a7b0fe7d85ccea5b0aeccab0a4da.tar.gz
zsh-93334b207ff7a7b0fe7d85ccea5b0aeccab0a4da.zip
52770: handle newrole in SELinux completions
Diffstat (limited to 'Completion/Linux/Command/_selinux')
-rw-r--r--Completion/Linux/Command/_selinux31
1 files changed, 23 insertions, 8 deletions
diff --git a/Completion/Linux/Command/_selinux b/Completion/Linux/Command/_selinux
index e7d4d3b2e..a7ba68952 100644
--- a/Completion/Linux/Command/_selinux
+++ b/Completion/Linux/Command/_selinux
@@ -1,4 +1,4 @@
-#compdef audit2allow audit2why avcstat chcon checkmodule checkpolicy fixfiles getpidprevcon getsebool matchpathcon restorecon runcon sealert secon sedta seinfo selinuxconlist selinuxdefcon selinuxexeccon semanage semodule semodule_unpackage sepolgen sepolicy sesearch sestatus setenforce setsebool validatetrans
+#compdef audit2allow audit2why avcstat chcon checkmodule checkpolicy fixfiles getpidprevcon getsebool matchpathcon newrole restorecon runcon sealert secon sedta seinfo selinuxconlist selinuxdefcon selinuxexeccon semanage semodule semodule_unpackage sepolgen sepolicy sesearch sestatus setenforce setsebool validatetrans
# encompasses checkpolicy libselinux-utils policycoreutils
# policycoreutils-devel policycoreutils-python-utils setools-console
@@ -251,6 +251,21 @@ case $service in
)
;;
+ newrole)
+ local cmd cpp
+ cmd="$words[1]"
+ cpp='_comp_priv_prefix=( $cmd ${(kv)opt_args[(I)-([rtl]|-role|-type|-level)]} )'
+ args=(
+ '(-r --role)'{-r+,--role=}'[specify role]: :_selinux_roles'
+ '(-t --type)'{-t+,--type=}'[specify type]: :_selinux_types'
+ '(-l --level)'{-l+,--range=}'[specify level]:level'
+ '(-p --preserve-environment)'{-p,--preserve-environment}"[don't create new minimal environment]"
+ "${ign}(-)"{-V,--version}'[display version information]'
+ "(-)1: :{ $cpp; _command_names -e }" \
+ "*:: :{ $cpp; _normal }"
+ )
+ ;;
+
restorecon)
args=(
'*-e+[exclude a directory]:directory:_directories'
@@ -276,10 +291,10 @@ case $service in
runcon)
args=(
'(1 -c --compute)'{-c,--compute}'[compute process transition context before modifying]'
- '(1 -t --type=TYPE)'{-t+,--type=}'[specify type]: :_selinux_types'
- '(1 -u --user=USER)'{-u+,--user=}'[specify user identity]: :_selinux_users'
- '(1 -r --role=ROLE)'{-r+,--role=}'[specify role]: :_selinux_roles'
- '(1 -l --range=RANGE)'{-l+,--range=}'[specify level range]:range'
+ '(1 -t --type)'{-t+,--type=}'[specify type]: :_selinux_types'
+ '(1 -u --user)'{-u+,--user=}'[specify user identity]: :_selinux_users'
+ '(1 -r --role)'{-r+,--role=}'[specify role]: :_selinux_roles'
+ '(1 -l --range)'{-l+,--range=}'[specify level range]:range'
'(-)1:security context:_selinux_contexts'
'*:::args:_normal'
)
@@ -460,7 +475,7 @@ case $service in
'(-E --extract)'{-E,--extract}'[extract customizable commands, for use within a transaction]'
)
;|
- boolean|dontaudit|export|import)
+ fcontext|ibendport|ibpkey|interface|login|module|node|permissive|port|user)
args+=( '(-a --add)'{-a,--add}'[add a record]' )
;|
boolean|fcontext|ibendport|ibpkey|interface|login|node|permissive|port|user)
@@ -573,8 +588,8 @@ case $service in
\*{-B,--build}'[build and reload policy]'
\*'--refresh[like --build but reuse existing linked policy if module files unchanged]'
\*{-D,--disable_dontaudit}'[remove dontaudits from policy]'
- \*{-i+,--install=}'[install a new module]:module package:_files -g "*.pp(-.)"'
- \!{-b,--base,-u,--upgrade}':module package:_files -g "*.pp(-.)"'
+ \*{-i+,--install=}'[install a new module]:module package:_files -g "*.(pp|cil)(-.)"'
+ \!{-b,--base,-u,--upgrade}':module package:_files -g "*.(pp|cil)(-.)"'
\*{-r+,--remove=}'[remove existing module at desired priority]:module name:_selinux_modules'
\*{-l+,--list-modules=-}'[display list of installed modules]::kind:((
standard\:highest\ priority,\ enabled\ modules