home *** CD-ROM | disk | FTP | other *** search
Wrap
#ident "@(#)pkg.ihvhba:i386/pkg/ihvhba/ictha/postinstall 1.2" do_extract () { ### # Extract Driver.o from loadable module ### mv /tmp/$PKGINST/$PKGINST /tmp/$PKGINST/Driver.o for sec in data data1 rodata rodata1 text do mcs -n .drv_$sec -d Driver.o mcs -n .rel.drv_$sec -d Driver.o done mcs -n .mod_dep -d Driver.o mcs -n .rel.mod_dep -d Driver.o ### # remove .comment because it is now about 2k. Really it should be # pstamped note that all our loadable drivers have large .comment # sections that should be pstamped. ### mcs -d Driver.o } abort_install () { message -d ${FAIL_INST} exit ${FAILURE} } do_install () { ${CONFBIN}/idinstall -P ${PKGINST} -a ${1} > ${ERR} 2>&1 RET=$? if [ ${RET} != 0 ] then OVERLAY=1 ( if [ ! -d /var/sadm/hba.save/$PKGINST ] then SVDIR=/var/sadm/hba.save/$PKGINST noexist=1 fi cd /etc/conf/pack.d/$PKGINST if [ noexist ] then mkdir -p $SVDIR/pack.d 2>&1 >/dev/null for FILE in Driver.o space.c disk.cfg do if [ noexist ] then mv /etc/conf/pack.d/$PKGINST/$FILE $SVDIR/pack.d fi if [ "$FILE" = "space.c" ] then mv /tmp/$PKGINST/Space.c space.c else mv /tmp/$PKGINST/$FILE $FILE fi [ $? -ne 0 ] && abort_install done fi cd /etc/conf/drvmap.d if [ noexist ] then mkdir $SVDIR/drvmap.d 2>&1 >/dev/null mv $PKGINST $SVDIR/drvmap.d mv /tmp/$PKGINST/Drvmap $PKGINST [ $? -ne 0 ] && abort_install fi cd /etc/conf/mdevice.d if [ noexist ] then mkdir $SVDIR/mdevice.d 2>&1 >/dev/null mv $PKGINST $SVDIR/mdevice.d mv /tmp/$PKGINST/Master $PKGINST [ $? -ne 0 ] && abort_install fi ) else rm -f ${ERR} mv disk.cfg /etc/conf/pack.d/${1} chown bin /etc/conf/pack.d/${1}/disk.cfg chgrp bin /etc/conf/pack.d/${1}/disk.cfg fi mv ${1}.h /usr/include/sys chown bin /usr/include/sys/${1}.h chgrp bin /usr/include/sys/${1}.h if [ "${1}" = "ide" ] then install -f /usr/include/sys -u bin -g bin ata_ha.h install -f /usr/include/sys -u bin -g bin ide_ha.h install -f /usr/include/sys -u bin -g bin mc_esdi.h fi } do_ide_update() { if [ ! -f /etc/conf/sdevice.d/athd -o \ ! -f /etc/conf/sdevice.d/mcesdi -o \ ! -f /etc/conf/sdevice.d/dcd ] then return fi # Create System file for ide driver from the dcd System file. The io # addresses and dma channel numbers are taken from the athd or mcesdi # System files with unit numbers matched with the dcd System file. IDE_UPDATE=1 TMPFILE=/tmp/${PKGINST}/tmpfile rm -f $TMPFILE awk ' BEGIN { OFS = "\t"; icount = 0; } $1 == "athd" || $1 == "mcesdi" { if ($2 == "Y") { unit[icount] = $3 iostart[icount] = $7 ioend[icount] = $8 dmachan[icount] = $11 icount++ } output = "" next } $1 == "dcd" { $1 = "ide" if ($2 == "Y") { for (i = 0; (i < icount) && (unit[i] != $3); i++) ; if (i < icount) { $7 = iostart[i] $8 = ioend [i] $11 = dmachan [i] } } } { output = output $0 "\n" } END { printf "%s", output } ' /etc/conf/sdevice.d/athd \ /etc/conf/sdevice.d/mcesdi \ /etc/conf/sdevice.d/dcd > ${TMPFILE} # Delete athd, mcesdi, and dcd entries in the in-core resmgr database. ${CONFBIN}/idresadd -d -f athd ${CONFBIN}/idresadd -d -f mcesdi ${CONFBIN}/idresadd -d -f dcd # Set up the merged ide System file right before force adding the ide # entries to the in-core resmgr database. This is done to avoid an # idresadd side-effect of dis-configurating other modules' System file # entries which are not in the in-core resmgr database. mv ${TMPFILE} /etc/conf/sdevice.d/ide ${CONFBIN}/idresadd -f ide # Update /stand/resmgr configuration file and system files according to # the in-core resmgr database. ${CONFBIN}/idconfupdate -f } register() { if [ $OVERLAY ] then installf -c none $PKGINST - << !!EOF /etc/conf/pack.d/$PKGINST/Driver.o /etc/conf/pack.d/$PKGINST/disk.cfg /etc/conf/pack.d/$PKGINST/space.c /etc/conf/drvmap.d/$PKGINST /etc/conf/mdevice.d/$PKGINST !!EOF else installf -c none $PKGINST - << !!EOF /etc/conf/pack.d/${PKGINST}/disk.cfg /usr/include/sys/${PKGINST}.h /etc/loadmods !!EOF if [ "$PKGINST" = "ide" ] then installf -c none ide - << !!EOF /usr/include/sys/ata_ha.h /usr/include/sys/ide_ha.h /usr/include/sys/mc_esdi.h !!EOF fi fi if [ $IDE_UPDATE ] then installf -c none $PKGINST - << !!EOF /etc/conf/sdevice.d/$PKGINST !!EOF fi installf -f $PKGINST } # Messaging related stuff PKGMSG=hba.pkg LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-"C"}}} # Check if we're installing during initial system installation. # If so, set ROOT=/mnt; otherwise ROOT is null. Make sure that # we're not pkgadd'ing over a pkg that was installed during that # first system installation (i.e., check UPDATE). ROOT= [ "$SETNAME" = "from_loadhba" -a "$UPDATE" != "yes" ] && ROOT="/mnt" LC_MESSAGES=$ROOT/usr/lib/locale/$LOCALE if [ ! -f ${LC_MESSAGES}/LC_MESSAGES/${PKGMSG} ] then if [ -f ${REQDIR}/inst/locale/${LOCALE}/$PKGMSG} -a \ -d ${ROOT}/usr/lib/locale/${LOCALE}/LC_MESSAGES ] then cp ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} \ ${LC_MESSAGES}/LC_MESSAGES fi fi FAIL_INST=`pfmt -s ERROR -g ${PKGMSG}:2 "The installation cannot be completed due to an error in the driver installation during the installation of the %s module. The file %s contains the errors." "${PKGINST}" "${ERR}" 2>&1` FAILURE=1 # fatal error CONFDIR=/etc/conf CONFBIN=${CONFDIR}/bin ERR=/tmp/err.out cd /tmp/${PKGINST} [ -f /tmp/${PKGINST}/Driver.o ] || do_extract do_install ${PKGINST} [ "$PKGINST" = "ide" ] && do_ide_update if test -f /bin/grep then grep $PKGINST /etc/loadmods >/dev/null [ $? -ne 0 ] && cat /tmp/$PKGINST/loadmods >>/etc/loadmods else cat /tmp/$PKGINST/loadmods >>/etc/loadmods fi # Register changes made to system into the contents file register # Cleanup temporary files and directories rm -fr /tmp/${PKGINST} /tmp/hba.cpio.z >/dev/null 2>&1 removef ${PKGINST} /tmp /tmp/${PKGINST} /tmp/${PKGINST}/Drvmap \ /tmp/${PKGINST}/mod.cpio.z /tmp/hba.cpio.z /tmp/${PKGINST}/Master \ /tmp/${PKGINST}/System >/dev/null 2>&1 removef -f ${PKGINST} >/dev/null 2>&1 # If this package is being added as an add-on package (not being installed # from the initial system installation via loadhba), then for non-ISA cards # which have boardids run 'dcu -s'. if [ "$ROOT" != "/mnt" ] then cat /etc/conf/drvmap.d/${PKGINST} | awk -F'|' ' BEGIN { BOARDID = 1 } { if (NF > 1) { if ($2 !~ /Y/) if ($2 !~ /N/) if($3 != "") { BOARDID = 0 exit } } } END { exit BOARDID }' [ $? -eq 0 ] && /sbin/dcu -s fi /etc/conf/bin/idbuild exit 0