|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# called by dracut
|
|
|
|
check() {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# called by dracut
|
implement fs-lib, squash a few bugs that were part of det_fs/wrap_fsck
To not pollute dracut-lib.sh, all the fsck related functions were moved
to fs-lib.sh. The functions available are as follows:
- fsck_single
this will detect/verify filesystem, check if it has necessary tools and
check the filesystem respecting additional flags (if any), using
specific "driver" (or falling back to generic one). Currently
available: fsck_drv_{com,xfs,std}. 'com' is used for tools following
typical subset of options/return codes (e.g. ext, jfs), 'std' is used
for "unknown" fs and doesn't assume it can be run non-interactively.
Please see comments around the code for more info.
- fsck_batch
this will check provided list of the devices;
Both of the above functions will fake empty fstab, to make generic fsck
not complain too much (excact devices are always provided on the command
line).
"Known" filesystems currently: ext234, reiser, jfs, xfs
- det_fs
Small bug fixed - as this function is meant to be called in $(), it may
not be verbose.
Current behaviour is:
- if detection is successful, use its result
- if detection is not successful, and filesystem is provided, return
the provided one; otherwise use auto
14 years ago
|
|
|
depends() {
|
|
|
|
echo fs-lib
|
|
|
|
}
|
|
|
|
|
|
|
|
cmdline_journal() {
|
|
|
|
if [[ $hostonly ]]; then
|
|
|
|
for dev in "${!host_fs_types[@]}"; do
|
|
|
|
[[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
|
|
|
|
rootopts=$(find_dev_fsopts "$dev")
|
|
|
|
if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
|
|
|
|
journaldev=$(fs_get_option $rootopts "jdev")
|
|
|
|
elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
|
|
|
|
journaldev=$(fs_get_option $rootopts "logdev")
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$journaldev" ]; then
|
|
|
|
printf " root.journaldev=%s" "$journaldev"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# called by dracut
|
|
|
|
cmdline() {
|
|
|
|
local dev=/dev/block/$(find_root_block_device)
|
|
|
|
if [ -e $dev ]; then
|
|
|
|
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
|
|
|
|
printf " rootflags=%s" "$(find_mp_fsopts /)"
|
|
|
|
printf " rootfstype=%s" "$(find_mp_fstype /)"
|
|
|
|
fi
|
|
|
|
cmdline_journal
|
|
|
|
}
|
|
|
|
|
|
|
|
# called by dracut
|
|
|
|
install() {
|
|
|
|
if [[ $hostonly_cmdline == "yes" ]]; then
|
|
|
|
local _journaldev=$(cmdline_journal)
|
|
|
|
[[ $_journaldev ]] && printf "%s\n" "$_journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
|
|
|
|
fi
|
|
|
|
|
|
|
|
inst_multiple umount
|
|
|
|
inst_multiple tr
|
|
|
|
if ! dracut_module_included "systemd"; then
|
|
|
|
inst_hook cmdline 95 "$moddir/parse-block.sh"
|
|
|
|
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
|
|
|
|
inst_hook mount 99 "$moddir/mount-root.sh"
|
|
|
|
fi
|
|
|
|
|
|
|
|
inst_hook initqueue/timeout 99 "$moddir/rootfallback.sh"
|
|
|
|
}
|