#!/bin/sh
# set -x
#
# volmgt_enable - This script will uncomment the "use floppy ..." line
# in /etc/vold.conf which was commented out by sunpc_install.

# Check that user 'root' has invoked sunpc_install.
ISROOT=`/bin/id | /bin/awk '/root/ {print}'`
if [ -z "$ISROOT" ]
then
        echo "You must be a superuser to run the volmgt_enable script."
        exit 1
fi

# Volume Manager Configuration file
VOLD="/etc/vold.conf"

# Comment line which is taken out of the vold.conf file
# This line is originally inserted in vold.conf when we disable Volume Mgr.
COMMENT_LINE1="# The next line is commented out to disable Floppy Volume Management for SunPC"

#
# Remove commented out portions of vold.conf, which disable floppy support.
#
if [ -f ${VOLD} ]
then
	sed -e  "/${COMMENT_LINE1}/d" \
	-e '/#use floppy drive/ s/#//g' ${VOLD} > ${VOLD}.temp1
	/usr/bin/rm ${VOLD}
	/usr/bin/mv ${VOLD}.temp1 ${VOLD}
fi

/usr/bin/echo ""
/usr/bin/echo "This script has reenabled Volume Manager support for the system"
/usr/bin/echo "floppy drives. If you did not reboot after running sunpc_install,"
/usr/bin/echo "Volume Manager is now returned to its original state. If you did"
/usr/bin/echo "reboot since running sunpc_install, you need to reboot again or"
/usr/bin/echo "type the following commands as root:"
/usr/bin/echo ""
/usr/bin/echo "/etc/init.d/volmgt stop"
/usr/bin/echo "/etc/init.d/volmgt start"
/usr/bin/echo ""
