#! /usr/bin/sh
#
# ident	"%Z%%M%	%I%	%E% SMI"
#
# Copyright (c) 2000 by Sun Microsystems, Inc.
# All rights reserved.
#
# This is the pre-install shell script for patch 108885-05. The purpose
# of this pre-install script is to make a backup compressed tarfile of
# the /var/opt/SUNWssp/data directory, in the event this patch is later
# removed.  If this patch is removed, it will be necessary to restore
# the /var/opt/SUNWssp/data directory from a recently backed up copy.

##############################################################
# CHANGE HISTORY (REVERSE CHRONOLOGICAL)

# 14-Sep-00 fly	Initial creation.

##############################################################

# Set preliminary file and path name variables
DATE="`date +%d%b%R`"

if [ "${ROOTDIR}" = "/" ]; then
	SSP_DIR="/var/opt/SUNWssp"
else
	SSP_DIR="${ROOTDIR}/var/opt/SUNWssp"
fi

# Create a backup compressed tarfile of the /var/opt/SUNWssp/data directory
echo "\nCreating backup of	${SSP_DIR}/data"
echo "                as	\c"

# Normally, use only PatchNum to name the tarfile
BACKUP_FILE="${SSP_DIR}/data.prepatch_${PatchNum}.tar.Z"

# If there isn't already a backup compressed tarfile
if [ -f "${BACKUP_FILE}" ]; then
	# Found one; use PatchNum and DATE to name the tarfile.
	BACKUP_FILE="${SSP_DIR}/data.prepatch_${PatchNum}.${DATE}.tar.Z"
fi

echo "${BACKUP_FILE}"
tar cf - "${SSP_DIR}/data" | compress -c > "${BACKUP_FILE}"

