95fstab-sys: use det_fs and wrap_fsck

This patch mainly adds fsck functionality to fstab-sys, with additional
sanity checks (checking for device existence, verifying fstype via
det_fs).

Signed-off-by: Michal Soltys <soltys@ziu.info>
master
Michal Soltys 2011-05-20 17:09:25 +02:00 committed by Harald Hoyer
parent e2c5015713
commit 8b2896f9fa
2 changed files with 19 additions and 6 deletions

View File

@ -12,5 +12,7 @@ depends() {

install() {
dracut_install /etc/fstab.sys
dracut_install /sbin/fsck*
type -P e2fsck >/dev/null && dracut_install e2fsck
inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
}

View File

@ -2,14 +2,25 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

fstab_mount(){
local dev mp type opts rest
type getarg >/dev/null 2>&1 || . /lib/dracut-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 type opts rest; do
[ -z "${dev%%#*}" ]&& continue # Skip comment lines
mount -v -t $type -o $opts $dev $NEWROOT/$mp
done < $1 | vinfo
while read _dev _mp _fs _opts _dump _pass _rest; do
[ -z "${_dev%%#*}" ] && continue # Skip comment lines
if [ ! -e "$_dev" ]; then
warn "Device $_dev doesn't exist, skipping mount."
continue
fi
if [ "$_pass" -gt 0 ] && ! strstr "$_opts" _netdev; then
wrap_fsck "$_dev"
fi
_fs=$(det_fs "$_dev" "$_fs" /etc/fstab.sys)
info "Mounting $_dev"
mount -v -t $_fs -o $_opts $_dev $NEWROOT/$_mp 2>&1 | vinfo
done < $1
return 0
}