]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
90crypt: Do not call cryptsetup in a systemd environment
authorDaniel Molkentin <dmolkentin@suse.com>
Tue, 29 Oct 2019 13:29:34 +0000 (14:29 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Wed, 4 Mar 2020 08:22:09 +0000 (09:22 +0100)
systemd provides its own cryptsetup facilities, and the
cryptsetup binary might not even exist, failing
to execute the discard flag processing.

Fixes #602

modules.d/90crypt/crypt-run-generator.sh

index 8dad76ba1e4c3e44a05558cbb93ff37161b1603d..7a8cfdff1f7b6039d1110c4caa6cdc95aa239f26 100755 (executable)
@@ -11,7 +11,7 @@ crypttab_contains "$luks" "$dev" && exit 0
 allowdiscards="-"
 
 # parse for allow-discards
 allowdiscards="-"
 
 # parse for allow-discards
-if strstr "$(cryptsetup --help)" "allow-discards"; then
+if [ -n "$DRACUT_SYSTEMD" ] || strstr "$(cryptsetup --help)" "allow-discards"; then
     if discarduuids=$(getargs "rd.luks.allow-discards"); then
         discarduuids=$(str_replace "$discarduuids" 'luks-' '')
         if strstr " $discarduuids " " ${luks##luks-}"; then
     if discarduuids=$(getargs "rd.luks.allow-discards"); then
         discarduuids=$(str_replace "$discarduuids" 'luks-' '')
         if strstr " $discarduuids " " ${luks##luks-}"; then