initramfs: add support for variable partitions layout
Try to find root filesystem by partition label (not filesystem label!). If that fails, default to 3rd partition according to (new) default layout. Fixes QubesOS/qubes-issues#3173
This commit is contained in:
parent
e9615899ff
commit
09e6d2ac95
@ -56,9 +56,13 @@ log_begin "Waiting for /dev/xvda* devices..."
|
|||||||
while ! [ -e /dev/xvda ]; do sleep 0.1; done
|
while ! [ -e /dev/xvda ]; do sleep 0.1; done
|
||||||
log_end
|
log_end
|
||||||
|
|
||||||
# prefer first partition if exists
|
# prefer partition if exists
|
||||||
if [ -b /dev/xvda1 ]; then
|
if [ -b /dev/xvda1 ]; then
|
||||||
ROOT_DEV=xvda1
|
if [ -d /dev/disk/by-partlabel ]; then
|
||||||
|
ROOT_DEV=$(basename $(readlink "/dev/disk/by-partlabel/Root\\x20filesystem"))
|
||||||
|
else
|
||||||
|
ROOT_DEV=xvda3
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
ROOT_DEV=xvda
|
ROOT_DEV=xvda
|
||||||
fi
|
fi
|
||||||
|
@ -20,9 +20,18 @@ die() {
|
|||||||
echo "Waiting for /dev/xvda* devices..."
|
echo "Waiting for /dev/xvda* devices..."
|
||||||
while ! [ -e /dev/xvda ]; do sleep 0.1; done
|
while ! [ -e /dev/xvda ]; do sleep 0.1; done
|
||||||
|
|
||||||
# prefer first partition if exists
|
# prefer partition if exists
|
||||||
if [ -b /dev/xvda1 ]; then
|
if [ -b /dev/xvda1 ]; then
|
||||||
ROOT_DEV=xvda1
|
if [ -d /dev/disk/by-partlabel ]; then
|
||||||
|
ROOT_DEV=$(basename $(readlink "/dev/disk/by-partlabel/Root\\x20filesystem"))
|
||||||
|
else
|
||||||
|
ROOT_DEV=$(grep -l "PARTNAME=Root filesystem" /sys/block/xvda/xvda*/uevent |\
|
||||||
|
grep -o "xvda[0-9]")
|
||||||
|
fi
|
||||||
|
if [ -z "$ROOT_DEV" ]; then
|
||||||
|
# fallback to third partition
|
||||||
|
ROOT_DEV=xvda3
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
ROOT_DEV=xvda
|
ROOT_DEV=xvda
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user