initrd.scripts: simplify rootdev_init() further

master
Fabio Erculiani 12 years ago
parent 5f9050e1a6
commit 2496e36843

@ -1607,15 +1607,19 @@ rootdev_init() {
good_msg "Mounting ${REAL_ROOT} as root..." good_msg "Mounting ${REAL_ROOT} as root..."
# Try to mount the device as ${NEW_ROOT} # Try to mount the device as ${NEW_ROOT}
local out=1
if is_nfs; then if is_nfs; then
find_nfs # sets ${?} checked below find_nfs && out=0
else else
_rootdev_mount # sets ${?} checked below _rootdev_mount && out=0
fi
if [ "${out}" != "0" ]; then
bad_msg "Could not mount specified ROOT, try again"
prompt_user "REAL_ROOT" "root block device"
continue
fi fi
# If mount is successful break out of the loop
# else not a good root and start over.
if [ "${?}" = "0" ]; then
# now that the root filesystem is mounted, before # now that the root filesystem is mounted, before
# checking the validity of ${NEW_ROOT} and ${REAL_INIT}, # checking the validity of ${NEW_ROOT} and ${REAL_INIT},
# ensure that ${NEW_ROOT}/etc/initramfs.mounts entries # ensure that ${NEW_ROOT}/etc/initramfs.mounts entries
@ -1623,9 +1627,7 @@ rootdev_init() {
ensure_initramfs_mounts ensure_initramfs_mounts
# NFS does not need further checks here. # NFS does not need further checks here.
if is_nfs; then is_nfs && break
break
fi
if [ ! -d "${NEW_ROOT}/dev" ]; then if [ ! -d "${NEW_ROOT}/dev" ]; then
_msg="The filesystem ${REAL_ROOT}," _msg="The filesystem ${REAL_ROOT},"
@ -1633,6 +1635,8 @@ rootdev_init() {
_msg="${_msg} does not contain /dev" _msg="${_msg} does not contain /dev"
_msg="${_msg}, init will likely fail..." _msg="${_msg}, init will likely fail..."
bad_msg "${_msg}" bad_msg "${_msg}"
prompt_user "REAL_ROOT" "root block device"
continue
fi fi
if [ ! -x "${NEW_ROOT}${REAL_INIT}" ]; then if [ ! -x "${NEW_ROOT}${REAL_INIT}" ]; then
_msg="The filesystem ${REAL_ROOT}," _msg="The filesystem ${REAL_ROOT},"
@ -1640,12 +1644,10 @@ rootdev_init() {
_msg="${_msg} does not contain a valid" _msg="${_msg} does not contain a valid"
_msg="${_msg} init=${REAL_INIT}" _msg="${_msg} init=${REAL_INIT}"
bad_msg "${_msg}" bad_msg "${_msg}"
prompt_user "REAL_ROOT" "root block device"
continue
fi fi
break break
else
bad_msg "Could not mount specified ROOT, try again"
REAL_ROOT=''
fi
done done
} }

Loading…
Cancel
Save