#! /bin/sh
#
# /sbin/init.d/privacy script from the Anonymizing Unix Project
# by van Hauser / THC <vh@reptile.rug.ac.be>
#
# This script starts and stops the CFS setup.
# The symlinks rc2.d/S40privacy and rc2.d/K05privacy point to this script.
#
# NFS and NIS should not run on the machine (for security reasons too!)
#

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin

case "$1" in
    start)
        rm -rf /tmp/.tmp
        mkdir -p -m 700 /tmp/.tmp
        portmap 2> /dev/null
        rpc.mountd 2> /dev/null
        cfsd 449 1> /dev/null 2> /dev/null
	mount -o port=449,intr,soft localhost:/tmp/.tmp /home || echo 'Privacy Setup failed!'
	;;
    stop)
	cd /home
	for i in * ; do
            cdetach $i 2> /dev/null
        done
	cd /
	umount /home 2> /dev/null
	kill -TERM `pidof cfsd` 2> /dev/null
	killproc -TERM `pidof rpc.mountd` 2> /dev/null
        killproc -TERM `pidof portmap` 2> /dev/null
	;;
    *)
	echo "Usage: $0 {start|stop}"
	exit 1
	;;
esac

exit 0

