[arch-projects] [mkinitcpio][PATCH 07/11] init: use util-linux's /bin/mount

Dave Reisner d at falconindy.com
Fri Nov 11 21:55:17 EST 2011


Providing this means we no longer need blkid for FS detection, as mount
will do this for us. Adds a slight bloat to the image, in exchange for a
huge convenience. Messaging is changed to assume that /bin/mount will
provide useful feedback for us on failure.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 init_functions |   15 ++-------------
 install/base   |    3 +++
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/init_functions b/init_functions
index 7dd0968..33a749f 100644
--- a/init_functions
+++ b/init_functions
@@ -117,23 +117,12 @@ default_mount_handler() {
             msg "Trying to continue (this will most likely fail) ..."
         fi
     fi
-    # We didn't build filesystem support into busybox,
-    # instead we use util-linux's blkid for best compatibility
-    fstype=${rootfstype:-$(blkid -u filesystem -o value -s TYPE -p "$root")}
-    if [ -z "$fstype" ]; then
-        err "Unable to determine the file system type of ${root}:"
-        echo "Either it contains no filesystem, an unknown filesystem,"
-        echo "or more than one valid file system signature was found."
-        echo
-        echo "Try adding"
-        echo "    rootfstype=your_filesystem_type"
-        echo "to the kernel command line."
-        echo
+
+    if ! mount ${fstype:+-t $fstype} -o ${rwopt:-ro}${rootflags:+,$rootflags} "$root" "$1"; then
         echo "You are now being dropped into an emergency shell."
         launch_interactive_shell
         msg "Trying to continue (this will most likely fail) ..."
     fi
-    mount ${fstype:+-t $fstype} -o ${rwopt:-ro}${rootflags:+,$rootflags} "$root" "$1"
 }
 
 # vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/base b/install/base
index 1f2b3b8..3d18fe0 100644
--- a/install/base
+++ b/install/base
@@ -8,6 +8,9 @@ build() {
     add_binary /lib/initcpio/busybox /bin/busybox
     add_binary /sbin/modprobe
     add_binary /sbin/blkid
+    add_binary /bin/mount
+
+    add_symlink "/etc/mtab" "/proc/self/mounts"
 
     add_file "/lib/initcpio/init_functions" "/init_functions"
     add_file "/lib/initcpio/init" "/init"
-- 
1.7.7.3



More information about the arch-projects mailing list