mirror of
https://github.com/dracutdevs/dracut.git
synced 2024-10-27 09:25:21 +03:00
crypt: only manually activate systemd-cryptsetup, if not in crypttab
Only additional rd.luks.UUID have to be manually activated.
This commit is contained in:
parent
730b9b8b77
commit
a13bf117d5
@ -4,6 +4,19 @@
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
|
||||
# check if the crypttab contains an entry for a LUKS UUID
|
||||
crypttab_contains() {
|
||||
local luks="$1"
|
||||
local l d rest
|
||||
if [ -f /etc/crypttab ]; then
|
||||
while read l d rest; do
|
||||
strstr "${l##luks-}" "${luks##luks-}" && return 0
|
||||
strstr "$d" "${luks##luks-}" && return 0
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# ask_for_password
|
||||
#
|
||||
# Wraps around plymouth ask-for-password and adds fallback to tty password ask
|
||||
|
@ -3,16 +3,12 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
|
||||
|
||||
dev=$1
|
||||
luks=$2
|
||||
|
||||
if [ -f /etc/crypttab ]; then
|
||||
while read l d rest; do
|
||||
strstr "${l##luks-}" "${luks##luks-}" && exit 0
|
||||
strstr "$d" "${luks##luks-}" && exit 0
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
crypttab_contains "$luks" && exit 0
|
||||
|
||||
allowdiscards="-"
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
|
||||
|
||||
if ! getargbool 1 rd.luks -d -n rd_NO_LUKS; then
|
||||
info "rd.luks=0: removing cryptoluks activation"
|
||||
rm -f -- /etc/udev/rules.d/70-luks.rules
|
||||
@ -28,6 +30,7 @@ else
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
else
|
||||
if ! crypttab_contains "$luksid"; then
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
@ -36,6 +39,7 @@ else
|
||||
printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n'
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
fi
|
||||
|
||||
uuid=$luksid
|
||||
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
|
||||
|
Loading…
Reference in New Issue
Block a user