2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
10 if [ -f /etc/crypttab ]; then
11 while read l d rest; do
12 strstr "${l##luks-}" "${luks##luks-}" && exit 0
13 strstr "$d" "${luks##luks-}" && exit 0
19 # parse for allow-discards
20 if strstr "$(cryptsetup --help)" "allow-discards"; then
21 if discarduuids=$(getargs "rd.luks.allow-discards"); then
22 discarduuids=$(str_replace "$discarduuids" 'luks-' '')
23 if strstr " $discarduuids " " ${luks##luks-}"; then
24 allowdiscards="allow-discards"
26 elif getargbool 0 rd.luks.allow-discards; then
27 allowdiscards="allow-discards"
31 echo "$luks $dev - timeout=0,$allowdiscards" >> /etc/crypttab
33 if command -v systemctl >/dev/null; then
34 systemctl daemon-reload
35 systemctl start cryptsetup.target