#!/bin/sh
# We mount all filesystems other than /, /usr, /var, and /proc here
# and provide a way to unmount them.

. /etc/system_config

case "$1" in
'start')
   echo "$0: Start MOUNT"
   FS=`awk '{print $2}' < /etc/fstab |
      /usr/bin/egrep -v -e '^/$|^/usr$|^/var$|^/proc$' |
      /usr/bin/grep '^/'`
   for f in $FS
   do
      echo Checking $f
      /sbin/fsck -a $f
      if [ $? -lt 1 ]; then
         echo Mounting $f
         /sbin/mount $f
      fi
   done
   ;;
'stop')
   echo "$0: Stop MOUNT"
   FS=`/sbin/mount |
      /usr/bin/awk '{print $3}' |
      /usr/bin/egrep -v -e '^/$|^/usr$|^/var$|^/proc$' |
      /usr/bin/grep '^/'`
   for f in $FS; do
      echo Unmounting $f
      /sbin/umount $f
   done
   ;;
*)
   echo "Usage: $0 { start | stop }"
   ;;
esac
