Skip to content

Commit

Permalink
Add luksuuid= and lukskeydesc=
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrudenell committed Feb 6, 2022
1 parent 240cdd3 commit fb11260
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions initramfs-init.in
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ myopts="alpine_dev autodetect autoraid chart cryptroot cryptdm cryptheader crypt
cryptdiscards cryptkey debug_init dma init init_args keep_apk_new modules ovl_dev
pkgs quiet root_size root usbdelay ip alpine_repo apkovl alpine_start splash
blacklist overlaytmpfs overlaytmpfsflags rootfstype rootflags nbd resume s390x_net
dasd ssh_key BOOTIF zfcp"
dasd ssh_key BOOTIF zfcp luksuuid lukskeydesc"

for opt; do
case "$opt" in
Expand All @@ -364,7 +364,7 @@ for opt; do

for i in $myopts; do
case "$opt" in
$i=*) eval "KOPT_${i}"='${opt#*=}';;
$i=*) eval "KOPT_${i}=\${KOPT_${i}:+\$KOPT_${i} }${opt#*=}";;
$i) eval "KOPT_${i}=yes";;
no$i) eval "KOPT_${i}=no";;
esac
Expand Down Expand Up @@ -492,6 +492,18 @@ if [ -n "$KOPT_cryptroot" ]; then
fi
fi

if [ -n "$KOPT_lukskeydesc" ]; then
read -s -p "Passphrase for key $KOPT_lukskeydesc: "
echo -n "$REPLY" | /bin/keyctl padd user "$KOPT_lukskeydesc" @u
fi

for uuid in $KOPT_luksuuid; do
nlplug-findfs $cryptopts -p /sbin/mdev ${KOPT_debug_init:+-d} UUID=$uuid
dev=$(findfs UUID=$uuid)
echo "Unlocking $dev as luks-$uuid"
/sbin/cryptsetup open $dev luks-$uuid
done

if [ -n "$KOPT_nbd" ]; then
# TODO: Might fail because nlplug-findfs hasn't plugged eth0 yet
configure_ip
Expand Down

0 comments on commit fb11260

Please sign in to comment.