#!/bin/sh
#

echo      "The following links from the SUNWvolr package are being removed."


if [ "$ROOTDIR" != "" ]; then
	REMOVEF="removef -R ${ROOTDIR}"
	${REMOVEF} SUNWvolr /etc/rcS.d/K35volmgt
	rm -f /etc/rcS.d/K35volmgt

	${REMOVEF} SUNWvolr /etc/rc2.d/S92volmgt
	rm -f /etc/rc2.d/S92volmgt

	${REMOVEF} SUNWvolr /etc/rc1.d/K35volmgt 
	rm -f /etc/rc2.d/S92volmgt

	${REMOVEF} SUNWvolr /etc/rc0.d/K35volmgt
	rm -f /etc/rc0.d/K35volmgt
else
	REMOVEF="removef"

	${REMOVEF} SUNWvolr /etc/rcS.d/K35volmgt
	rm -f /etc/rcS.d/K35volmgt

	${REMOVEF} SUNWvolr /etc/rc2.d/S92volmgt
	rm -f /etc/rc2.d/S92volmgt

	${REMOVEF} SUNWvolr /etc/rc1.d/K35volmgt 
	rm -f /etc/rc2.d/S92volmgt

	${REMOVEF} SUNWvolr /etc/rc0.d/K35volmgt
	rm -f /etc/rc0.d/K35volmgt
fi

${REMOVEF} -f SUNWvolr || exit 2


if [ "$ROOTDIR" != "" ]; then
	INSTALLF="installf -R ${ROOTDIR}"
	${INSTALLF} -c initd SUNWvolr ${ROOTDIR}/etc/rc0.d/K05volmgt=/etc/init.d/volmgt

	${INSTALLF} -c initd SUNWvolr ${ROOTDIR}/etc/rc1.d/K05volmgt=/etc/init.d/volmgt
	
	${INSTALLF} -c initd SUNWvolr ${ROOTDIR}/etc/rc2.d/K05volmgt=/etc/init.d/volmgt

	${INSTALLF} -c initd SUNWvolr ${ROOTDIR}/etc/rc3.d/S81volmgt=/etc/init.d/volmgt

	${INSTALLF} -c initd SUNWvolr ${ROOTDIR}/etc/rcS.d/K05volmgt=/etc/init.d/volmgt

else
	INSTALLF="installf"
	${INSTALLF} -c initd SUNWvolr /etc/rc0.d/K05volmgt=/etc/init.d/volmgt

	${INSTALLF} -c initd SUNWvolr /etc/rc1.d/K05volmgt=/etc/init.d/volmgt
	
	${INSTALLF} -c initd SUNWvolr /etc/rc2.d/K05volmgt=/etc/init.d/volmgt

	${INSTALLF} -c initd SUNWvolr /etc/rc3.d/S81volmgt=/etc/init.d/volmgt

	${INSTALLF} -c initd SUNWvolr /etc/rcS.d/K05volmgt=/etc/init.d/volmgt

fi

${INSTALLF} -f SUNWvolr
