Filewatcher File Search
FTP Search
  
Directory (beta)
  
Content Search (beta)
   
pkg://xen12-040418.tgz:529648/+INSTALL  downloads

#!/bin/sh
#
# start of header
#
# $NetBSD: header,v 1.32 2005/02/02 10:33:01 jlam Exp $

PKGNAME=$1
STAGE=$2

AWK="/usr/bin/awk"
BASENAME="/usr/bin/basename"
CAT="/bin/cat"
CHGRP="/usr/bin/chgrp"
CHMOD="/bin/chmod"
CHOWN="/usr/sbin/chown"
CMP="/usr/bin/cmp"
CP="/bin/cp"
DIRNAME="/usr/bin/dirname"
ECHO="echo"
ECHO_N="echo -n"
EGREP="/usr/bin/egrep"
EXPR="/bin/expr"
FALSE="false"
FIND="/usr/bin/find"
GREP="/usr/bin/grep"
GTAR=""
HEAD="/usr/bin/head"
ID="/usr/bin/id"
LINKFARM="/usr/sbin/linkfarm"
LN="/bin/ln"
LS="/bin/ls"
MKDIR="/bin/mkdir -p"
MV="/bin/mv"
PERL5="/usr/pkg/bin/perl"
PKG_ADMIN="/usr/sbin/pkg_admin"
PKG_INFO="/usr/sbin/pkg_info"
PWD_CMD="/bin/pwd"
RM="/bin/rm"
RMDIR="/bin/rmdir"
SED="/usr/bin/sed"
SETENV="/usr/bin/env"
SH="/bin/sh"
SORT="/usr/bin/sort"
SU="/usr/bin/su"
TEST="test"
TOUCH="/usr/bin/touch"
TR="/usr/bin/tr"
TRUE="true"
XARGS="/usr/bin/xargs"

: ${PKG_METADATA_DIR=`${PWD_CMD}`}
PKGBASE="xen12"

LOCALBASE="/usr/pkg"
X11BASE="/usr/X11R6"
DEPOTBASE="/usr/pkg/packages"
PREFIX="/usr/pkg"
case ${PKG_PREFIX} in
${LOCALBASE}/*)	VIEW="${PKG_PREFIX#${LOCALBASE}/}" ;;
*)		VIEW="" ;;
esac

PKG_SYSCONFBASE="/usr/pkg/etc"
PKG_SYSCONFDEPOTBASE=""
PKG_SYSCONFBASEDIR="/usr/pkg/etc"
PKG_SYSCONFDIR="/usr/pkg/etc"
CONF_DEPENDS=""

case ${VIEW} in
"")	PKG_SYSCONFVIEWBASE="${PKG_SYSCONFBASE}" ;;
*)	PKG_SYSCONFVIEWBASE="${PKG_SYSCONFBASE}/${VIEW}" ;;
esac

PKG_REGISTER_SHELLS="YES"
PKG_SHELL=""

CONF_IGNORE_FILES="*[~#] *.OLD *.orig *,v .pkgsrc */.pkgsrc"

PKG_INSTALLATION_TYPE="overwrite"

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

# end of header
# start of install-usergroup
#
# Generate a +USERGROUP script that reference counts users
# and groups that are required for the proper functioning
# of the package.
#
case ${STAGE} in
PRE-INSTALL|UNPACK)
	${CAT} > ./+USERGROUP << 'EOF_USERGROUP'
#!/bin/sh
#
# $NetBSD: usergroup,v 1.8 2005/03/28 19:26:11 jlam Exp $
#
# +USERGROUP - users and groups management script
#
# Usage: ./+USERGROUP ADD|REMOVE [metadatadir]
#        ./+USERGROUP CHECK-ADD|CHECK-REMOVE [metadatadir]
#
# This script supports two actions, ADD and REMOVE, that will add or
# remove the users and groups needed by the package associated with
# <metadatadir>.  The CHECK-ADD action will check whether any users or
# groups needed by the package are missing, and print an informative
# message noting those users and groups.  The CHECK-REMOVE action will
# check whether any users and groups needed by the package still exist,
# and print an informative message noting those users and groups.  The
# CHECK-ADD and CHECK-REMOVE actions return non-zero if they detect
# either missing or existing users/groups, respectively.
#
# Lines starting with "# USER: " or "# GROUP: " are data read by this
# script that name the users and groups that this package requires to
# exist to function correctly, e.g.
#
#	# USER: foo:foogrp::The Foomister
#	# GROUP: foogrp
#
# The USER lines are of the form:
#
#	user:group[:[userid][:[descr][:[home][:shell]]]]
#
# Only the user and group are required; everything else is optional,
# but the colons must be in the right places when specifying optional
# bits.
#
# The GROUP lines are of the form:
#
#	group[:groupid]
#
# Only the group is required; the groupid is optional.
#
CAT="/bin/cat"
CHGRP="/usr/bin/chgrp"
ECHO="echo"
GREP="/usr/bin/grep"
GROUPADD="/usr/sbin/groupadd"
ID="/usr/bin/id"
MKDIR="/bin/mkdir -p"
PWD_CMD="/bin/pwd"
RM="/bin/rm"
RMDIR="/bin/rmdir"
SED="/usr/bin/sed"
SORT="/usr/bin/sort"
TEST="test"
USERADD="/usr/sbin/useradd"

