#!/bin/sh
# $Id: backto,v 1.4 2005/05/19 12:18:45 jp148923 Exp $

#   SAM-QFS_notice_begin
#
#   Solaris 2.x Sun Storage & Archiving Management File System
#
#   Copyright (c) 2004 Sun Microsystems, Inc.
#   All Rights Reserved.
#
#   Government Rights Notice
#   Use, duplication, or disclosure by the U.S. Government is
#   subject to restrictions set forth in the Sun Microsystems,
#   Inc. license agreements and as provided in DFARS 227.7202-1(a)
#   and 227.7202-3(a) (1995), DRAS 252.227-7013(c)(ii) (OCT 1988),
#   FAR 12.212(a)(1995), FAR 52.227-19, or FAR 52.227-14 (ALT III),
#   as applicable.  Sun Microsystems, Inc.
#
#   SAM-QFS_notice_end

ETCDIR=/etc/opt/SUNWsamfs
SBINDIR=/opt/SUNWsamfs/sbin

usage() {

	echo "Usage: backto { 4.2 | 4.3 }"
	exit 1
}
	
echo " "


if [ "$1" = "4.3" ]; then

	echo "Renaming files to the 4.3 names."

elif [ "$1" = "4.2" ]; then

	echo "Renaming files to the 4.2 names."

else
	usage
fi

mv /opt/SUNWsamfs/.fsmgmtd /opt/SUNWsamfs/.sam-mgmtrpcd
mv /opt/SUNWsamfs/.fsmgmtd_clients /opt/SUNWsamfs/.sam-mgmtrpcd_clients

# Update the defaults.conf file for gui daemon name change. This check
# only needs to be maintained for 4.4 and 4.5. In 4.6 downgrades are only
# to 4.4 and 4.5 and these releases use the new daemon name by default.

ETCDIR=/etc/opt/SUNWsamfs
if [ -f $ETCDIR/defaults.conf ]; then
    /bin/grep fsmgmt $ETCDIR/defaults.conf >/dev/null
    if [ $? = 0 ]; then
        sed -e "s/fsmgmt/sam-mgmt/" $ETCDIR/defaults.conf >$ETCDIR/dtmp
	mv $ETCDIR/dtmp $ETCDIR/defaults.conf
    fi
fi

echo "Conversion back to $1 complete."
echo ""
