diff options
author | David Howells <dhowells@redhat.com> | 2019-05-30 16:58:35 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2019-06-19 14:10:37 +0100 |
commit | ad921197cad8ed4f8eb39d7dddeae30f7b917538 (patch) | |
tree | 54cf85a45ed2af38f38e332f3ffc2daadcc3f7c2 | |
parent | f9761a6a9abec83c7fd7a9cbc96237f7cd344808 (diff) | |
download | keyutils-ad921197cad8ed4f8eb39d7dddeae30f7b917538.tar.gz |
test: Use capabilities query function in test scripts
Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r-- | tests/prepare.inc.sh | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/tests/prepare.inc.sh b/tests/prepare.inc.sh index 9c4adda..448e42b 100644 --- a/tests/prepare.inc.sh +++ b/tests/prepare.inc.sh @@ -70,47 +70,53 @@ then esac fi -# -# Work out whether key invalidation is supported by the kernel -# have_key_invalidate=0 -if keyutils_at_or_later_than 1.5.6 && kernel_at_or_later_than 3.5-rc1 -then - have_key_invalidate=1 -fi - -# -# Work out whether the big_key type is supported by the kernel -# have_big_key_type=0 -if [ $OSDIST = RHEL ] && ! version_less_than $OSRELEASE 7 -then - # big_key is backported to 3.10 for RHEL-7 - have_big_key_type=1 -elif kernel_at_or_later_than 3.13-rc1 -then - have_big_key_type=1 -fi - -# -# Work out whether Diffie-Hellman is supported by the kernel -# have_dh_compute=0 -if [ $OSDIST = RHEL ] -then - : -elif keyutils_at_or_later_than 1.5.10 && kernel_at_or_later_than 4.7-rc1 -then - have_dh_compute=1 -fi - -# -# Work out whether keyring restrictions are supported by the kernel -# have_restrict_keyring=0 -if keyutils_at_or_later_than 1.6 && kernel_at_or_later_than 4.12-rc1 + +if keyctl supports capabilities >&/dev/null then - have_restrict_keyring=1 + eval `keyctl supports` +else + # + # Work out whether key invalidation is supported by the kernel + # + if keyutils_at_or_later_than 1.5.6 && kernel_at_or_later_than 3.5-rc1 + then + have_key_invalidate=1 + fi + + # + # Work out whether the big_key type is supported by the kernel. + # + if [ $OSDIST = RHEL ] && ! version_less_than $OSRELEASE 7 + then + # big_key is backported to 3.10 for RHEL-7 + have_big_key_type=1 + elif kernel_at_or_later_than 3.13-rc1 + then + have_big_key_type=1 + fi + + # + # Work out whether Diffie-Hellman is supported by the kernel + # + if [ $OSDIST = RHEL ] + then + : + elif keyutils_at_or_later_than 1.5.10 && kernel_at_or_later_than 4.7-rc1 + then + have_dh_compute=1 + fi + + # + # Work out whether keyring restrictions are supported by the kernel + # + if keyutils_at_or_later_than 1.6 && kernel_at_or_later_than 4.12-rc1 + then + have_restrict_keyring=1 + fi fi # |