Skip to content

Commit 343c743

Browse files
authored
Merge pull request dracutdevs#244 from danimo/crypt_with_uuid
90crypt: Fixed crypttab_contains() to also work with device path in /etc/crypttab
2 parents 9bf5f98 + c3b6970 commit 343c743

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

modules.d/90crypt/crypt-lib.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ crypttab_contains() {
1616
[ "$dev" -ef "$_dev" ] && return 0
1717
done
1818
fi
19+
if [ -e /usr/lib/dracut/modules.d/90crypt/block_uuid.map ]; then
20+
# search for line starting with $d
21+
_line=$(sed -n "\,^$d .*$,{p}" /usr/lib/dracut/modules.d/90crypt/block_uuid.map)
22+
[ -z "$_line" ] && continue
23+
# get second column with uuid
24+
_uuid="$(echo $_line | sed 's,^.* \(.*$\),\1,')"
25+
strstr "$_uuid" "${luks##luks-}" && return 0
26+
fi
1927
done < /etc/crypttab
2028
fi
2129
return 1

modules.d/90crypt/module-setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ install() {
7575
[[ $_dev == UUID=* ]] && \
7676
_dev="/dev/disk/by-uuid/${_dev#UUID=}"
7777

78+
echo "$_dev $(blkid $_dev -s UUID -o value)" > /usr/lib/dracut/modules.d/90crypt/block_uuid.map
79+
7880
for _hdev in "${!host_fs_types[@]}"; do
7981
[[ ${host_fs_types[$_hdev]} == "crypto_LUKS" ]] || continue
8082
if [[ $_hdev -ef $_dev ]] || [[ /dev/block/$_hdev -ef $_dev ]]; then

0 commit comments

Comments
 (0)