#!/usr/bin/ksh -u

# @(#)gen_release 1.13 99/12/23 SMI

if [ $# -ne 1 ] ; then
	echo "Media name (solaris1of2|base|baseg1|korean|prc|taiwanese|japanese|european)" \
		"is missing" >&2
	return 1
fi

typeset -r media=$1

PrintCentre() {
	typeset -r str="$1"
	integer n="40-(${#str}/2)"
	typeset -L$n pad=''
	echo "$pad$str"
}

if [ ! -f bld_id ] ; then
	echo "File "bld_id" has to be in the current directory" >&2
	return 1
fi

typeset arch_str=
case $(uname -p) in
	sparc) arch_str='SPARC' ;;
	i386) arch_str='INTEL' ;;
esac

typeset -r bld_id_var=$(cat bld_id | sed -e 's:s_wos::' -e 's:x_wos::' -e 's:smcc:Sun:')

case $media in
	solaris1of2)	locale_str='' ;;
	base)		locale_str='' ;;
	baseg1)		locale_str='Global1' ;;
	korean)		locale_str='Korean' ;;
	prc)		locale_str='Chinese (Simplified)' ;;
	taiwanese)	locale_str='Chinese (Traditional)' ;;
	japanese)	locale_str='Japanese' ;;
	european)	locale_str='European' ;;
	*)		echo "Invalid media name: $media"
			return 1;
esac

{
PrintCentre "$locale_str Solaris 8 $bld_id_var $arch_str"
PrintCentre "Copyright 2000 Sun Microsystems, Inc.  All Rights Reserved."
PrintCentre "$(/usr/bin/date '+Assembled %d %B %Y')"
} > release

pkgmk -o -d .. VERSION=8,REV=$(date +%Y.%m.%d.%H.%M) ARCH=$(uname -p)
