summaryrefslogtreecommitdiffstats
path: root/init_functions
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-08-01 01:55:47 +0200
committerDave Reisner <dreisner@archlinux.org>2011-10-22 16:48:39 +0200
commitb6554601442b00ddb67343a693718902ce7cd816 (patch)
tree425b9b399f1bebc7c6b618451d010aeab6a31ef8 /init_functions
parent2ad79d0f5b9b0af09f5cf4c61215e2ae7a25dbd5 (diff)
downloadmkinitcpio-b6554601442b00ddb67343a693718902ce7cd816.tar.gz
mkinitcpio-b6554601442b00ddb67343a693718902ce7cd816.tar.xz
init_functions: tighten up mount option gathering
* Directly assign ro or rw to the rwopt rather than using readwrite as an intermediary * Use a default expansion to cut out an if block in determining the root fstype. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'init_functions')
-rw-r--r--init_functions42
1 files changed, 16 insertions, 26 deletions
diff --git a/init_functions b/init_functions
index 609aff0..f235456 100644
--- a/init_functions
+++ b/init_functions
@@ -40,8 +40,7 @@ parse_cmdline() {
# The kernel passes those to init on its own
[0123456Ss]) ;;
single) ;;
- rw) readwrite="yes" ;;
- ro) readwrite="no" ;;
+ rw|ro) rwopt="$w" ;;
# only export stuff that does work with ash :)
*=*) rhs="$(echo "${w}" | cut -d= -f2-)"
lhs="$(echo "${w}" | cut -d= -f1 | sed 's|\.|_|g;s|-|_|g;')"
@@ -116,31 +115,22 @@ default_mount_handler() {
fi
fi
# We didn't build filesystem support into busybox,
- # instead we use util-linux-ng's blkid for best compatibility
- if [ -n "${rootfstype}" ]; then
- fstype="${rootfstype}"
- else
- fstype=$(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
- echo "You are now being dropped into an emergency shell."
- launch_interactive_shell
- msg "Trying to continue (this will most likely fail) ..."
- fi
- fi
- if [ "${readwrite}" = "yes" ]; then
- rwopt="rw"
- else
- rwopt="ro"
+ # 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
+ 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}${rootflags:+,${rootflags}} "${root}" "$1"
+ mount ${fstype:+-t $fstype} -o ${rwopt:-ro}${rootflags:+,$rootflags} "$root" "$1"
}
# vim: set ft=sh ts=4 sw=4 et: