Skip to content

Commit 5193674

Browse files
authored
Install clevis-pin-tpm2 in initrd when required (#509)
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
1 parent 0e3a8b6 commit 5193674

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

src/luks/dracut/clevis-pin-tpm2/module-setup.sh.in

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,16 @@
1919
#
2020

2121
check() {
22-
require_binaries clevis-decrypt-tpm2 tpm2_createprimary tpm2_flushcontext \
23-
tpm2_load tpm2_unseal tpm2_getcap || return 1
24-
require_any_binary tpm2_pcrread tpm2_pcrlist || return 1
22+
require_binaries clevis-decrypt-tpm2 || return 1
23+
24+
if command -v clevis-pin-tpm2 >/dev/null;
25+
then
26+
require_binaries clevis-pin-tpm2 || return 1
27+
else
28+
require_binaries tpm2_createprimary tpm2_flushcontext \
29+
tpm2_load tpm2_unseal tpm2_getcap || return 1
30+
require_any_binary tpm2_pcrread tpm2_pcrlist || return 1
31+
fi
2532
return 0
2633
}
2734

@@ -30,11 +37,21 @@ depends() {
3037
return 0
3138
}
3239

33-
install() {
34-
inst_multiple clevis-decrypt-tpm2 tpm2_createprimary tpm2_flushcontext \
40+
install_tpm2_tools() {
41+
inst_multiple tpm2_createprimary tpm2_flushcontext \
3542
tpm2_load tpm2_unseal tpm2_getcap
3643
inst_multiple -o tpm2_pcrread tpm2_pcrlist
44+
}
45+
46+
install() {
47+
inst_multiple clevis-decrypt-tpm2
3748
inst_libdir_file "libtss2-tcti-device.so*"
49+
if command -v clevis-pin-tpm2 >/dev/null;
50+
then
51+
inst_multiple clevis-pin-tpm2
52+
else
53+
install_tpm2_tools
54+
fi
3855
}
3956

4057
installkernel() {

0 commit comments

Comments
 (0)