#!/bin/sh

PKGINST=${PKG:=SUNWdtdev}
PKGBASE=${BASEDIR:=/usr}

OSVERSION=`/bin/uname -r | /bin/cut -c1-3`

CONFIGDIR=${PKGBASE}/dt/proto/config
OSVERSDIR=${CONFIGDIR}/OSVersiontemplates

OSVERSIONTMPL=./OSVersiontemplates/${OSVERSION}
OSVERSIONLINK=./OSVersion.tmpl

if [ ! -d ${CONFIGDIR} ]; then
	echo ${CONFIGDIR} does not exist.
	exit 1
fi

cd ${CONFIGDIR}

if [ ! -f ${OSVERSIONTMPL} ]; then
	echo ${OSVERSION} not supported; defaulting to 5.4
	exit 2
fi

if [ -f ${OSVERSIONLINK} -o -h ${OSVERSIONLINK} ]; then
	/bin/rm ${OSVERSIONLINK}
fi

/bin/ln -s ${OSVERSIONTMPL} ${OSVERSIONLINK}