SELF=$0
ACTION=$1
PKG_METADATA_DIR="${2-`${PWD_CMD}`}"
: ${PKGNAME=${PKG_METADATA_DIR##*/}}
: ${PKG_DBDIR=${PKG_METADATA_DIR%/*}}
: ${PKG_REFCOUNT_DBDIR=${PKG_DBDIR}.refcount}

PKG_REFCOUNT_USERS_DBDIR="${PKG_REFCOUNT_DBDIR}/users"
PKG_REFCOUNT_GROUPS_DBDIR="${PKG_REFCOUNT_DBDIR}/groups"

PKG_USER_HOME="/nonexistent"
PKG_USER_SHELL="/sbin/nologin"

group_exists()
{
	_group="$1"
	case $_group in
	"")	return 2 ;;
	esac
	# Check using chgrp to work properly in an NIS environment.
	testfile="./grouptest.tmp.$$"
	${ECHO} > $testfile
	if ${CHGRP} $_group $testfile >/dev/null 2>&1; then
		${RM} -f $testfile
		return 0
	fi
	${RM} -f $testfile
	return 1
}

user_exists()
{
	_user="$1"
	case $_user in
	"")	return 2 ;;
	esac
	# Check using id to work properly in an NIS environment.
	if ${ID} $_user >/dev/null 2>&1; then
		return 0
	fi
	return 1
}

listwrap()
{
	_length=$1
	_buffer=
	while read _line; do
		set -- $_line
		for _word; do
			case $_buffer in
			"")	_buffer="$_word" ;;
			*)	_buffer="$_buffer  $_word" ;;
			esac
			if ${TEST} ${#_buffer} -gt $_length; then
				${ECHO} "	$_buffer"
				_buffer=
			fi
		done
	done
	case $_buffer in
	"")	;;
	*)	${ECHO} "	$_buffer" ;;
	esac
}

exitcode=0
case $ACTION in
ADD)
	${SED} -n "/^\# GROUP: /{s/^\# GROUP: //;p;}" ${SELF} | ${SORT} -u |
	{ while read line; do
		SAVEIFS="$IFS"; IFS=":"
		set -- $line
		group="$1"; groupid="$2"
		IFS="$SAVEIFS"
		case $group in
		"")	continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_GROUPS_DBDIR}/$group"
		preexist="$shadow_dir/+PREEXISTING"
		token="$shadow_dir/${PKGNAME}"
		if ${TEST} ! -d "$shadow_dir"; then
			${MKDIR} $shadow_dir
			group_exists $group &&
				${ECHO} "${PKGNAME}" > $preexist
		fi
		if group_exists $group; then
			:
		elif ${TEST} -n "${GROUPADD}" -a -x "${GROUPADD}"; then
			${ECHO} "Creating group: $group";
			case $groupid in
			"")	${GROUPADD} $group ;;
			*)	${GROUPADD} -g $groupid $group ;;
			esac
		fi
		if ${TEST} -f "$token" && \
		   ${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
			:
		else
			${ECHO} "${PKG_METADATA_DIR}" >> $token
		fi
	done; }
	${SED} -n "/^\# USER: /{s/^\# USER: //;p;}" ${SELF} | ${SORT} -u |
	{ while read line; do
		SAVEIFS="$IFS"; IFS=":"
		set -- $line
		user="$1"; group="$2"; userid="$3"
		descr="$4"; home="$5" shell="$6"
		IFS="$SAVEIFS"
		case $user in
		"")	continue ;;
		esac
		: ${descr:="${PKGNAME%-[0-9]*} $user user"}
		: ${home:="${PKG_USER_HOME}"}
		: ${shell:="${PKG_USER_SHELL}"}
		shadow_dir="${PKG_REFCOUNT_USERS_DBDIR}/$user"
		preexist="$shadow_dir/+PREEXISTING"
		token="$shadow_dir/${PKGNAME}"
		if ${TEST} ! -d "$shadow_dir"; then
			${MKDIR} $shadow_dir
			user_exists $user &&
				${ECHO} "${PKGNAME}" > $preexist
		fi
		if user_exists $user && group_exists $group; then
			:
		elif ${TEST} -n "${USERADD}" -a -x "${USERADD}"; then
			${ECHO} "Creating user: $user";
			case $userid in
			"")	${USERADD} -c "$descr" -d "$home" -s "$shell" \
					-g $group $user ;;
			*)	${USERADD} -c "$descr" -d "$home" -s "$shell" \
					-g $group -u $userid $user ;;
			esac
		fi
		if ${TEST} -f "$token" && \
		   ${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
			:
		else
			${ECHO} "${PKG_METADATA_DIR}" >> $token
		fi
	done; }
	;;

REMOVE)
	${SED} -n "/^\# USER: /{s/^\# USER: //;p;}" ${SELF} | ${SORT} -u |
	{ while read line; do
		SAVEIFS="$IFS"; IFS=":"
		set -- $line
		user="$1"; group="$2"; userid="$3"
		descr="$4"; home="$5" shell="$6"
		IFS="$SAVEIFS"
		case $user in
		"")	continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_USERS_DBDIR}/$user"
		preexist="$shadow_dir/+PREEXISTING"
		token="$shadow_dir/${PKGNAME}"
		tokentmp="$token.tmp.$$"
		if ${TEST} -f "$token" && \
		   ${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
			${CAT} "$token" | ${GREP} -v "^${PKG_METADATA_DIR}$" > $tokentmp
			case `${CAT} $tokentmp | ${SED} -n "$="` in
			"")
				${RM} -f $preexist $token $token.tmp.*
				${RMDIR} -p $shadow_dir 2>/dev/null || ${TRUE}
				;;
			*)
				${MV} -f $tokentmp $token
				;;
			esac
		fi
	done; }
	${SED} -n "/^\# GROUP: /{s/^\# GROUP: //;p;}" ${SELF} | ${SORT} -u |
	{ while read line; do
		SAVEIFS="$IFS"; IFS=":"
		set -- $line
		group="$1"; groupid="$2"
		IFS="$SAVEIFS"
		case $group in
		"")	continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_GROUPS_DBDIR}/$group"
		preexist="$shadow_dir/+PREEXISTING"
		token="$shadow_dir/${PKGNAME}"
		tokentmp="$token.tmp.$$"
		if ${TEST} -f "$token" && \
		   ${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
			${CAT} "$token" | ${GREP} -v "^${PKG_METADATA_DIR}$" > $tokentmp
			case `${CAT} $tokentmp | ${SED} -n "$="` in
			"")
				${RM} -f $preexist $token $token.tmp.*
				${RMDIR} -p $shadow_dir 2>/dev/null || ${TRUE}
				;;
			*)
				${MV} -f $tokentmp $token
				;;
			esac
		fi
	done; }
	;;

CHECK-ADD)
	${SED} -n "/^\# GROUP: /{s/^\# GROUP: //;p;}" ${SELF} | ${SORT} -u |
	{ while read line; do
		SAVEIFS="$IFS"; IFS=":"
		set -- $line
		group="$1"; groupid="$2"
		IFS="$SAVEIFS"
		case $group in
		"")	continue ;;
		*)	group_exists $group && continue ;;
		esac
		case "$printed_header" in
		yes)	;;
		*)	printed_header=yes
			${ECHO} "==========================================================================="
			${ECHO} "The following groups need to be created for ${PKGNAME}:"
			${ECHO} ""
			;;
		esac
		case $groupid in
		"")	${ECHO} "	$group" ;;
		*)	${ECHO} "	$group ($groupid)" ;;
		esac
	done
	case "$printed_header" in
	yes)	${ECHO} ""
		${ECHO} "==========================================================================="
		exit 1
		;;
	esac; }
	${TEST} $? -eq 0 || exitcode=1
	${SED} -n "/^\# USER: /{s/^\# USER: //;p;}" ${SELF} | ${SORT} -u |
	{ while read line; do
		SAVEIFS="$IFS"; IFS=":"
		set -- $line
		user="$1"; group="$2"; userid="$3"
		descr="$4"; home="$5" shell="$6"
		IFS="$SAVEIFS"
		case $user in
		"")	continue ;;
		*)	user_exists $user && continue ;;
		esac
		case "$printed_header" in
		yes)	;;
		*)	printed_header=yes
			${ECHO} "==========================================================================="
			${ECHO} "The following users need to be created for ${PKGNAME}:"
			${ECHO} ""
			;;
		esac
		: ${home:="${PKG_USER_HOME}"}
		: ${shell:="${PKG_USER_SHELL}"}
		case $userid in
		"")	${ECHO} "	$user: $group, $home, $shell" ;;
		*)	${ECHO} "	$user ($userid): $group, $home, $shell" ;;
		esac
	done
	case "$printed_header" in
	yes)	${ECHO} ""
		${ECHO} "==========================================================================="
		exit 1
		;;
	esac; }
	${TEST} $? -eq 0 || exitcode=1
	;;

CHECK-REMOVE)
	${SED} -n "/^\# USER: /{s/^\# USER: //;p;}" ${SELF} | ${SORT} -u |
	{ while read line; do
		SAVEIFS="$IFS"; IFS=":"
		set -- $line
		user="$1"; group="$2"; userid="$3"
		descr="$4"; home="$5" shell="$6"
		IFS="$SAVEIFS"
		case $user in
		"")	continue ;;
		*)	user_exists $user || continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_USERS_DBDIR}/$user"
		${TEST} -d "$shadow_dir" && continue	# refcount isn't zero
		existing_users="$existing_users $user"
	done
	case $existing_users in
	"")	;;
	*)	${ECHO} "==========================================================================="
		${ECHO} "The following users are no longer being used by ${PKGNAME},"
		${ECHO} "and they can be removed if no other packages are using them:"
		${ECHO} ""
		${ECHO} "$existing_users" | listwrap 40
		${ECHO} ""
		${ECHO} "==========================================================================="
		exit 1
		;;
	esac; }
	${TEST} $? -eq 0 || exitcode=1
	${SED} -n "/^\# GROUP: /{s/^\# GROUP: //;p;}" ${SELF} | ${SORT} -u |
	{ while read line; do
		SAVEIFS="$IFS"; IFS=":"
		set -- $line
		group="$1"; groupid="$2"
		IFS="$SAVEIFS"
		case $group in
		"")	continue ;;
		*)	group_exists $group || continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_GROUPS_DBDIR}/$group"
		${TEST} -d "$shadow_dir" && continue	# refcount isn't zero
		existing_groups="$existing_groups $group"
	done
	case $existing_groups in
	"")	;;
	*)	${ECHO} "==========================================================================="
		${ECHO} "The following groups are no longer being used by ${PKGNAME},"
		${ECHO} "and they can be removed if no other packages are using them:"
		${ECHO} ""
		${ECHO} "$existing_groups" | listwrap 40
		${ECHO} ""
		${ECHO} "==========================================================================="
		exit 1
		;;
	esac; }
	${TEST} $? -eq 0 || exitcode=1
	;;

*)
	${ECHO} "Usage: ./+USERGROUP ADD|REMOVE [metadatadir]"
	${ECHO} "       ./+USERGROUP CHECK-ADD|CHECK-REMOVE [metadatadir]"
	;;
esac
exit $exitcode

EOF_USERGROUP
	${CHMOD} +x ./+USERGROUP
	;;
esac

# end of install-usergroup
# start of install-perms
#
# Generate a +PERMS script that sets the special
# permissions on files and directories used by the
# package.
#
case ${STAGE} in
PRE-INSTALL|UNPACK)
	${CAT} > ./+PERMS << 'EOF_PERMS'
#!/bin/sh
#
# $NetBSD: perms,v 1.2 2005/04/20 17:13:28 seb Exp $
#
# +PERMS - special file and directory permissions management script
#
# Usage: ./+PERMS [metadatadir]
#
# This script sets special permissions on files and directories needed
# by the package associated with <metadatadir>.
#
# Lines starting with "# PERMS: " are data read by this script that
# name the files and directories required to have special permissions
# in order for this package to function correctly.
#
#	# PERMS: /usr/pkg/bin/lppasswd 4711 lp sys
#	# PERMS: /usr/pkg/etc/pwd.db 0600
#
CHGRP="/usr/bin/chgrp"
CHMOD="/bin/chmod"
CHOWN="/usr/sbin/chown"
ECHO="echo"
PWD_CMD="/bin/pwd"
SED="/usr/bin/sed"
SORT="/usr/bin/sort"
TEST="test"

SELF=$0
PKG_METADATA_DIR="${1-`${PWD_CMD}`}"
: ${PKGNAME=${PKG_METADATA_DIR##*/}}

${SED} -n "/^\# PERMS: /{s/^\# PERMS: //;p;}" ${SELF} | ${SORT} -u |
{ while read file f_mode f_user f_group; do
	case $file in
	""|[!/]*)	continue ;;
	*)		${TEST} -f "$file" || continue ;;
	esac
	case "$printed_header" in
	yes)	;;
	*)	printed_header=yes
		${ECHO} "==========================================================================="
		${ECHO} "The following files and directories needed by ${PKGNAME}"
		${ECHO} "have special permissions:"
		${ECHO} ""
		;;
	esac
	case $f_mode/$f_user/$f_group in
	//)
		${ECHO} "	$file"
		;;
	[!/]*//)
		${ECHO} "	$file (m=$f_mode)"
		;;
	[!/]*/[!/]*/)
		${ECHO} "	$file (o=$f_user, m=$f_mode)"
		;;
	[!/]*/[!/]*/[!/]*)
		${ECHO} "	$file (o=$f_user, g=$f_group, m=$f_mode)"
		;;
	esac
	case $f_user in
	"")	;;
	*)	${CHOWN} $f_user $file ;;
	esac
	case $f_group in
	"")	;;
	*)	${CHGRP} $f_group $file ;;
	esac
	case $f_mode in
	"")	;;
	*)	${CHMOD} $f_mode $file ;;
	esac
