#! /bin/sh # # Copyright (c) 1996 by Sun Microsystems, Inc. # # # postinstall script of AnswerBook2 # # This script cover the scenerio where SUNWab2u is installed before this # package. If that is the case we need to check the following cases # # (1) This package (SUNWab2s) is relocated # In that case all references to this package basedir should be updated # e.g dwhttpd.cfg, naspi.cfg etc. # if [ ! -z "$PKG_INSTALL_ROOT" -a "${PKG_INSTALL_ROOT}" != "/" ] then # install with -R with root other than / R_OPTION="TRUE" REAL_BASEDIR=`pkgparam -R $PKG_INSTALL_ROOT SUNWab2s BASEDIR` # Note that BASEDIR is $PKG_INSTALL_ROOT/$REAL_BASEDIR in this situation AB2ShareDir=$BASEDIR export AB2ShareDir else REAL_BASEDIR=$BASEDIR fi # Is SUNWab2u exists? SUWab2u_FOUND=`/usr/bin/pkginfo | /usr/bin/fgrep SUNWab2u | /usr/bin/awk '{print $2}'` if [ ! -z "$SUWab2u_FOUND" ] ; then # Get SUNWab2u basedir USR_DIR=`/usr/bin/pkgparam SUNWab2u BASEDIR` ############################################ if test "$REAL_BASEDIR" != "/usr"; then # (1) This package (SUNWab2r) is relocated DWHTTPD_orig=$PKG_INSTALL_ROOT${USR_DIR}/lib/ab2/dweb/data/config/dwhttpd.cfg DWHTTPD_tmp=/tmp/dwhttpd.cfg$$ NSAPI_orig=$PKG_INSTALL_ROOT${USR_DIR}/lib/ab2/dweb/data/config/nsapi.cfg NSAPI_tmp=/tmp/nsapi.cfg$$ NPHDWEB_orig=$PKG_INSTALL_ROOT${USR_DIR}/lib/ab2/bin/cgi/nph-dweb STYLE_MAP=$PKG_INSTALL_ROOT${USR_DIR}/lib/ab2/dweb/data/ents/map.txt STYLE_MAP_tmp=/tmp/map.txt$$ if [ ! -f $NPHDWEB_orig ]; then NPHDWEB_orig=$PKG_INSTALL_ROOT${USR_DIR}/lib/ab2/bin/ab2bin/nph-dweb fi NPHDWEB_tmp=/tmp/nph-dweb$$ # remove modified tmp file in case it already exists rm -f $DWHTTPD_tmp rm -f $NSAPI_tmp rm -f $STYLE_MAP_tmp rm -f $NPHDWEB_tmp # dwhttpd.cfg /usr/bin/sed -e 's:set AB2ShareDir.*:set AB2ShareDir '${REAL_BASEDIR}':g' < ${DWHTTPD_orig} > ${DWHTTPD_tmp} cp $DWHTTPD_tmp $DWHTTPD_orig rm -f $DWHTTPD_tmp installf -c config SUNWab2u $DWHTTPD_orig e installf -f SUNWab2u || exit 2 # nsapi.cfg /usr/bin/sed -e 's:set AB2ShareDir.*:set AB2ShareDir '${REAL_BASEDIR}':g' < ${NSAPI_orig} > ${NSAPI_tmp} cp $NSAPI_tmp $NSAPI_orig rm -f $NSAPI_tmp installf -c config SUNWab2u $NSAPI_orig e installf -f SUNWab2u || exit 2 # update nph-dweb if [ -f ${NPHDWEB_orig} ] ; then /usr/bin/sed -e 's:set AB2ShareDir.*:set AB2ShareDir = '${REAL_BASEDIR}':g' < ${NPHDWEB_orig} > ${NPHDWEB_tmp} cp $NPHDWEB_tmp $NPHDWEB_orig rm -f $NPHDWEB_tmp fi installf -c base SUNWab2u $NPHDWEB_orig f installf -f SUNWab2u || exit 2 # update map.txt if [ -f ${STYLE_MAP} ] then /usr/bin/sed -e 's:/usr:'${REAL_BASEDIR}':g' < ${STYLE_MAP} > ${STYLE_MAP_tmp} cp $STYLE_MAP_tmp $STYLE_MAP rm -f $STYLE_MAP_tmp # update the file in package database installf -c preserve SUNWab2u $STYLE_MAP e installf -f SUNWab2u || exit 2 fi fi fi exit 0