# postinstall script for Wabi 2.1  AnswerBook.
# created by mkdv2pkg.ksh @prototype-build-time
ABrelease=49
AB_Home=SUNWaws
ABissue=3
AB_OS=5
AB_Type=UBAB
AB_Name="Wabi 2.1 AnswerBook"
AB_Pkg_Name=SUNWaws

export ABrelease ABissue AB_OS AB_Install_Type AB_Type AB_Pkg_Name AB_Name
SizeOfIndex=234496
SizeOfContentsDB=352256
SizeOfPostScript=2973696
# 
###
# 
# --- above this line is code generated at the end of MakeABPackage.ksh
# --- the fixed part of the postinstall  script:
#
trap 'exit 3' 15

#
#General note and Caveat: class reloc directories are referred to
#via linknames made after pkgmk-time. The linkname is the original
# class dir. name WITHOUT the DOLLAR SIGN!!!

#
# Jan-93: FOR ALL CASES of old package format, announce the
# AnswerBook home directory here. (no explicit entry in pkgmap)
#
                installf -c none $PKGINST $ABHOME d 0755 bin bin
                if [ ! -d ${ABHOME} ]
                then
                        mkdir -p $ABHOME
                fi
                chmod 755 $ABHOME

#+create the carcatalog:

# Create a card catalog file for this AnswerBook.
# The **contents** of the card catalog file refers
# to the locations of installed answerbook components;
# hence, we must examine the value of BASEDIR and edit
# out a leading instance of the value of PKG_INSTALL_ROOT
# in order that the information in the card catalog point
# to the AFTER-REBOOT locations of the data.
# (If this package is added via a simple pkgadd -d , this editing
# is not needed, but will produce the proper final value in either case).
# We will assign a value to BASEDIR_FIXED.
# BASEDIR_FIXED is only to be used as a reference to the location
# of objects AFTER-REBOOTING ; we use it here only to generate
# paths for the product configuration file, ab_cardcatalog .

#++
 
OUR_PKG_PREPEND=${PKG_INSTALL_ROOT}
 
if [ ! -z "${OUR_PKG_PREPEND}" ]
then
        BASEDIR_FIXED=`echo $BASEDIR | sed -e "s:^${OUR_PKG_PREPEND}::" `
else
        BASEDIR_FIXED=$BASEDIR
fi
 
# BASEDIR_FIXED is ONLY needed at the time the sed commands are evaluated,
# at the other loci in this file, they will have appropriate values
# at the time pkgadd uses them.
 
 
#--

# BASEDIR_FIXED is only to be used as a reference to the location
# of objects AFTER-REBOOTING ; we use it here only to generate
# paths for the product configuration file, ab_cardcatalog .

# Make sure that the word 'AnswerBook' is only appended if needed:

AB_Name_esc_colon=`echo $AB_Name | sed 's/\:/\\\:/'`
export AB_Name_esc_colon

if echo $AB_Name | grep -i answerbook >/dev/null
then
	TitleString="${AB_Name_esc_colon}"
else
	TitleString="${AB_Name_esc_colon} AnswerBook"
fi

CATALOG_NAME="${ABHOME}/ab_cardcatalog"

cat >$CATALOG_NAME <<-EndOfFile
#<Card Catalog> version 1
#
# This file was generated by the AnswerBook installation script
# DO NOT EDIT THIS FILE BY HAND.
#
id=SUNWab_${ABrelease}_${ABissue}: \
title=${TitleString}: \
tocpath=${ContentsDBDEST}: \
pspath=${PostScriptDEST}: \
indexpath=${IndexDEST}: 
EndOfFile

# Finalize objects announced via installf

# For Docviewer2.0 , a per-AnswerBook card-catalog is to be created:
# Notify pkgadd that the DV2.x per-AnswerBook-card-catalog is to be created:

        installf  $PKGINST ${ABHOME}/ab_cardcatalog f 0644 bin bin

# create the catalog: (ABHOME is exported in the request script)

installf -f $PKGINST || exit 2

exit 0
 