done
case "$printed_header" in
yes)	${ECHO} ""
	${ECHO} "==========================================================================="
	;;
esac; }

EOF_PERMS
	${CHMOD} +x ./+PERMS
	;;
esac

# end of install-perms
# start of install-files
#
# Generate a +FILES script that reference counts config
# files that are required for the proper functioning
# of the package.
#
case ${STAGE} in
PRE-INSTALL|UNPACK)
	${CAT} > ./+FILES << 'EOF_FILES'
#!/bin/sh
#
# $NetBSD: files,v 1.5 2005/04/20 17:13:28 seb Exp $
#
# +FILES - reference-counted configuration file management script
#
# Usage: ./+FILES ADD|REMOVE [metadatadir]
#        ./+FILES VIEW-REMOVE depotdir viewdir
#        ./+FILES CHECK-ADD|CHECK-REMOVE [metadatadir]
#
# This script supports two actions, ADD and REMOVE, that will add or
# remove the configuration files needed by the package associated with
# <metadatadir>.  The CHECK-ADD action will check whether any files
# needed by the package are missing, and print an informative message
# noting those files.  The CHECK-REMOVE action will check whether
# any files needed by the package still exist, and print an informative
# message noting those files.  The CHECK-ADD and CHECK-REMOVE actions
# return non-zero if they detect either missing or existing files,
# respectively.  The VIEW-REMOVE action will remove from <viewdir> the
# links to the configuration files in <depotdir>.
#
# Lines starting with "# FILE: " are data read by this script that
# name the files that this package requires to exist to function
# correctly, along with the locations of the example files, e.g.
#
#	# FILE: /etc/bar.conf c /example/bar.conf
#	# FILE: /etc/baz/conf c /example/baz.conf 0600 foo-user foo-group
#
# The second field in each FILE entry is a set of flags with the following
# meaning:
#
#	c	file is copied into place
#
CAT="/bin/cat"
CP="/bin/cp"
CHGRP="/usr/bin/chgrp"
CHMOD="/bin/chmod"
CHOWN="/usr/sbin/chown"
CMP="/usr/bin/cmp"
ECHO="echo"
GREP="/usr/bin/grep"
MKDIR="/bin/mkdir -p"
MV="/bin/mv"
PWD_CMD="/bin/pwd"
RM="/bin/rm"
RMDIR="/bin/rmdir"
SED="/usr/bin/sed"
SORT="/usr/bin/sort"
TEST="test"
TRUE="true"

