aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-07-23 22:00:12 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-07-23 22:00:12 +0200
commit0048f44c081dce2e296b48c71a208abf2a815c84 (patch)
tree65a5a5e098b297c6c2b4931931ebdf5c7837ce10 /defaults
parentkmod: remove hardcoded $BROOT value (diff)
downloadgenkernel-0048f44c081dce2e296b48c71a208abf2a815c84.tar.gz
genkernel-0048f44c081dce2e296b48c71a208abf2a815c84.tar.bz2
genkernel-0048f44c081dce2e296b48c71a208abf2a815c84.zip
defaults/linuxrc: Support devices with symlinks
/dev/vg/foo can be a symlink to ../dm-1. This commit will allow to use such a value for devices, i.e. ROOT=/dev/vg/foo. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'defaults')
-rw-r--r--defaults/initrd.scripts24
-rw-r--r--defaults/linuxrc5
2 files changed, 20 insertions, 9 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 6dc588f..3bede8a 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -905,31 +905,39 @@ findnfsmount() {
}
find_real_device() {
- local DEVICE="${1}"
- case "${DEVICE}" in
+ local device="${1}"
+ local real_device=
+ local candidate=
+ case "${device}" in
UUID\=*|LABEL\=*|PARTLABEL=*|PARTUUID\=*)
- local REAL_DEVICE=""
local retval=1
if [ ${retval} -ne 0 ]
then
- REAL_DEVICE=$(findfs "${DEVICE}" 2>/dev/null)
+ candidate=$(findfs "${device}" 2>/dev/null)
retval=$?
fi
if [ ${retval} -ne 0 ]
then
- REAL_DEVICE=$(blkid -o device -l -t "${DEVICE}" 2>/dev/null)
+ candidate=$(blkid -o device -l -t "${device}" 2>/dev/null)
retval=$?
fi
- if [ ${retval} -eq 0 ] && [ -n "${REAL_DEVICE}" ]
+ if [ ${retval} -eq 0 ] && [ -n "${candidate}" ]
then
- DEVICE="${REAL_DEVICE}"
+ real_device="${candidate}"
fi
;;
+ *)
+ candidate=$(readlink -f "${device}")
+ if [ -b "${candidate}" ]
+ then
+ real_device="${candidate}"
+ fi
esac
- printf "%s" "${DEVICE}"
+
+ printf "%s" "${real_device}"
}
check_loop() {
diff --git a/defaults/linuxrc b/defaults/linuxrc
index 5354d09..f1357f6 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -783,15 +783,18 @@ do
fi
;;
*)
- if [ -b "${REAL_ROOT}" ]
+ ROOT_DEV=$(readlink -f "${REAL_ROOT}")
+ if [ -b "${ROOT_DEV}" ]
then
got_good_root=1
+ REAL_ROOT=${ROOT_DEV}
echo
good_msg "Root device detected as ${REAL_ROOT}!"
break
fi
;;
esac
+ unset ROOT_DEV
if [ "${got_good_root}" != '1' ]
then