#!/bin/sh
. /lib/dracut-lib.sh
type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
dev=$1
luks=$2
crypttab_contains "$luks" "$dev" && exit 0
allowdiscards="-"
# parse for allow-discards
if 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
allowdiscards="discard"
fi
elif getargbool 0 rd.luks.allow-discards; then
allowdiscards="discard"
fi
fi
echo "$luks $dev - timeout=0,$allowdiscards" >> /etc/crypttab
if command -v systemctl >/dev/null; then
systemctl daemon-reload
systemctl start cryptsetup.target
fi
exit 0
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| crypt-cleanup.sh | File | 442 B | 0755 |
|
| crypt-lib.sh | File | 7.47 KB | 0755 |
|
| crypt-run-generator.sh | File | 770 B | 0755 |
|
| cryptroot-ask.sh | File | 4.76 KB | 0755 |
|
| module-setup.sh | File | 4.61 KB | 0755 |
|
| parse-crypt.sh | File | 6.97 KB | 0755 |
|
| parse-keydev.sh | File | 1.34 KB | 0755 |
|
| probe-keydev.sh | File | 382 B | 0755 |
|