#!/bin/sh

# Shell script to run after the install of the scc software.
# Copyright (C) 2001-2004 Open Challenge B.V.
# Copyright (C) 2004-2005 OpenEyeT Professional Services.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.
# If not, write to the Free Software Foundation,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Contact information: www.OpenEyeT.nl/scc/index.html 

# SCC-release:	1.6.26
# file-version: $Revision: 1.2 $

# Do not use POSIX features in this script as it can be sourced by a non-POSIX system shell!

SCC_BIN=/opt/scc/bin
SCC_TOP=/var/opt/scc
export SCC_BIN SCC_TOP

SCC_DATA=${SCC_TOP}/data
SCC_TMP=${SCC_TOP}/tmp
SCC_CONF=/etc/opt/scc/conf
export SCC_DATA SCC_TMP SCC_CONF

umask 077

# Just before the install we run the current version to detect any changes
# in the configuration of the system. After the install we remove the current
# snapshot to avoid comparison of the snapshots. This enables us to change
# the format of the snapshots without flooding the log files with differences.

name=`uname -n | sed -e 's/\..*//'`

if [ ! -f ${SCC_DATA}/scc.${name}.lock -a ! -f ${SCC_DATA}/scc.${name}.install ]
then
	echo "WARNING: Lock- and or install-file do not exist during install."
	exit 2
fi

# Remove current snapshot and create new snapshot.
echo "NOTE:    Running scc to create a snapshot with the new version"
echo "NOTE:    of the software. This may take some minutes."

# During installs on HP-UX, stm often hangs; do not run it.
SCC_IGNORE_STM="yes";			export SCC_IGNORE_STM

# During installs, rpm is locked; indicate the installation phase:
SCC_INSTALL_PHASE="postinstall";	export SCC_INSTALL_PHASE

rm -f ${SCC_DATA}/scc.${name}.lock ${SCC_DATA}/scc.${name}.install
${SCC_BIN}/scc-log -c "install of SCC release 1.6.26" -r

echo "NOTE:    The snapshot and logbook can be found in ${SCC_DATA}"

exit 0
