summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-04 18:12:14 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-04 18:33:36 +0200
commite0c8b3866358a195cb54f5071423f9ebb7556ae9 (patch)
treea45f0cc4044485302114e22f7b3ae3fd4380c5f7
parent467739866c29788a405f1440114a1b7a30bdb348 (diff)
downloadalpine-conf-e0c8b3866358a195cb54f5071423f9ebb7556ae9.zip
setup-disk: enable nvme initfs feature for crypt on nvme
fixes https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10498
-rw-r--r--setup-disk.in24
1 files changed, 16 insertions, 8 deletions
diff --git a/setup-disk.in b/setup-disk.in
index 958261a..d7f0689 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -478,6 +478,16 @@ select_firmware_pkgs() {
echo ${firmware_pkgs:-linux-firmware-none}
}
+is_nvme_dev() {
+ local i
+ for i; do
+ case ${i##*/} in
+ nvme*) return 0;;
+ esac
+ done
+ return 1
+}
+
install_mounted_root() {
local mnt="$1"
shift 1
@@ -536,14 +546,9 @@ install_mounted_root() {
local md=${dev#/dev/}
[ -e "/sys/block/$md/md" ] || continue
- for i in /sys/block/$md/slaves/*; do
- case ${i##*/} in
- nvme*)
- initfs_features="${initfs_features% nvme} nvme"
- break
- ;;
- esac
- done
+ if is_nvme_dev /sys/block/$md/slaves/*; then
+ initfs_features="${initfs_features% nvme} nvme"
+ fi
initfs_features="${initfs_features% raid} raid"
local level=$(cat /sys/block/$md/md/level)
case "$level" in
@@ -595,6 +600,9 @@ install_mounted_root() {
if crypt_required <"$mnt"/etc/fstab; then
use_crypt=1
initfs_features="$initfs_features cryptsetup keymap"
+ if is_nvme_dev /sys/block/dm-*/slaves/*; then
+ initfs_features="$initfs_features nvme"
+ fi
fi
# generate mkinitfs.conf