2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
8 # if cryptsetup is not installed, then we cannot support encrypted devices.
9 type -P cryptsetup
>/dev
/null ||
return 1
11 [[ $hostonly ]] ||
[[ $mount_needs ]] && {
12 for fs
in "${host_fs_types[@]}"; do
13 [[ $fs = "crypto_LUKS" ]] && return 0
29 instmods dm_crypt
=crypto
35 for dev
in "${!host_fs_types[@]}"; do
36 [[ "${host_fs_types[$dev]}" != "crypto_LUKS" ]] && continue
39 blkid
-u crypto
-o export $dev \
41 [[ ${line#UUID} = $line ]] && continue
42 printf "%s" "${line#UUID=}"
46 [[ ${UUID} ]] ||
continue
47 printf "%s" " rd.luks.uuid=luks-${UUID}"
54 cmdline
>> "${initdir}/etc/cmdline.d/90crypt.conf"
55 echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
57 inst_multiple cryptsetup
rmdir readlink umount
58 inst_script
"$moddir"/cryptroot-ask.sh
/sbin
/cryptroot-ask
59 inst_script
"$moddir"/probe-keydev.sh
/sbin
/probe-keydev
60 inst_hook cmdline
10 "$moddir/parse-keydev.sh"
61 inst_hook cmdline
30 "$moddir/parse-crypt.sh"
62 if ! dracut_module_included
"systemd"; then
63 inst_hook cleanup
30 "$moddir/crypt-cleanup.sh"
66 if [[ $hostonly ]] && [[ -f /etc
/crypttab
]]; then
67 # filter /etc/crypttab for the devices we need
68 while read _mapper _dev _rest
; do
69 [[ $_mapper = \
#* ]] && continue
70 [[ $_dev ]] ||
continue
72 [[ $_dev == UUID
=* ]] && \
73 _dev
="/dev/disk/by-uuid/${_dev#UUID=}"
75 for _hdev
in "${!host_fs_types[@]}"; do
76 [[ ${host_fs_types[$_hdev]} == "crypto_LUKS" ]] ||
continue
77 if [[ $_hdev -ef $_dev ]] ||
[[ /dev
/block
/$_hdev -ef $_dev ]]; then
78 echo "$_mapper $_dev $_rest"
82 done < /etc
/crypttab
> $initdir/etc
/crypttab
85 inst_simple
"$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
88 $systemdutildir/system-generators
/systemd-cryptsetup-generator \
89 $systemdutildir/systemd-cryptsetup \
90 $systemdsystemunitdir/systemd-ask-password-console.path \
91 $systemdsystemunitdir/systemd-ask-password-console.service \
92 $systemdsystemunitdir/cryptsetup.target \
93 $systemdsystemunitdir/sysinit.target.wants
/cryptsetup.target \
94 systemd-ask-password systemd-tty-ask-password-agent
95 inst_script
"$moddir"/crypt-run-generator.sh
/sbin
/crypt-run-generator