|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
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
|
|
|
type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
|
|
|
|
|
|
|
|
fstab_mount() {
|
|
|
|
local _dev _mp _fs _opts _dump _pass _rest
|
|
|
|
test -e "$1" || return 1
|
|
|
|
info "Mounting from $1"
|
|
|
|
while read _dev _mp _fs _opts _dump _pass _rest || [ -n "$_dev" ]; do
|
|
|
|
[ -z "${_dev%%#*}" ] && continue # Skip comment lines
|
|
|
|
ismounted $_mp && continue # Skip mounted filesystem
|
|
|
|
if [ "$_pass" -gt 0 ] && ! strstr "$_opts" _netdev; then
|
|
|
|
fsck_single "$_dev" "$_fs" "$_opts"
|
|
|
|
fi
|
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
|
|
|
_fs=$(det_fs "$_dev" "$_fs")
|
|
|
|
info "Mounting $_dev"
|
|
|
|
if [ -d "$NEWROOT/$_mp" ]; then
|
|
|
|
mount -v -t $_fs -o $_opts $_dev "$NEWROOT/$_mp" 2>&1 | vinfo
|
|
|
|
else
|
|
|
|
[ -d "$_mp" ] || mkdir -p "$_mp"
|
|
|
|
mount -v -t $_fs -o $_opts $_dev $_mp 2>&1 | vinfo
|
|
|
|
fi
|
|
|
|
done < $1
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# systemd will mount and run fsck from /etc/fstab and we don't want to
|
|
|
|
# run into a race condition.
|
|
|
|
if [ -z "$DRACUT_SYSTEMD" ]; then
|
|
|
|
[ -f /etc/fstab ] && fstab_mount /etc/fstab
|
|
|
|
fi
|
|
|
|
|
|
|
|
# prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
|
|
|
|
if [ -f $NEWROOT/etc/fstab.sys ]; then
|
|
|
|
fstab_mount $NEWROOT/etc/fstab.sys
|
|
|
|
elif [ -f /etc/fstab.sys ]; then
|
|
|
|
fstab_mount /etc/fstab.sys
|
|
|
|
fi
|