SELF=$0
ACTION=$1

case ${ACTION} in
VIEW-REMOVE)
	DEPOTDIR="$2"
	VIEWDIR="$3"
        ${TEST} -n "${DEPOTDIR}" -a -n "${VIEWDIR}" || exit 0
	;;
*)
	PKG_METADATA_DIR="${2-`${PWD_CMD}`}"
	: ${PKGNAME=${PKG_METADATA_DIR##*/}}
	: ${PKG_DBDIR=${PKG_METADATA_DIR%/*}}
	: ${PKG_REFCOUNT_DBDIR=${PKG_DBDIR}.refcount}
	PKG_REFCOUNT_FILES_DBDIR="${PKG_REFCOUNT_DBDIR}/files"
	;;
esac

exitcode=0
case $ACTION in
ADD)
	${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -u |
	{ while read file f_flags f_eg f_mode f_user f_group; do
		case $file in
		""|[!/]*)	continue ;;
		esac
		case $f_flags in
		*c*)	;;
		*)	continue ;;
		esac

		shadow_dir="${PKG_REFCOUNT_FILES_DBDIR}$file"
		perms="$shadow_dir/+PERMISSIONS"
		preexist="$shadow_dir/+PREEXISTING"
		token="$shadow_dir/${PKGNAME}"
		if ${TEST} ! -d "$shadow_dir"; then
			${MKDIR} $shadow_dir
			${TEST} -f "$file" &&
				${ECHO} "${PKGNAME}" > $preexist
		fi
		if ${TEST} -f "$token" && \
		   ${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
			:
		else
			${ECHO} "${PKG_METADATA_DIR}" >> $token
		fi

		case $f_mode$f_user$f_group in
		"")	;;
	 	*)	${ECHO} "$f_mode $f_user $f_group" > $perms ;;
		esac
		if ${TEST} ! -f "$file" -a ! -f "$f_eg"; then
			:
		else
			case "$printed_header" in
			yes)	;;
			*)	printed_header=yes
				${ECHO} "==========================================================================="
				${ECHO} "Installing files needed by ${PKGNAME}:"
				;;
			esac
			if ${TEST} -f "$file"; then
				${ECHO} ""
				${ECHO} "	$file already exists."
			elif ${TEST} -f "$f_eg"; then
				${ECHO} ""
				${ECHO} "	$file"
				${ECHO} "	    [$f_eg]"
				${CP} $f_eg $file
				case $f_user in
				"")	;;
				*)	${CHOWN} $f_user $file ;;
				esac
				case $f_group in
				"")	;;
				*)	${CHGRP} $f_group $file ;;
				esac
				case $f_mode in
				"")	;;
				*)	${CHMOD} $f_mode $file ;;
				esac
			fi
		fi
	done
	case "$printed_header" in
	yes)	${ECHO} ""
		${ECHO} "==========================================================================="
		;;
	esac; }
	;;

REMOVE)
	${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -ru |
	while read file f_flags f_eg f_mode f_user f_group; do
		case $file in
		""|[!/]*)	continue ;;
		esac
		case $f_flags in
		*c*)	;;
		*)	continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_FILES_DBDIR}$file"
		perms="$shadow_dir/+PERMISSIONS"
		preexist="$shadow_dir/+PREEXISTING"
		token="$shadow_dir/${PKGNAME}"
		tokentmp="$token.tmp.$$"
		if ${TEST} -f "$token" && \
		   ${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
			${CAT} "$token" | ${GREP} -v "^${PKG_METADATA_DIR}$" > $tokentmp
			case `${CAT} $tokentmp | ${SED} -n "$="` in
			"")
				if ${TEST} -f "$preexist"; then
					:
				elif ${TEST} -f "$file" -a -f "$f_eg" && \
					     ${CMP} -s "$file" "$f_eg"; then
					${RM} -f "$file"
				fi
				${RM} -f $perms $preexist $token $token.tmp.*
				${RMDIR} -p $shadow_dir 2>/dev/null || ${TRUE}
				;;
			*)
				${MV} -f $tokentmp $token
				;;
			esac
		fi
	done
	;;

VIEW-REMOVE)
	${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -ru |
	while read file f_flags f_eg f_mode f_user f_group; do
		case $file in
		${DEPOTDIR}/*)	;;
		*)		continue ;;
		esac
		link="${VIEWDIR}/${file#${DEPOTDIR}/}"
		dir="${link%[^/]*}"
		if ${TEST} -h "$link"; then
			${RM} -f $link
			${RMDIR} -p $dir 2>/dev/null || ${TRUE}
		fi
	done
	;;

CHECK-ADD)
	${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -ru |
	{ while read file f_flags f_eg f_mode f_user f_group; do
		case $file in
		""|[!/]*)	continue ;;
		*)		${TEST} -f "$file" && continue ;;
		esac
		case $f_flags in
		*c*)	;;
		*)	continue ;;
		esac
		case "$printed_header" in
		yes)	;;
		*)	printed_header=yes
			${ECHO} "==========================================================================="
			${ECHO} "The following files should be created for ${PKGNAME}:"
			;;
		esac
		${ECHO} ""
		case $f_mode/$f_user/$f_group in
		//)
			${ECHO} "	$file"
			;;
		[!/]*//)
			${ECHO} "	$file (m=$f_mode)"
			;;
		[!/]*/[!/]*/)
			${ECHO} "	$file (o=$f_user, m=$f_mode)"
			;;
		[!/]*/[!/]*/[!/]*)
			${ECHO} "	$file (o=$f_user, g=$f_group, m=$f_mode)"
			;;
		esac
		${TEST} -f "$f_eg" && ${ECHO} "	    [$f_eg]"
	done
	case "$printed_header" in
	yes)	${ECHO} ""
		${ECHO} "==========================================================================="
		exit 1
		;;
	esac; }
	${TEST} $? -eq 0 || exitcode=1
	;;

