|
Harald Hoyer |
12f6cc |
From 8aa9926839dc8ee861a44d21ae71fb33eee04ed1 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
12f6cc |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
12f6cc |
Date: Thu, 26 Jul 2012 17:22:14 +0200
|
|
Harald Hoyer |
12f6cc |
Subject: [PATCH] mv rootfs-block/module-setup.sh:search_option() in
|
|
Harald Hoyer |
12f6cc |
dracut-functions.sh
|
|
Harald Hoyer |
12f6cc |
|
|
Harald Hoyer |
12f6cc |
new function fs_get_option()
|
|
Harald Hoyer |
12f6cc |
---
|
|
Harald Hoyer |
12f6cc |
dracut-functions.sh | 20 ++++++++++++++++++++
|
|
Harald Hoyer |
12f6cc |
modules.d/95rootfs-block/module-setup.sh | 21 ++-------------------
|
|
Harald Hoyer |
12f6cc |
2 files changed, 22 insertions(+), 19 deletions(-)
|
|
Harald Hoyer |
12f6cc |
|
|
Harald Hoyer |
12f6cc |
diff --git a/dracut-functions.sh b/dracut-functions.sh
|
|
Harald Hoyer |
12f6cc |
index df450ef..fb28bdc 100755
|
|
Harald Hoyer |
12f6cc |
--- a/dracut-functions.sh
|
|
Harald Hoyer |
12f6cc |
+++ b/dracut-functions.sh
|
|
Harald Hoyer |
12f6cc |
@@ -454,6 +454,26 @@ check_vol_slaves() {
|
|
Harald Hoyer |
12f6cc |
return 1
|
|
Harald Hoyer |
12f6cc |
}
|
|
Harald Hoyer |
12f6cc |
|
|
Harald Hoyer |
12f6cc |
+# fs_get_option <filesystem options> <search for option>
|
|
Harald Hoyer |
12f6cc |
+# search for a specific option in a bunch of filesystem options
|
|
Harald Hoyer |
12f6cc |
+# and return the value
|
|
Harald Hoyer |
12f6cc |
+fs_get_option() {
|
|
Harald Hoyer |
12f6cc |
+ local _fsopts=$1
|
|
Harald Hoyer |
12f6cc |
+ local _option=$2
|
|
Harald Hoyer |
12f6cc |
+ local OLDIFS="$IFS"
|
|
Harald Hoyer |
12f6cc |
+ IFS=,
|
|
Harald Hoyer |
12f6cc |
+ set -- $_fsopts
|
|
Harald Hoyer |
12f6cc |
+ IFS="$OLDIFS"
|
|
Harald Hoyer |
12f6cc |
+ while [ $# -gt 0 ]; do
|
|
Harald Hoyer |
12f6cc |
+ case $1 in
|
|
Harald Hoyer |
12f6cc |
+ $_option=*)
|
|
Harald Hoyer |
12f6cc |
+ echo ${1#${_option}=}
|
|
Harald Hoyer |
12f6cc |
+ break
|
|
Harald Hoyer |
12f6cc |
+ esac
|
|
Harald Hoyer |
12f6cc |
+ shift
|
|
Harald Hoyer |
12f6cc |
+ done
|
|
Harald Hoyer |
12f6cc |
+}
|
|
Harald Hoyer |
12f6cc |
+
|
|
Harald Hoyer |
12f6cc |
if [[ $DRACUT_INSTALL ]]; then
|
|
Harald Hoyer |
12f6cc |
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
|
Harald Hoyer |
12f6cc |
inst_dir() {
|
|
Harald Hoyer |
12f6cc |
diff --git a/modules.d/95rootfs-block/module-setup.sh b/modules.d/95rootfs-block/module-setup.sh
|
|
Harald Hoyer |
12f6cc |
index 4d87fab..8254289 100755
|
|
Harald Hoyer |
12f6cc |
--- a/modules.d/95rootfs-block/module-setup.sh
|
|
Harald Hoyer |
12f6cc |
+++ b/modules.d/95rootfs-block/module-setup.sh
|
|
Harald Hoyer |
12f6cc |
@@ -2,23 +2,6 @@
|
|
Harald Hoyer |
12f6cc |
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
Harald Hoyer |
12f6cc |
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
Harald Hoyer |
12f6cc |
|
|
Harald Hoyer |
12f6cc |
-search_option() {
|
|
Harald Hoyer |
12f6cc |
- rootopts=$1
|
|
Harald Hoyer |
12f6cc |
- option=$2
|
|
Harald Hoyer |
12f6cc |
- local OLDIFS="$IFS"
|
|
Harald Hoyer |
12f6cc |
- IFS=,
|
|
Harald Hoyer |
12f6cc |
- set -- $rootopts
|
|
Harald Hoyer |
12f6cc |
- IFS="$OLDIFS"
|
|
Harald Hoyer |
12f6cc |
- while [ $# -gt 0 ]; do
|
|
Harald Hoyer |
12f6cc |
- case $1 in
|
|
Harald Hoyer |
12f6cc |
- $option=*)
|
|
Harald Hoyer |
12f6cc |
- echo ${1#${option}=}
|
|
Harald Hoyer |
12f6cc |
- break
|
|
Harald Hoyer |
12f6cc |
- esac
|
|
Harald Hoyer |
12f6cc |
- shift
|
|
Harald Hoyer |
12f6cc |
- done
|
|
Harald Hoyer |
12f6cc |
-}
|
|
Harald Hoyer |
12f6cc |
-
|
|
Harald Hoyer |
12f6cc |
check() {
|
|
Harald Hoyer |
12f6cc |
rootopts="defaults"
|
|
Harald Hoyer |
12f6cc |
while read dev mp fs opts dump fsck; do
|
|
Harald Hoyer |
12f6cc |
@@ -34,8 +17,8 @@ check() {
|
|
Harald Hoyer |
12f6cc |
fi
|
|
Harald Hoyer |
12f6cc |
done < "$NEWROOT/etc/fstab"
|
|
Harald Hoyer |
12f6cc |
|
|
Harald Hoyer |
12f6cc |
- [ "$rootfs" = "reiserfs" ] && journaldev=$(search_option $rootopts "jdev")
|
|
Harald Hoyer |
12f6cc |
- [ "$rootfs" = "xfs" ] && journaldev=$(search_option $rootopts "logdev")
|
|
Harald Hoyer |
12f6cc |
+ [ "$rootfs" = "reiserfs" ] && journaldev=$(fs_get_option $rootopts "jdev")
|
|
Harald Hoyer |
12f6cc |
+ [ "$rootfs" = "xfs" ] && journaldev=$(fs_get_option $rootopts "logdev")
|
|
Harald Hoyer |
12f6cc |
if [ -n "$journaldev" ]; then
|
|
Harald Hoyer |
12f6cc |
echo "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-jurnaldev.conf"
|
|
Harald Hoyer |
12f6cc |
fi
|