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>master
parent
77270329ba
commit
25b45979f2
13
dracut
13
dracut
|
@ -59,6 +59,8 @@ Creates initial ramdisk images for preloading modules
|
||||||
--nomdadmconf Do not include local /etc/mdadm.conf
|
--nomdadmconf Do not include local /etc/mdadm.conf
|
||||||
--lvmconf Include local /etc/lvm/lvm.conf
|
--lvmconf Include local /etc/lvm/lvm.conf
|
||||||
--nolvmconf Do not 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
|
-h, --help This message
|
||||||
--debug Output debug information of the build process
|
--debug Output debug information of the build process
|
||||||
--profile Output profile 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;;
|
--filesystems) push_arg filesystems_l "$@" || shift;;
|
||||||
-I|--install) push_arg install_items "$@" || shift;;
|
-I|--install) push_arg install_items "$@" || shift;;
|
||||||
--fwdir) push_arg fw_dir_l "$@" || 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;;
|
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
|
||||||
-c|--conf) read_arg conffile "$@" || shift;;
|
-c|--conf) read_arg conffile "$@" || shift;;
|
||||||
--confdir) read_arg confdir "$@" || shift;;
|
--confdir) read_arg confdir "$@" || shift;;
|
||||||
|
@ -324,6 +328,12 @@ if (( ${#add_drivers_l[@]} )); then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if (( ${#fscks_l[@]} )); then
|
||||||
|
while pop fscks_l val; do
|
||||||
|
fscks+=" $val "
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# these options override the stuff in the config file
|
# these options override the stuff in the config file
|
||||||
if (( ${#dracutmodules_l[@]} )); then
|
if (( ${#dracutmodules_l[@]} )); then
|
||||||
dracutmodules=''
|
dracutmodules=''
|
||||||
|
@ -379,6 +389,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||||
[[ $do_strip ]] || do_strip=no
|
[[ $do_strip ]] || do_strip=no
|
||||||
[[ $compress_l ]] && compress=$compress_l
|
[[ $compress_l ]] && compress=$compress_l
|
||||||
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
||||||
|
[[ $nofscks_l ]] && nofscks="yes"
|
||||||
# eliminate IFS hackery when messing with fw_dir
|
# eliminate IFS hackery when messing with fw_dir
|
||||||
fw_dir=${fw_dir//:/ }
|
fw_dir=${fw_dir//:/ }
|
||||||
|
|
||||||
|
@ -488,7 +499,7 @@ chmod 755 "$initdir"
|
||||||
export initdir dracutbasedir dracutmodules drivers \
|
export initdir dracutbasedir dracutmodules drivers \
|
||||||
fw_dir drivers_dir debug no_kernel kernel_only \
|
fw_dir drivers_dir debug no_kernel kernel_only \
|
||||||
add_drivers mdadmconf lvmconf filesystems \
|
add_drivers mdadmconf lvmconf filesystems \
|
||||||
use_fstab libdir usrlibdir \
|
use_fstab libdir usrlibdir fscks nofscks \
|
||||||
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
||||||
debug
|
debug
|
||||||
|
|
||||||
|
|
|
@ -29,3 +29,12 @@ mdadmconf="yes"
|
||||||
|
|
||||||
# install local /etc/lvm/lvm.conf
|
# install local /etc/lvm/lvm.conf
|
||||||
lvmconf="yes"
|
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"
|
||||||
|
|
|
@ -177,7 +177,7 @@ fsck_drv_std() {
|
||||||
# returns 255 if filesystem wasn't checked at all (e.g. due to lack of
|
# returns 255 if filesystem wasn't checked at all (e.g. due to lack of
|
||||||
# necessary tools or insufficient options)
|
# necessary tools or insufficient options)
|
||||||
fsck_single() {
|
fsck_single() {
|
||||||
local FSTAB_FILE=/etc/fstab.fslib
|
local FSTAB_FILE=/etc/fstab.empty
|
||||||
local _dev="$1"
|
local _dev="$1"
|
||||||
local _fs="${2:-auto}"
|
local _fs="${2:-auto}"
|
||||||
local _fop="$3"
|
local _fop="$3"
|
||||||
|
@ -197,13 +197,13 @@ fsck_single() {
|
||||||
# takes list of filesystems to check in parallel; we don't rely on automatic
|
# takes list of filesystems to check in parallel; we don't rely on automatic
|
||||||
# checking based on fstab, so empty one is passed
|
# checking based on fstab, so empty one is passed
|
||||||
fsck_batch() {
|
fsck_batch() {
|
||||||
local FSTAB_FILE=/etc/fstab.fslib
|
local FSTAB_FILE=/etc/fstab.empty
|
||||||
local _drv=fsck
|
local _drv=fsck
|
||||||
local _dev
|
local _dev
|
||||||
local _ret
|
local _ret
|
||||||
local _out
|
local _out
|
||||||
|
|
||||||
[ $# -eq 0 ] && return 255
|
[ $# -eq 0 ] || ! type fsck >/dev/null 2>&1 && return 255
|
||||||
|
|
||||||
info "Checking filesystems (fsck -M -T -a):"
|
info "Checking filesystems (fsck -M -T -a):"
|
||||||
for _dev in "$@"; do
|
for _dev in "$@"; do
|
||||||
|
|
|
@ -11,13 +11,22 @@ depends() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
dracut_install -o umount mount xfs_db xfs_check xfs_repair
|
local _helpers
|
||||||
dracut_install -o e2fsck
|
|
||||||
dracut_install -o jfs_fsck
|
|
||||||
dracut_install -o reiserfsck
|
|
||||||
dracut_install -o btrfsck
|
|
||||||
dracut_install -o /sbin/fsck*
|
|
||||||
|
|
||||||
inst "$moddir/fs-lib.sh" "/lib/fs-lib.sh"
|
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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue