Browse Source

mv rootfs-block/module-setup.sh:search_option() in dracut-functions.sh

new function fs_get_option()
master
Harald Hoyer 12 years ago
parent
commit
8aa9926839
  1. 20
      dracut-functions.sh
  2. 21
      modules.d/95rootfs-block/module-setup.sh

20
dracut-functions.sh

@ -454,6 +454,26 @@ check_vol_slaves() { @@ -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() {

21
modules.d/95rootfs-block/module-setup.sh

@ -2,23 +2,6 @@ @@ -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() { @@ -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

Loading…
Cancel
Save