+
+get_mounts_list()
+{
+ awk '
+ /^[[:blank:]]*#/ { next }
+ { print $1 }
+ ' ${NEW_ROOT}/etc/initramfs.mounts
+}
+
+get_mount_fstype()
+{
+ [ -e "${NEW_ROOT}"/etc/fstab ] || return 1
+ awk -v fs="$1" '
+ /^[[:blank:]]*#/ { next }
+ $2 == fs { print $3 }
+ ' ${NEW_ROOT}/etc/fstab
+}
+
+get_mount_options()
+{
+ [ -e "${NEW_ROOT}"/etc/fstab ] || return 1
+ awk -v fs="$1" '
+ /^[[:blank:]]*#/ { next }
+ $2 == fs { print $4 }
+ ' ${NEW_ROOT}/etc/fstab
+}
+
+get_mount_device()
+{
+ [ -e "${NEW_ROOT}"/etc/fstab ] || return 1
+ awk -v fs="$1" '
+ /^[[:blank:]]*#/ { next }
+ $2 == fs { print $1 }
+ ' ${NEW_ROOT}/etc/fstab
+}
+
+# If the kernel is handed a mount option is does not recognize, it WILL fail to
+# mount. util-linux handles auto/noauto, but busybox passes it straight to the kernel
+# which then rejects the mount.
+# To make like a little easier, busybox mount does not care about leading,
+# trailing or duplicate commas.
+strip_mount_options()
+{
+ sed -r 's/(,|^)(no)?auto(,|$)/,/g'
+}