fs-lib: add ability to choose fsck tools

in dracut.conf:

fscks="<tools>"
nofscks="yes"

and similary on command line:

--fscks [LIST] (in addition to conf's, if defined there)
--nofscks

Signed-off-by: Michal Soltys <soltys@ziu.info>
This commit is contained in:
Michal Soltys 2011-10-07 22:23:51 +02:00 committed by Harald Hoyer
parent 77270329ba
commit 25b45979f2
4 changed files with 40 additions and 11 deletions

13
dracut
View File

@ -59,6 +59,8 @@ Creates initial ramdisk images for preloading modules
--nomdadmconf Do not include local /etc/mdadm.conf
--lvmconf Include local /etc/lvm/lvm.conf
--nolvmconf Do not include local /etc/lvm/lvm.conf
--fscks [LIST] Add a space-separated list of fsck helpers.
--nofscks Inhibit installation of any fsck helpers.
-h, --help This message
--debug Output debug information of the build process
--profile Output profile information of the build process
@ -204,6 +206,8 @@ while (($# > 0)); do
--filesystems) push_arg filesystems_l "$@" || shift;;
-I|--install) push_arg install_items "$@" || shift;;
--fwdir) push_arg fw_dir_l "$@" || shift;;
--fscks) push_arg fscks_l "$@" || shift;;
--nofscks) nofscks_l="yes";;
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
-c|--conf) read_arg conffile "$@" || shift;;
--confdir) read_arg confdir "$@" || shift;;
@ -324,6 +328,12 @@ if (( ${#add_drivers_l[@]} )); then
done
fi
if (( ${#fscks_l[@]} )); then
while pop fscks_l val; do
fscks+=" $val "
done
fi
# these options override the stuff in the config file
if (( ${#dracutmodules_l[@]} )); then
dracutmodules=''
@ -379,6 +389,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $do_strip ]] || do_strip=no
[[ $compress_l ]] && compress=$compress_l
[[ $show_modules_l ]] && show_modules=$show_modules_l
[[ $nofscks_l ]] && nofscks="yes"
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }
@ -488,7 +499,7 @@ chmod 755 "$initdir"
export initdir dracutbasedir dracutmodules drivers \
fw_dir drivers_dir debug no_kernel kernel_only \
add_drivers mdadmconf lvmconf filesystems \
use_fstab libdir usrlibdir \
use_fstab libdir usrlibdir fscks nofscks \
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
debug

View File

@ -29,3 +29,12 @@ mdadmconf="yes"
# install local /etc/lvm/lvm.conf
lvmconf="yes"
# A list of fsck tools to install. If it's not specified, module's hardcoded
# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
# xfs_repair e2fsck jfs_fsck reiserfsck btrfsck". The installation is
# opportunistic, so non-existing tools are just ignored.
#fscks=""
# inhibit installation of any fsck tools
#nofscks="yes"

View File

@ -177,7 +177,7 @@ fsck_drv_std() {
# returns 255 if filesystem wasn't checked at all (e.g. due to lack of
# necessary tools or insufficient options)
fsck_single() {
local FSTAB_FILE=/etc/fstab.fslib
local FSTAB_FILE=/etc/fstab.empty
local _dev="$1"
local _fs="${2:-auto}"
local _fop="$3"
@ -197,13 +197,13 @@ fsck_single() {
# takes list of filesystems to check in parallel; we don't rely on automatic
# checking based on fstab, so empty one is passed
fsck_batch() {
local FSTAB_FILE=/etc/fstab.fslib
local FSTAB_FILE=/etc/fstab.empty
local _drv=fsck
local _dev
local _ret
local _out
[ $# -eq 0 ] && return 255
[ $# -eq 0 ] || ! type fsck >/dev/null 2>&1 && return 255
info "Checking filesystems (fsck -M -T -a):"
for _dev in "$@"; do

View File

@ -11,13 +11,22 @@ depends() {
}
install() {
dracut_install -o umount mount xfs_db xfs_check xfs_repair
dracut_install -o e2fsck
dracut_install -o jfs_fsck
dracut_install -o reiserfsck
dracut_install -o btrfsck
dracut_install -o /sbin/fsck*
local _helpers
inst "$moddir/fs-lib.sh" "/lib/fs-lib.sh"
touch ${initdir}/etc/fstab.fslib
touch ${initdir}/etc/fstab.empty
[[ "$nofscks" = "yes" ]] && return
if [[ "$fscks" = "${fscks#*[^ ]*}" ]]; then
_helpers="\
umount mount /sbin/fsck*
xfs_db xfs_check xfs_repair
e2fsck jfs_fsck reiserfsck btrfsck
"
else
_helpers="$fscks"
fi
dracut_install -o $_helpers
}