Improve handling of missing /etc/fstab
authorSebastian Pipping <sebastian@pipping.org>
Fri, 16 Mar 2012 22:36:30 +0000 (23:36 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Fri, 16 Mar 2012 22:36:30 +0000 (23:36 +0100)
ChangeLog
defaults/initrd.scripts
defaults/linuxrc

index 55f55691255a5af25f63390b8a662e7b4b4bd1f7..4a306aee0c011fbb7f7826794b645e8a9cb014d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
 # Distributed under the GPL v2
 # $Id$
 
+  16 Mar 2012; Sebastian Pipping <sping@gentoo.org> defaults/initrd.scripts,
+  defaults/linuxrc:
+  Improve handling of missing /etc/fstab
+
   16 Mar 2012; Sebastian Pipping <sping@gentoo.org> defaults/initrd.scripts:
   No longer use parameter "-r" (for regex intervals) that busybox awk does not
   support
index f504c3f4224e7fa2cc4a9d8afcaac389ce5bbfba..296b150fa8d73af3115d23923a8596e2abeab279 100755 (executable)
@@ -1205,6 +1205,7 @@ get_mounts_list()
 
 get_mount_fstype()
 {
+       [ -e "${NEW_ROOT}"/etc/fstab ] || return 1
        awk -v fs="$1" '
                /^[[:blank:]]*#/ { next }
                $2 == fs { print $3 }
@@ -1213,6 +1214,7 @@ get_mount_fstype()
 
 get_mount_options()
 {
+       [ -e "${NEW_ROOT}"/etc/fstab ] || return 1
        awk -v fs="$1" '
                /^[[:blank:]]*#/ { next }
                $2 == fs { print $4 }
@@ -1221,6 +1223,7 @@ get_mount_options()
 
 get_mount_device()
 {
+       [ -e "${NEW_ROOT}"/etc/fstab ] || return 1
        awk -v fs="$1" '
                /^[[:blank:]]*#/ { next }
                $2 == fs { print $1 }
index b883155a791f5117741e0291dddeaca025a17b3f..34f1d699987a00ceb2550afaee6f719183b63e47 100755 (executable)
@@ -776,6 +776,7 @@ fi
 
 for fs in $fslist; do
        dev=$(get_mount_device $fs)
+       [ -z "${dev}" ] && continue
        # Resolve it like util-linux mount does
        [ -L ${dev} ] && dev=`readlink ${dev}`
        # In this case, it's probably part of the filesystem