99fs-lib/module-setup.sh: only include fsck helper needed for hostonly

for the host-only initramfs, check all relevant disks for the
filesystem type and only include those fsck tools, which are needed.
master
Harald Hoyer 2011-11-09 09:04:59 +01:00
parent 470ee2d214
commit 1133b5e07a
1 changed files with 29 additions and 0 deletions

View File

@ -24,6 +24,35 @@ install() {
xfs_db xfs_check xfs_repair
e2fsck jfs_fsck reiserfsck btrfsck
"
if [[ $hostonly ]]; then
print_fs_type() { get_fs_type /dev/block/$1; }
_rootdev=$(find_root_block_device)
if [[ $_rootdev ]]; then
_helpers="umount mount "
for fs in $(check_block_and_slaves print_fs_type "$_rootdev"); do
case "$fs" in
xfs)
_helpers+=" xfs_db xfs_repair xfs_check "
;;
ext?)
_helpers+=" e2fsck "
;;
jfs)
_helpers+=" jfs_fsck "
;;
reiserfs)
_helpers+=" reiserfsck "
;;
btrfs)
_helpers+=" btrfsck "
;;
*)
[[ -x fsck.$fs ]] && _helpers+= " fsck.$fs "
;;
esac
done
fi
fi
else
_helpers="$fscks"
fi