2011-11-09 16:34:47 +01:00
|
|
|
|
|
|
|
mountfstab()
|
|
|
|
{
|
|
|
|
shift `expr $OPTIND - 1`
|
|
|
|
|
|
|
|
fstabfile="$1"
|
|
|
|
|
|
|
|
if [ ! -f $fstabfile ]
|
|
|
|
then echo "mountfstab: $fstabfile not found"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat $fstabfile | sed 's/#.*//' | while read fsline
|
|
|
|
do set "" $fsline
|
|
|
|
shift
|
|
|
|
if [ $# -eq 0 ]; then continue; fi
|
|
|
|
if [ $# -lt 3 ]
|
|
|
|
then echo "$fstabfile: short line"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
# This line's parameters
|
|
|
|
dev="$1"; mp="$2"; fstype="$3"
|
|
|
|
|
2011-12-22 22:51:26 +01:00
|
|
|
# Don't mount / as it's already mounted
|
2011-12-22 01:29:27 +01:00
|
|
|
if [ "$mp" = "/" ]; then continue; fi
|
|
|
|
|
2011-11-09 16:34:47 +01:00
|
|
|
# Sanity checks
|
|
|
|
if [ ! -b $dev ]; then echo "$dev missing"; continue; fi
|
|
|
|
if [ ! -d $mp ]; then echo "$mp missing"; continue; fi
|
|
|
|
|
|
|
|
# Do actual mount command
|
|
|
|
mount -t $fstype $dev $mp
|
|
|
|
done
|
|
|
|
}
|