netbsd fsck driver import

. fsck driver parses /etc/fstab and invokes sub-fscks
	. further simplifies fs handling in rc
This commit is contained in:
Ben Gras
2011-12-22 22:51:26 +01:00
parent 6b6d114a21
commit 4d4057d8a2
46 changed files with 5470 additions and 66 deletions

View File

@@ -71,6 +71,13 @@
755 root operator /usr/include/rpcsvc
755 root operator /usr/include/ssp
755 root operator /usr/include/sys
755 root operator /usr/include/ufs
755 root operator /usr/include/ufs/chfs
755 root operator /usr/include/ufs/ext2fs
755 root operator /usr/include/ufs/ffs
755 root operator /usr/include/ufs/lfs
755 root operator /usr/include/ufs/mfs
755 root operator /usr/include/ufs/ufs
700 root operator /usr/preserve
755 root operator /usr/run
755 root operator /usr/share

9
etc/rc
View File

@@ -114,8 +114,10 @@ start)
# options for fsck. default is -r, which prompts the user for repairs.
fsckopts="`sysenv fsckopts`"
if [ ! "$fsckopts" ]
then fsckopts=-r
optname=fsckopts
fsckopts=-p
if sysenv $optname >/dev/null
then fsckopts="`sysenv $optname`"
fi
if [ "`sysenv debug_fkeys`" != 0 ]
@@ -160,7 +162,8 @@ start)
read <$FSTAB fstabline
if [ "$fstabline" = "# Poor man's File System Table." ]
then mountfstab_poorman # Old minix /etc/fstab
else mountfstab $fflag -o"$fsckopts" $FSTAB
else fsck -x / $fflag $fsckopts
mountfstab $FSTAB
fi
fi

View File

@@ -1,21 +1,6 @@
mountfstab()
{
fsck_opts=""
fflag="-p"
while getopts "fo:" opt
do case $opt
in f) fflag="-f"
;;
o) fsck_opts="$OPTARG"
;;
*) echo "mountfstab: odd"
return 1
;;
esac
done
shift `expr $OPTIND - 1`
fstabfile="$1"
@@ -37,23 +22,13 @@ mountfstab()
# This line's parameters
dev="$1"; mp="$2"; fstype="$3"
# Don't fsck / as it's already mounted
# Don't mount / as it's already mounted
if [ "$mp" = "/" ]; then continue; fi
# Sanity checks
if [ ! -b $dev ]; then echo "$dev missing"; continue; fi
if [ ! -d $mp ]; then echo "$mp missing"; continue; fi
# Do fsck if necessary or requested
if [ -n "$fflag" ]
then fsck.$fstype $fflag $fsck_opts $dev
fi
# Skip the actual mount for /, it's already mounted
if [ "$mp" = / ]
then continue
fi
# Do actual mount command
mount -t $fstype $dev $mp
done