#!/bin/sh
# Begin $rc_base/init.d/mountfs - File System Mount Script

# Based on mountfs script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org

. /etc/sysconfig/rc
. $rc_functions

case "$1" in
	start)
		echo "Remounting root file system in read-write mode..."
		mount -n -o remount,rw /
		evaluate_retval

		# Remove fsck-related file system watermarks.
		rm -f /fastboot /forcefsck

		echo "Recording existing mounts in /etc/mtab..."
		> /etc/mtab
		mount -f / || failed=1
		mount -f /proc || failed=1
		if grep -q '[[:space:]]sysfs' /proc/mounts ; then
			mount -f /sys || failed=1
		fi
		(exit $failed)
		evaluate_retval

		# This will mount all filesystems that do not have _netdev in
		# their option list.  _netdev denotes a network filesystem.
		echo "Mounting remaining file systems..."
		mount -a -O no_netdev
		evaluate_retval
		;;

	stop)
		echo "Unmounting all other currently mounted file systems..."
		umount -a -d -r -t noramfs
		evaluate_retval
		;;

	*)
		echo "Usage: $0 {start|stop}"
		exit 1
		;;
esac

# End $rc_base/init.d/mountfs