CHECK-REMOVE)
	${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -ru |
	{ while read file f_flags f_eg f_mode f_user f_group; do
		case $file in
		""|[!/]*)	continue ;;
		*)		${TEST} -f "$file" || continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_FILES_DBDIR}$file"
		${TEST} -d "$shadow_dir" && continue	# refcount isn't zero
		case "$printed_header" in
		yes)	;;
		*)	printed_header=yes
			${ECHO} "==========================================================================="
			${ECHO} "The following files are no longer being used by ${PKGNAME},"
			${ECHO} "and they can be removed if no other packages are using them:"
			${ECHO} ""
			;;
		esac
		${ECHO} "	$file"
	done
	case "$printed_header" in
	yes)	${ECHO} ""
		${ECHO} "==========================================================================="
		exit 1
		;;
	esac; }
	${TEST} $? -eq 0 || exitcode=1
	;;

*)
	${ECHO} "Usage: ./+FILES ADD|REMOVE [metadatadir]"
	${ECHO} "       ./+FILES VIEW-REMOVE depotdir viewdir"
	${ECHO} "       ./+FILES CHECK-ADD|CHECK-REMOVE [metadatadir]"
	;;
esac
exit $exitcode

EOF_FILES
	${CHMOD} +x ./+FILES
	;;
esac

# end of install-files
# start of install-rcd-scripts
#
# Generate a +RCD_SCRIPTS script that reference counts config
# files that are required for the proper functioning
# of the package.
#
case ${STAGE} in
PRE-INSTALL|UNPACK)
	${CAT} > ./+RCD_SCRIPTS << 'EOF_RCD_SCRIPTS'
#!/bin/sh
#
# $NetBSD: files,v 1.5 2005/04/20 17:13:28 seb Exp $
#
# +FILES - reference-counted configuration file management script
#
# Usage: ./+FILES ADD|REMOVE [metadatadir]
#        ./+FILES VIEW-REMOVE depotdir viewdir
#        ./+FILES CHECK-ADD|CHECK-REMOVE [metadatadir]
#
# This script supports two actions, ADD and REMOVE, that will add or
# remove the configuration files needed by the package associated with
# <metadatadir>.  The CHECK-ADD action will check whether any files
# needed by the package are missing, and print an informative message
# noting those files.  The CHECK-REMOVE action will check whether
# any files needed by the package still exist, and print an informative
# message noting those files.  The CHECK-ADD and CHECK-REMOVE actions
# return non-zero if they detect either missing or existing files,
# respectively.  The VIEW-REMOVE action will remove from <viewdir> the
# links to the configuration files in <depotdir>.
#
# Lines starting with "# FILE: " are data read by this script that
# name the files that this package requires to exist to function
# correctly, along with the locations of the example files, e.g.
#
#	# FILE: /etc/bar.conf c /example/bar.conf
#	# FILE: /etc/baz/conf c /example/baz.conf 0600 foo-user foo-group
#
# The second field in each FILE entry is a set of flags with the following
# meaning:
#
#	c	file is copied into place
#
CAT="/bin/cat"
CP="/bin/cp"
CHGRP="/usr/bin/chgrp"
CHMOD="/bin/chmod"
CHOWN="/usr/sbin/chown"
CMP="/usr/bin/cmp"
ECHO="echo"
GREP="/usr/bin/grep"
MKDIR="/bin/mkdir -p"
MV="/bin/mv"
PWD_CMD="/bin/pwd"
RM="/bin/rm"
RMDIR="/bin/rmdir"
SED="/usr/bin/sed"
SORT="/usr/bin/sort"
TEST="test"
TRUE="true"

SELF=$0
ACTION=$1

case ${ACTION} in
VIEW-REMOVE)
	DEPOTDIR="$2"
	VIEWDIR="$3"
        ${TEST} -n "${DEPOTDIR}" -a -n "${VIEWDIR}" || exit 0
	;;
