Skip to content

Commit 0e3a8b6

Browse files
oldiumsergio-correia
authored andcommitted
dracut: fix running with pre-v103 Dracut
Dracut v103+ moved SystemD cryptsetup code into a separate module, so detect it and when found, use it. Clevis units do not depend on `cryptsetup.target`, so do not install it. The target `cryptsetup.target` is installed by both [90systemd-cryptsetup][1] in v103+ and [01systemd-cryptsetup][2] in v105+, so there is no need to install it by Clevis. [1]: https://github.com/dracut-ng/dracut-ng/blob/3fce598fb45aa5618cdf885eb48cf327104ffcb8/modules.d/90systemd-cryptsetup/module-setup.sh#L53 [2]: https://github.com/dracut-ng/dracut-ng/blob/a2669c447bd5e0406f55efcc8c9c58be89458b08/modules.d/01systemd-cryptsetup/module-setup.sh#L54 Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
1 parent 106d4ae commit 0e3a8b6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
depends() {
2222
local __depends=crypt
2323
if dracut_module_included "systemd"; then
24-
__depends=$(printf '%s systemd-cryptsetup' "${__depends}")
24+
# Dracut v103 introduced a separate systemd-cryptsetup module
25+
systemd_cryptsetup_dir=$(dracut_module_path "systemd-cryptsetup")
26+
if [ -d "$systemd_cryptsetup_dir" ]; then
27+
__depends=$(printf '%s systemd-cryptsetup' "${__depends}")
28+
else
29+
__depends=$(printf '%s systemd' "${__depends}")
30+
fi
2531
fi
2632
echo "${__depends}"
2733
return 255
@@ -32,7 +38,6 @@ install() {
3238
inst_multiple \
3339
$systemdsystemunitdir/clevis-luks-askpass.service \
3440
$systemdsystemunitdir/clevis-luks-askpass.path \
35-
$systemdsystemunitdir/cryptsetup.target \
3641
@SYSTEMD_REPLY_PASS@ \
3742
@libexecdir@/clevis-luks-askpass
3843

0 commit comments

Comments
 (0)