#! /sbin/sh

# (u)mount cache file systems

cd /

if /sbin/chkconfig cachefs
then

	case $1 in
	'start')
		if /sbin/chkconfig verbose
		then
			echo "Mounting cache file systems:"
			VERBOSE=-v
		else
			VERBOSE=
		fi

		if /sbin/mount $VERBOSE -at cachefs
		then :
		else
		    echo '\07Some cache file systems failed to mount'
		fi

		;;

	'stop')
		if /sbin/chkconfig verbose
		then
			echo "Unmounting cache file systems:"
			VERBOSE=-v
		else
			VERBOSE=
		fi
		sync
		/sbin/umount $VERBOSE -akt cachefs
		sync
		;;

	*)
		echo "usage: /etc/init.d/cachefs {start|stop}"
		;;
	esac

else

	if /sbin/chkconfig verbose
	then
		echo "cachefs not configured"
	fi

fi
