]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
mv rootfs-block/module-setup.sh:search_option() in dracut-functions.sh
authorHarald Hoyer <harald@redhat.com>
Thu, 26 Jul 2012 15:22:14 +0000 (17:22 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 26 Jul 2012 15:24:01 +0000 (17:24 +0200)
new function fs_get_option()

dracut-functions.sh
modules.d/95rootfs-block/module-setup.sh

index df450ef856f1b34ab7708339ab0189e4c0b44cb1..fb28bdc57842978fa0087e7bea48e703f9ba071a 100755 (executable)
@@ -454,6 +454,26 @@ check_vol_slaves() {
     return 1
 }
 
+# fs_get_option <filesystem options> <search for option>
+# search for a specific option in a bunch of filesystem options
+# and return the value
+fs_get_option() {
+    local _fsopts=$1
+    local _option=$2
+    local OLDIFS="$IFS"
+    IFS=,
+    set -- $_fsopts
+    IFS="$OLDIFS"
+    while [ $# -gt 0 ]; do
+        case $1 in
+            $_option=*)
+                echo ${1#${_option}=}
+                break
+        esac
+        shift
+    done
+}
+
 if [[ $DRACUT_INSTALL ]]; then
     [[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
     inst_dir() {
index 4d87fab17c7e1a981b8e85bcf0fc62f190011de7..8254289973474d7ef659c0c69fe070ecc0270e69 100755 (executable)
@@ -2,23 +2,6 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
-search_option() {
-    rootopts=$1
-    option=$2
-    local OLDIFS="$IFS"
-    IFS=,
-    set -- $rootopts
-    IFS="$OLDIFS"
-    while [ $# -gt 0 ]; do
-        case $1 in
-            $option=*)
-                echo ${1#${option}=}
-                break
-        esac
-        shift
-    done
-}
-
 check() {
         rootopts="defaults"
         while read dev mp fs opts dump fsck; do
@@ -34,8 +17,8 @@ check() {
             fi
         done < "$NEWROOT/etc/fstab"
 
-        [ "$rootfs" = "reiserfs" ] && journaldev=$(search_option $rootopts "jdev")
-        [ "$rootfs" = "xfs" ] && journaldev=$(search_option $rootopts "logdev")
+        [ "$rootfs" = "reiserfs" ] && journaldev=$(fs_get_option $rootopts "jdev")
+        [ "$rootfs" = "xfs" ] && journaldev=$(fs_get_option $rootopts "logdev")
         if [ -n "$journaldev" ]; then
             echo "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-jurnaldev.conf"
         fi