pkg://xtel-3.3.0nb5.tgz:153031/+INSTALL
downloads
#!/bin/sh
#
# $NetBSD: header,v 1.36 2006/03/19 23:58:14 jlam Exp $
SELF="$0"
PKGNAME="$1"
STAGE="$2"
shift 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="xtel"
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
CONF_IGNORE_FILES="*[~#] *.OLD *.orig *,v .pkgsrc */.pkgsrc"
PKG_INSTALLATION_TYPE="overwrite"
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=yes
;;
esac
# $NetBSD: dirs,v 1.10 2006/03/19 23:58:14 jlam Exp $
#
# Generate a +DIRS script that reference counts directories that are
# required for the proper functioning of the package.
#
case "${STAGE},$1" in
UNPACK,|UNPACK,+DIRS)
${CAT} > ./+DIRS << 'EOF'
#!/bin/sh
#
# +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
# # DIR: share/foo-plugins fm
#
# For each DIR entry, if the directory path is relative, then it is taken
# to be relative to ${PKG_PREFIX}.
#
# The second field in each DIR entry is a set of flags with the following
# meanings:
#
# f ignore ${PKG_CONFIG}
# 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_PREFIX=/usr/pkg}
PKG_REFCOUNT_DIRS_DBDIR="${PKG_REFCOUNT_DBDIR}/dirs"
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
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 ;;
[!/]*) dir="${PKG_PREFIX}/$dir" ;;
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
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_flags/$_PKG_CONFIG in
*f*/*|*/yes)
${MKDIR} $dir
case $d_user/$d_group/$d_mode in
[!/]*/[!/]*/[!/]*)
${CHOWN} $d_user $dir
${CHGRP} $d_group $dir
${CHMOD} $d_mode $dir
;;
esac
;;
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 ;;
[!/]*) dir="${PKG_PREFIX}/$dir" ;;
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" ||
{ case $d_flags/$_PKG_CONFIG in
*f*/*|*/yes)
${RMDIR} -p $dir 2>/dev/null || ${TRUE};
;;
esac; }
${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 ;;
[!/]*) dir="${PKG_PREFIX}/$dir" ;;
esac
${TEST} ! -d "$dir" || continue
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 ;;
[!/]*) dir="${PKG_PREFIX}/$dir" ;;
esac
${TEST} -d "$dir" || continue
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
${SED} -n "/^\# DIR: /p" ${SELF} >> ./+DIRS
${CHMOD} +x ./+DIRS
;;
esac
# $NetBSD: fonts,v 1.11 2006/03/19 23:58:14 jlam Exp $
#
# Generate a +FONTS script that updates font databases for the package.
#
case "${STAGE},$1" in
UNPACK,|UNPACK,+FONTS)
${CAT} > ./+FONTS << 'EOF'
#!/bin/sh
#
# +FONTS - font database management script
#
# Usage: ./+FONTS [metadatadir]
#
# This scripts rebuilds font databases needed by the package associated
# with <metadatadir>.
#
# Lines starting with "# FONTS: " are data read by this script that name
# the directories in which the font database will be rebuilt.
#
# # FONTS: /usr/pkg/lib/X11/fonts/TTF ttf
# # FONTS: /usr/pkg/lib/X11/fonts/Type1 type1
# # FONTS: /usr/pkg/lib/X11/fonts/misc x11
#
# For each FONTS entry, if the path is relative, that it is taken to be
# relative to ${PKG_PREFIX}.
#
ECHO="echo"
FIND="/usr/bin/find"
GREP="/usr/bin/grep"
MKFONTDIR="/usr/X11R6/bin/mkfontdir"
PWD_CMD="/bin/pwd"
RM="/bin/rm"
SED="/usr/bin/sed"
SORT="/usr/bin/sort"
TEST="test"
TRUE="true"
TTMKFDIR="@TTMKFDIR@"
TYPE1INST="@TYPE1INST@"
SELF=$0
PKG_METADATA_DIR="${1-`${PWD_CMD}`}"
: ${PKGNAME=${PKG_METADATA_DIR##*/}}
: ${PKG_PREFIX=/usr/pkg}
case "${PKG_UPDATE_FONTS_DB:-YES}" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
_PKG_UPDATE_FONTS_DB=yes
;;
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
_PKG_UPDATE_FONTS_DB=no
;;
esac
${SED} -n "/^\# FONTS: /{s/^\# FONTS: //;p;}" ${SELF} | ${SORT} -u |
{ while read dir font_type; do
case ${_PKG_UPDATE_FONTS_DB} in
no) continue ;;
esac
case $dir in
"") continue ;;
[!/]*) dir="${PKG_PREFIX}/$dir" ;;
esac
${TEST} -d "$dir" || continue
case "$printed_header" in
yes) ;;
*) printed_header=yes
${ECHO} "==========================================================================="
${ECHO} "Updating font databases in the following directories:"
${ECHO} ""
;;
esac
( ${ECHO} " $dir ($font_type)"
cd $dir
case $font_type in
[tT][tT][fF]) update_cmd="${TTMKFDIR}" ;;
[tT][yY][pP][eE]1) update_cmd="${TYPE1INST}; ${RM} type1inst.log" ;;
[xX]11) update_cmd="${MKFONTDIR}" ;;
esac
${TEST} -f "$update_cmd" || update_cmd="${TRUE}"
$update_cmd >/dev/null
#
# Remove fonts databases if there are no fonts in the directory.
# We filter out the encodings.dir, fonts.{alias,dirs,scale}, and
# Fontmap database files from the directory listing.
#
${FIND} . -type f | ${GREP} -v "/encodings.dir" | ${GREP} -v "/fonts\." | ${GREP} -v "/Fontmap" >/dev/null || ${RM} -f fonts.* Fontmap*
)
done
case "$printed_header" in
yes) ${ECHO} ""
${ECHO} "==========================================================================="
;;
esac; }
EOF
${SED} -n "/^\# FONTS: /p" ${SELF} >> ./+FONTS
${CHMOD} +x ./+FONTS
;;
esac
# $NetBSD: install,v 1.45 2006/03/19 23:58:14 jlam Exp $
case ${STAGE} in
PRE-INSTALL)
#
# Unpack the helper scriptlets.
#
${SELF} ${PKGNAME} UNPACK
#
# Require that necessary users and groups exist or else fail the
# installation of the package.
#
${TEST} ! -x ./+USERGROUP ||
{ ./+USERGROUP ADD ${PKG_METADATA_DIR}
if ./+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
${TEST} ! -x ./+DIRS ||
./+DIRS ADD ${PKG_METADATA_DIR}
;;
POST-INSTALL)
#
# Copy configuration/support files into place.
#
${TEST} ! -x ./+FILES ||
./+FILES ADD ${PKG_METADATA_DIR}
${TEST} ! -x ./+RCD_SCRIPTS ||
./+RCD_SCRIPTS ADD ${PKG_METADATA_DIR}
#
# Set special permissions on any files/directories that need them.
#
${TEST} ! -x ./+PERMS ||
./+PERMS ${PKG_METADATA_DIR}
#
# Update any fonts databases.
#
${TEST} ! -x ./+FONTS ||
./+FONTS ${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)
#
# Register shells in /etc/shells.
#
${TEST} ! -x ./+SHELL ||
./+SHELL ADD ${PKG_METADATA_DIR}
${TEST} ! -x ./+SHELL ||
./+SHELL CHECK-ADD ${PKG_METADATA_DIR}
#
# Register info files.
#
${TEST} ! -x ./+INFO_FILES ||
./+INFO_FILES ADD ${PKG_METADATA_DIR}
# 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
# $NetBSD: install-post,v 1.3 2006/03/15 04:52:57 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_TEMPLATE 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
# $NetBSD: footer,v 1.2 2006/03/15 04:52:57 jlam Exp $
exit 0
# DIR: lib/X11/fonts/xtel fm
# FONTS: lib/X11/fonts/xtel x11