#!/bin/ksh
#
# start of header
#
# $NetBSD: header,v 1.17 2002/11/17 08:58:50 salo Exp $

PKGNAME=$1
STAGE=$2

AWK="/usr/bin/nawk"
BASENAME="/usr/bin/basename"
CAT="/usr/bin/cat"
CHGRP="/usr/bin/chgrp"
CHMOD="/usr/bin/chmod"
CHOWN="/usr/bin/chown"
CMP="cmp"
CP="/usr/bin/cp"
DIRNAME="/usr/bin/dirname"
ECHO="/usr/ucb/echo"
EGREP="/usr/xpg4/bin/egrep"
EXPR="/usr/bin/expr"
FALSE="/usr/bin/false"
FIND="/usr/bin/find"
GREP="/usr/xpg4/bin/grep"
GROUPADD="/usr/sbin/groupadd"
GTAR="/usr/pkg/bin/tar"
HEAD="/usr/bin/head"
ID="/usr/xpg4/bin/id"
LN="/usr/bin/ln"
MKDIR="/usr/bin/mkdir -p"
MV="/usr/bin/mv"
PERL5="/usr/pkg/bin/perl"
RM="/usr/bin/rm"
RMDIR="/usr/bin/rmdir"
SED="/usr/xpg4/bin/sed"
SH="/bin/ksh"
SORT="/usr/bin/sort"
SU="/usr/bin/su"
TOUCH="/usr/bin/touch"
TR="/usr/bin/tr"
TRUE="/usr/bin/true"
USERADD="/usr/sbin/useradd"
XARGS="/usr/bin/xargs"

PKGBASE="tiff"

PKG_USERS=""
PKG_GROUPS=""

SPECIAL_PERMS=""

CONF_FILES=""
CONF_FILES_PERMS=""
SUPPORT_FILES=""
SUPPORT_FILES_PERMS=""
RCD_SCRIPTS=""
RCD_SCRIPTS_DIR="/etc/rc.d"
RCD_SCRIPTS_EXAMPLEDIR="/usr/pkg/etc/rc.d"

MAKE_DIRS="/usr/pkg/etc "
MAKE_DIRS_PERMS=""
OWN_DIRS=""
OWN_DIRS_PERMS=""

PKG_SYSCONFBASE="/usr/pkg/etc"
PKG_SYSCONFDIR="/usr/pkg/etc"

PKG_REGISTER_SHELLS="YES"
PKG_SHELL=""

ALL_USERS=
ALL_GROUPS=
ALL_FILES=
ALL_MAKE_DIRS=
ALL_DIRS=

case "${PKG_CREATE_USERGROUP:-YES}" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
	_PKG_CREATE_USERGROUP=YES
	;;
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
	_PKG_CREATE_USERGROUP=NO
	;;
esac

case "${PKG_CONFIG:-YES}" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
	_PKG_CONFIG=YES
	;;
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
	_PKG_CONFIG=NO
	;;
esac

case "${PKG_RCD_SCRIPTS:-NO}" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
	_PKG_RCD_SCRIPTS=YES
	;;
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
	_PKG_RCD_SCRIPTS=NO
	;;
esac

msginit()
{
	_msgn=0
	_msgempty=1

}

msgempty()
{
	if [ $_msgempty -gt 0 ]; then
		${TRUE}
	else
		${FALSE}
	fi
}

msgadd()
{
        eval _msg$_msgn=\"$1\"
        _msgn=`${EXPR} $_msgn + 1`
	_msgempty=0
}

msgprint()
{
	i=0
	while [ $i -lt $_msgn ]; do
		eval _msg=_msg$i
		eval ${ECHO} "\$$_msg" | ${SED} \
			-e "s,^###,			," \
			-e "s,^##,		," \
			-e "s,^#,	,"
                i=`${EXPR} $i + 1`
        done
}

# end of header
# INSTALL_TMPL replacement
#
# $NetBSD: INSTALL.OpenWindows,v 1.2 2002/10/20 09:15:23 jlam Exp $

LIBTIFF="libtiff.so libtiff.so.3"

case ${STAGE} in
PRE-INSTALL)
	for lib in ${LIBTIFF}; do
		src="${PKG_PREFIX}/lib/${lib}"
		dest="/usr/openwin/lib/${lib}"
		if [ -f ${dest} ]; then
			${MV} -f ${dest} ${dest}.openwin
			${LN} -sf ${src} ${dest}
		fi
	done
	;;

POST-INSTALL)
	;;

DEINSTALL)
	;;
	
POST-DEINSTALL)
	for lib in ${LIBTIFF}; do
		file="/usr/openwin/lib/${lib}"
		if [ -f ${file}.openwin ]; then
			${MV} -f ${file}.openwin ${file}
		fi
	done
	;;

*)
	${ECHO} "Unexpected argument: ${STAGE}"
	exit 1
	;;
esac
# start of footer
#
# $NetBSD: footer,v 1.1 2001/11/19 16:18:44 jlam Exp $

exit 0

# end of footer