*)
	PKG_METADATA_DIR="${2-`${PWD_CMD}`}"
	: ${PKGNAME=${PKG_METADATA_DIR##*/}}
	: ${PKG_DBDIR=${PKG_METADATA_DIR%/*}}
	: ${PKG_REFCOUNT_DBDIR=${PKG_DBDIR}.refcount}
	PKG_REFCOUNT_FILES_DBDIR="${PKG_REFCOUNT_DBDIR}/files"
	;;
esac

exitcode=0
case $ACTION in
ADD)
	${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -u |
	{ while read file f_flags f_eg f_mode f_user f_group; do
		case $file in
		""|[!/]*)	continue ;;
		esac
		case $f_flags in
		*c*)	;;
		*)	continue ;;
		esac

		shadow_dir="${PKG_REFCOUNT_FILES_DBDIR}$file"
		perms="$shadow_dir/+PERMISSIONS"
		preexist="$shadow_dir/+PREEXISTING"
		token="$shadow_dir/${PKGNAME}"
		if ${TEST} ! -d "$shadow_dir"; then
			${MKDIR} $shadow_dir
			${TEST} -f "$file" &&
				${ECHO} "${PKGNAME}" > $preexist
		fi
		if ${TEST} -f "$token" && \
		   ${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
			:
		else
			${ECHO} "${PKG_METADATA_DIR}" >> $token
		fi

		case $f_mode$f_user$f_group in
		"")	;;
	 	*)	${ECHO} "$f_mode $f_user $f_group" > $perms ;;
		esac
		if ${TEST} ! -f "$file" -a ! -f "$f_eg"; then
			:
		else
			case "$printed_header" in
			yes)	;;
			*)	printed_header=yes
				${ECHO} "==========================================================================="
				${ECHO} "Installing files needed by ${PKGNAME}:"
				;;
			esac
			if ${TEST} -f "$file"; then
				${ECHO} ""
				${ECHO} "	$file already exists."
			elif ${TEST} -f "$f_eg"; then
				${ECHO} ""
				${ECHO} "	$file"
				${ECHO} "	    [$f_eg]"
				${CP} $f_eg $file
				case $f_user in
				"")	;;
				*)	${CHOWN} $f_user $file ;;
				esac
				case $f_group in
				"")	;;
				*)	${CHGRP} $f_group $file ;;
				esac
				case $f_mode in
				"")	;;
				*)	${CHMOD} $f_mode $file ;;
				esac
			fi
		fi
	done
	case "$printed_header" in
	yes)	${ECHO} ""
		${ECHO} "==========================================================================="
		;;
	esac; }
	;;

REMOVE)
	${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -ru |
	while read file f_flags f_eg f_mode f_user f_group; do
		case $file in
		""|[!/]*)	continue ;;
		esac
		case $f_flags in
		*c*)	;;
		*)	continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_FILES_DBDIR}$file"
		perms="$shadow_dir/+PERMISSIONS"
		preexist="$shadow_dir/+PREEXISTING"
		token="$shadow_dir/${PKGNAME}"
		tokentmp="$token.tmp.$$"
		if ${TEST} -f "$token" && \
		   ${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
			${CAT} "$token" | ${GREP} -v "^${PKG_METADATA_DIR}$" > $tokentmp
			case `${CAT} $tokentmp | ${SED} -n "$="` in
			"")
				if ${TEST} -f "$preexist"; then
					:
				elif ${TEST} -f "$file" -a -f "$f_eg" && \
					     ${CMP} -s "$file" "$f_eg"; then
					${RM} -f "$file"
				fi
				${RM} -f $perms $preexist $token $token.tmp.*
				${RMDIR} -p $shadow_dir 2>/dev/null || ${TRUE}
				;;
			*)
				${MV} -f $tokentmp $token
				;;
			esac
		fi
	done
	;;

VIEW-REMOVE)
	${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -ru |
	while read file f_flags f_eg f_mode f_user f_group; do
		case $file in
		${DEPOTDIR}/*)	;;
		*)		continue ;;
		esac
		link="${VIEWDIR}/${file#${DEPOTDIR}/}"
		dir="${link%[^/]*}"
		if ${TEST} -h "$link"; then
			${RM} -f $link
			${RMDIR} -p $dir 2>/dev/null || ${TRUE}
		fi
	done
	;;

CHECK-ADD)
	${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -ru |
	{ while read file f_flags f_eg f_mode f_user f_group; do
		case $file in
		""|[!/]*)	continue ;;
		*)		${TEST} -f "$file" && continue ;;
		esac
		case $f_flags in
		*c*)	;;
		*)	continue ;;
		esac
		case "$printed_header" in
		yes)	;;
		*)	printed_header=yes
			${ECHO} "==========================================================================="
			${ECHO} "The following files should be created for ${PKGNAME}:"
			;;
		esac
		${ECHO} ""
		case $f_mode/$f_user/$f_group in
		//)
			${ECHO} "	$file"
			;;
		[!/]*//)
			${ECHO} "	$file (m=$f_mode)"
			;;
		[!/]*/[!/]*/)
			${ECHO} "	$file (o=$f_user, m=$f_mode)"
			;;
		[!/]*/[!/]*/[!/]*)
			${ECHO} "	$file (o=$f_user, g=$f_group, m=$f_mode)"
			;;
		esac
		${TEST} -f "$f_eg" && ${ECHO} "	    [$f_eg]"
	done
	case "$printed_header" in
	yes)	${ECHO} ""
		${ECHO} "==========================================================================="
		exit 1
		;;
	esac; }
	${TEST} $? -eq 0 || exitcode=1
	;;

CHECK-REMOVE)
	${SED} -n "/^\# FILE: /{s/^\# FILE: //;p;}" ${SELF} | ${SORT} -ru |
	{ while read file f_flags f_eg f_mode f_user f_group; do
		case $file in
		""|[!/]*)	continue ;;
		*)		${TEST} -f "$file" || continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_FILES_DBDIR}$file"
		${TEST} -d "$shadow_dir" && continue	# refcount isn't zero
		case "$printed_header" in
		yes)	;;
		*)	printed_header=yes
			${ECHO} "==========================================================================="
			${ECHO} "The following files are no longer being used by ${PKGNAME},"
			${ECHO} "and they can be removed if no other packages are using them:"
			${ECHO} ""
			;;
		esac
		${ECHO} "	$file"
	done
	case "$printed_header" in
	yes)	${ECHO} ""
		${ECHO} "==========================================================================="
		exit 1
		;;
	esac; }
	${TEST} $? -eq 0 || exitcode=1
	;;

*)
	${ECHO} "Usage: ./+FILES ADD|REMOVE [metadatadir]"
	${ECHO} "       ./+FILES VIEW-REMOVE depotdir viewdir"
	${ECHO} "       ./+FILES CHECK-ADD|CHECK-REMOVE [metadatadir]"
	;;
