# postinstall script for Solaris Common Desktop Environment  1.0.1 AnswerBook.
# created by mkdv2pkg.ksh @prototype-build-time
ABrelease=69
AB_Home=dt/share/answerbooks/C
ABissue=3
AB_OS=5
AB_Type=UBAB
AB_Name="Solaris Common Desktop Environment AnswerBook 1.0.1"
AB_Pkg_Name=SUNWdta

export ABrelease ABissue AB_OS AB_Install_Type AB_Type AB_Pkg_Name AB_Name
SizeOfIndex=2016256
SizeOfContentsDB=3886080
SizeOfPostScript=106457088
# 
###
# 
# --- 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 ${BASEDIR}/${ABHOME} d 0755 bin bin
                if [ ! -d ${BASEDIR}/${ABHOME} ]
                then
                        mkdir -p ${BASEDIR}/$ABHOME
                fi
                chmod 755 ${BASEDIR}/$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="${BASEDIR}/${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=${BASEDIR_FIXED}/${ContentsDBDEST}: \
pspath=${BASEDIR_FIXED}/${PostScriptDEST}: \
indexpath=${BASEDIR_FIXED}/${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 ${BASEDIR}/${ABHOME}/ab_cardcatalog f 0644 bin bin

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

installf -f $PKGINST || exit 2

exit 0
 

