#!/sbin/sh
#
# mountfsys	Mount all file systems.
#
# Version:	@(#) /sbin/init.d/mountfsys 1.01 30-Dec-1993
#
# Author:	Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#

  # See how we were called.
  case "$1" in
    bcheckrc)
	echo "Bcheckrc: Clearing and mounting all local file systems"
        /bin/mount  -no  remount,rw /

	rm -f /etc/mtab* \
	      /etc/nologin \
	      /etc/utmp \
	      /var/adm/wtmp \
	      /etc/fastboot

	# Looks like we have to create this.
	> /etc/utmp
	> /var/adm/wtmp

	rm -f /etc/issue
	echo >  /etc/issue
        echo Welcome to Linux `uname -a | cut -d\  -f3`. >> /etc/issue
	echo >> /etc/issue

	# Remove stale hunt sockets so the game can start.
	    if [ -r /tmp/hunt -o -r /tmp/hunt.stats ]; then
	    echo "Removing your stale hunt sockets from /tmp..."
	    rm -f /tmp/hunt*
	fi

	# Remove stale locks (must be done after mount -a!)
	rm -f /var/spool/locks/*     > /dev/null  2>&1
	rm -f /var/spool/locks/*/*   > /dev/null  2>&1
	rm -f /var/spool/uucp/LCK.*  > /dev/null  2>&1
	rm -f /tmp/.X*lock           > /dev/null  2>&1

	##rm -f /etc/motd
	##echo "`uname -a | cut -d\  -f1,3`. (POSIX)." > /etc/motd

	# /proc should be done
	/bin/mount  -avt nonfs,noproc
	;;
    start)
	/bin/mount  -avt nonfs,noproc
	;;
    stop)
	echo "Unmounting all local file systems"
	/bin/umount  -avt nonfs,noproc
	;;
    *)
	# Oops someone made a typo.
	echo "Usage: /sbin/init.d/mountfsys {bcheckrc|start|stop}"
	exit 1
  esac

exit 0