esac
exit $exitcode

EOF_RCD_SCRIPTS
	${CHMOD} +x ./+RCD_SCRIPTS
	;;
esac

# end of install-rcd-scripts
# start of install-dirs
#
# Generate a +DIRS script that reference counts directories
# that are required for the proper functioning of the
# package.
#
case ${STAGE} in
PRE-INSTALL|UNPACK)
	${CAT} > ./+DIRS << 'EOF_DIRS'
#!/bin/sh
#
# $NetBSD: dirs,v 1.5 2005/01/31 21:41:06 jlam Exp $
#
# +DIRS - reference-counted directory management script
#
# Usage: ./+DIRS ADD|REMOVE [metadatadir]
#        ./+DIRS CHECK-ADD|CHECK-REMOVE [metadatadir]
#
# This script supports two actions, ADD and REMOVE, that will add or
# remove the directories needed by the package associated with
# <metadatadir>.  The CHECK-ADD action will check whether any directories
# needed by the package are missing, and print an informative message
# noting those directories.  The CHECK-REMOVE action will check whether
# any directories needed by the package still exist, and print an
# informative message noting those directories.  The CHECK-ADD and
# CHECK-REMOVE actions return non-zero if they detect either missing
# or existing directories, respectively.
#
# Lines starting with "# DIR: " are data read by this script that
# name the directories that this package requires to exist to function
# correctly, e.g.
#
#	# DIR: /etc/foo m
#	# DIR: /var/log/foo/tmp mo foo-user foo-group 0700
#
# The second field in each DIRS entry is a set of flags with the following
# meaning:
#
#	m	create (make) the directory when ADDing
#	o	directory is owned by the package
#
CAT="/bin/cat"
CHGRP="/usr/bin/chgrp"
CHMOD="/bin/chmod"
CHOWN="/usr/sbin/chown"
ECHO="echo"
GREP="/usr/bin/grep"
MKDIR="/bin/mkdir -p"
MV="/bin/mv"
PWD_CMD="/bin/pwd"
RM="/bin/rm"
RMDIR="/bin/rmdir"
SED="/usr/bin/sed"
SORT="/usr/bin/sort"
TEST="test"
TRUE="true"

SELF=$0
ACTION=$1
PKG_METADATA_DIR="${2-`${PWD_CMD}`}"
: ${PKGNAME=${PKG_METADATA_DIR##*/}}
: ${PKG_DBDIR=${PKG_METADATA_DIR%/*}}
: ${PKG_REFCOUNT_DBDIR=${PKG_DBDIR}.refcount}

PKG_REFCOUNT_DIRS_DBDIR="${PKG_REFCOUNT_DBDIR}/dirs"

exitcode=0
case $ACTION in
ADD)
	${SED} -n "/^\# DIR: /{s/^\# DIR: //;p;}" ${SELF} | ${SORT} -u |
	while read dir d_flags d_user d_group d_mode; do
		case $dir in
		""|[!/]*)	continue ;;
		esac
		case $d_flags in
		*m*)	;;
		*)	continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_DIRS_DBDIR}$dir"
		perms="$shadow_dir/+PERMISSIONS"
		preexist="$shadow_dir/+PREEXISTING"
		token="$shadow_dir/${PKGNAME}"
		if ${TEST} ! -d "$shadow_dir"; then
			${MKDIR} $shadow_dir
			${TEST} -d "$dir" &&
				${ECHO} "${PKGNAME}" > $preexist
		fi
		${MKDIR} $dir
		if ${TEST} -f "$token" && \
		   ${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
			:
		else
			${ECHO} "${PKG_METADATA_DIR}" >> $token
		fi
		case $d_user/$d_group/$d_mode in
		[!/]*/[!/]*/[!/]*)
			${ECHO} "$d_user $d_group $d_mode" > $perms
			;;
		esac
		case $d_user/$d_group/$d_mode in
		[!/]*/[!/]*/[!/]*)
			${CHOWN} $d_user $dir
			${CHGRP} $d_group $dir
			${CHMOD} $d_mode $dir
			;;
		esac
	done
	;;

REMOVE)
	${SED} -n "/^\# DIR: /{s/^\# DIR: //;p;}" ${SELF} | ${SORT} -ru |
	while read dir d_flags d_user d_group d_mode; do
		case $dir in
		""|[!/]*)	continue ;;
		esac
		case $d_flags in
		*m*)	;;
		*)	continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_DIRS_DBDIR}$dir"
		perms="$shadow_dir/+PERMISSIONS"
		preexist="$shadow_dir/+PREEXISTING"
		token="$shadow_dir/${PKGNAME}"
		tokentmp="$token.tmp.$$"
		if ${TEST} -f "$token" && \
		   ${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
			${CAT} "$token" | ${GREP} -v "^${PKG_METADATA_DIR}$" > $tokentmp
			case `${CAT} $tokentmp | ${SED} -n "$="` in
			"")
				${TEST} -f "$preexist" ||
					{ ${RMDIR} -p $dir 2>/dev/null || ${TRUE}; }
				${RM} -f $perms $preexist $token $token.tmp.*
				${RMDIR} -p $shadow_dir 2>/dev/null || ${TRUE}
				;;
			*)
				${MV} -f $tokentmp $token
				;;
			esac
		fi
	done
	;;

CHECK-ADD)
	${SED} -n "/^\# DIR: /{s/^\# DIR: //;p;}" ${SELF} | ${SORT} -u |
	{ while read dir d_flags d_user d_group d_mode; do
		case $dir in
		""|[!/]*)	continue ;;
		*)		${TEST} -d "$dir" && continue ;;
		esac
		case $d_flags in
		*m*)	;;
		*)	continue ;;
		esac
		case "$printed_header" in
		yes)	;;
		*)	printed_header=yes
			${ECHO} "==========================================================================="
			${ECHO} "The following directories should be created for ${PKGNAME}:"
			${ECHO} ""
			;;
		esac
		case $d_user/$d_group/$d_mode in
		[!/]*/[!/]*/[!/]*)
			${ECHO} "	$dir (o=$d_user, g=$d_group, m=$d_mode)"
			;;
		*)
			${ECHO} "	$dir"
			;;
		esac
	done
	case "$printed_header" in
	yes)	${ECHO} ""
		${ECHO} "==========================================================================="
		exit 1
		;;
	esac; }
	${TEST} $? -eq 0 || exitcode=1
	;;

CHECK-REMOVE)
	${SED} -n "/^\# DIR: /{s/^\# DIR: //;p;}" ${SELF} | ${SORT} -ru |
	{ while read dir d_flags d_user d_group d_mode; do
		case $dir in
		""|[!/]*)	continue ;;
		*)		${TEST} -d "$dir" || continue ;;
		esac
		case $d_flags in
		*o*)	;;
		*)	continue ;;
		esac
		shadow_dir="${PKG_REFCOUNT_DIRS_DBDIR}$dir"
		${TEST} -d "$shadow_dir" && continue	# refcount isn't zero
		case "$printed_header" in
		yes)	;;
		*)	printed_header=yes
			${ECHO} "==========================================================================="
			${ECHO} "The following directories are no longer being used by ${PKGNAME},"
			${ECHO} "and they can be removed if no other packages are using them:"
			${ECHO} ""
			;;
		esac
		${ECHO} "	$dir"
	done
	case "$printed_header" in
	yes)	${ECHO} ""
		${ECHO} "==========================================================================="
		exit 1
		;;
	esac; }
	${TEST} $? -eq 0 || exitcode=1
	;;

*)
	${ECHO} "Usage: ./+DIRS ADD|REMOVE [metadatadir]"
	${ECHO} "       ./+DIRS CHECK-ADD|CHECK-REMOVE [metadatadir]"
	;;
esac
exit $exitcode

EOF_DIRS
	${CHMOD} +x ./+DIRS
	;;
esac

# end of install-dirs
# -*- sh -*-
# start of install
#
# $NetBSD: install,v 1.37 2005/03/21 19:29:46 wiz Exp $

case ${STAGE} in
PRE-INSTALL)
	#
	# Require that necessary users and groups exist or else fail the
	# installation of the package.
	#
	case ${_PKG_CREATE_USERGROUP} in
	YES)	${TEST} -x ./+USERGROUP &&
			./+USERGROUP ADD ${PKG_METADATA_DIR} ;;
	esac
	if ${TEST} -x ./+USERGROUP &&
	   ./+USERGROUP CHECK-ADD ${PKG_METADATA_DIR}; then
		:
	else
		exit 1
	fi
	#
	# Create package directories at pre-install time.
	#
	if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" -a			\
	     "${_PKG_CONFIG}" = "YES" -a -n "${CONF_DEPENDS}" ]; then
		pkg=`${PKG_ADMIN} -b -d ${DEPOTBASE} -s "" lsbest "${CONF_DEPENDS}"`
		sysconfdir=`${PKG_INFO} -B -K ${DEPOTBASE} $pkg |	\
			${AWK} '/^PKG_SYSCONFDIR=/ {			\
				gsub("^PKG_SYSCONFDIR=[ 	]*", ""); \
				print;					\
			}'						\
		`
		if [ -d $sysconfdir -a ! -d ${PKG_SYSCONFDIR} ]; then
			${MKDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}`
			${LN} -sf $sysconfdir ${PKG_SYSCONFDIR}
		fi
	fi
	case ${_PKG_CONFIG} in
        YES)	${TEST} -x ./+DIRS &&
			./+DIRS ADD ${PKG_METADATA_DIR} ;;
        esac
        ;;

POST-INSTALL)
	#
	# Copy configuration/support files into place.
	#
	case ${_PKG_CONFIG} in
        YES)	${TEST} -x ./+FILES &&
			./+FILES ADD ${PKG_METADATA_DIR} ;;
        esac
	case ${_PKG_CONFIG}${_PKG_RCD_SCRIPTS} in
	YESYES)	${TEST} -x ./+RCD_SCRIPTS &&
			./+RCD_SCRIPTS ADD ${PKG_METADATA_DIR} ;;
	esac
	#
	# Set special permissions on any files/directories that need them.
	#
	${TEST} -x ./+PERMS &&
		./+PERMS ${PKG_METADATA_DIR}

	# Check for any missing bits after we're finished installing.
	#
	${TEST} -x ./+DIRS &&
		./+DIRS CHECK-ADD ${PKG_METADATA_DIR}
	${TEST} -x ./+FILES &&
		./+FILES CHECK-ADD ${PKG_METADATA_DIR}
	${TEST} -x ./+RCD_SCRIPTS &&
		./+RCD_SCRIPTS CHECK-ADD ${PKG_METADATA_DIR}
	;;

VIEW-INSTALL)
	if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
		${ECHO} "===> Updating /etc/shells"
		${TOUCH} /etc/shells
		${CP} /etc/shells /etc/shells.pkgsrc."$$"
		(${GREP} -v "^${PKG_SHELL}" /etc/shells.pkgsrc."$$" || ${TRUE}; ${ECHO} ${PKG_SHELL}) > /etc/shells
		${RM} /etc/shells.pkgsrc."$$"
	fi
	#
	# If ${PKG_SYSCONFBASE} points outside of ${PREFIX}, then add the
	# package config files to the proper view.
	#
	if [ "${_PKG_CONFIG}" = "YES" -a -n "${PKG_SYSCONFDEPOTBASE}" ]; then
		${SETENV} PLIST_IGNORE_FILES="${CONF_IGNORE_FILES}" \
			${LINKFARM} -t ${PKG_SYSCONFVIEWBASE} -d ${PKG_SYSCONFDEPOTBASE} ${PKGNAME}
	fi
	;;
esac

# end of install
# start of install-post
#
# $NetBSD: install-post,v 1.1 2003/11/23 07:14:43 jlam Exp $

# Ensure that the VIEW-INSTALL action is called for overwrite packages.
# This is here to ensure that it's the final POST-INSTALL action (after
# any INSTALL_EXTRA_TMPL POST-INSTALL actions).
#
case ${STAGE} in
POST-INSTALL)
	if [ "${PKG_INSTALLATION_TYPE}" = "overwrite" ]; then
		${SETENV} PKG_PREFIX="${PKG_PREFIX}" \
			$0 ${PKGNAME} VIEW-INSTALL
        fi
	;;
esac

# end of install-post
# start of footer
#
# $NetBSD: footer,v 1.1 2001/11/19 16:18:44 jlam Exp $

exit 0

# end of footer
Results 1 - 1
Help - FTP Sites List - Software Dir.
Searching half a billion files worldwide
© 1997-2008 IT MARUHN