#!/sbin/sh
# postinstall script for for AdvMgt package
#
#

############## begin do_install ############################
do_install () 
{
${CONFBIN}/idinstall -d ${1} >${ERR} 2>&1
if [ ${1} = "asycS" ]
  then
     ${CONFBIN}/idinstall -P ${PKGINST} -ak ${1} >${ERR} 2>&1
  else
    ${CONFBIN}/idinstall -P ${PKGINST} -akN ${1} >${ERR} 2>&1
fi
RET=$?
if [ ${RET} != 0 ]
  then 
   ###Note.... ${NAME} is the package description name that is in 
   ###         pkginfo file.
   message "The installation cannot be completed due to an error in \
   the installation of the ${1} module of the ${NAME}. The file \
   ${ERR} contains the errors."
   
   exit ${FAILURE}
fi    

}
############## end do_install ###########################


#for iasyS/asycS/syssp
FAILURE=1  #This indicates fatal error
SUCCESS=0  #This indicates success
WARNING=2  #Warning or possible error condition
REBOOT=10  #System should be rebooted
DRIVER_IASYS=iasyS
DRIVER_ASYCS=asycS
DRIVER_SYSSP=sysSp
DRIVER="${DRIVER_IASYS} ${DRIVER_ASYCS} ${DRIVER_SYSSP}"
CONFBIN=/etc/conf/bin
ERR=/tmp/err.$
DCU=/sbin/dcu



for MODULE in ${DRIVER}
do
	cd /tmp/${MODULE}
	do_install ${MODULE}
done



${CONFBIN}/idresadd -n ${DRIVER_SYSSP}
removef ${PKGINST} /etc/conf/sdevice.d/sysSp
${DCU} -S
installf ${PKGINST} /etc/conf/sdevice.d/sysSp
${CONFBIN}/idconfupdate
${CONFBIN}/idbuild >/dev/null 2>&1

installf -f ${PKGINST}

cd /tmp 
rm -r /tmp/${DRIVER_IASYS}
rm -r /tmp/${DRIVER_ASYCS}
rm -r /tmp/${DRIVER_SYSSP}

rm ${ERR}

#should we add iasys.h and asycs.h?????
removef ${PKGINST} \
 /tmp/${DRIVER_IASYS}/Driver.o \
 /tmp/${DRIVER_IASYS}/Ftab \
 /tmp/${DRIVER_IASYS}/Master \
 /tmp/${DRIVER_IASYS}/Node \
 /tmp/${DRIVER_IASYS}/Space.c \
 /tmp/${DRIVER_IASYS}/Stubs.c \
 /tmp/${DRIVER_IASYS}/System \
 /tmp/${DRIVER_ASYCS}/Driver.o \
 /tmp/${DRIVER_ASYCS}/Drvmap \
 /tmp/${DRIVER_ASYCS}/Master \
 /tmp/${DRIVER_ASYCS}/Space.c \
 /tmp/${DRIVER_ASYCS}/Stubs.c \
 /tmp/${DRIVER_ASYCS}/System \
 /tmp/${DRIVER_IASYS} \
 /tmp/${DRIVER_ASYCS} \
 /tmp/${DRIVER_SYSSP}/Driver.o \
 /tmp/${DRIVER_SYSSP}/Drvmap \
 /tmp/${DRIVER_SYSSP}/Master \
 /tmp/${DRIVER_SYSSP}/Node \
 /tmp/${DRIVER_SYSSP}/System \
 /tmp/${DRIVER_SYSSP}  >/dev/null 2>&1
 
 removef -f ${PKGINST} >/dev/null 2>&1
 
 if [ $INSTALL_ICONS -a  $INSTALL_ICONS = FALSE ]
 then
 
 
    
gettxt :814  "\\n*** IMPORTANT NOTICE ***\\n\\tIf installation of all desired packa\
ges is complete,\\n\\tthe machine should be rebooted in order to\\n\\tensure sane\
 operation. Execute the shutdown\\n\\tcommand with the appropriate options to r\
eboot.\n"  >$TEMPVAR

echo $TEMPVAR
    
#gettxt :1 "\\nStrike the ENTER key to continue\n" >$TEMPVAR
    
#echo $TEMPVAR
    
#read -r TEMPVAR

exit 0

fi

exit ${REBOOT}
 
 
 
 
 
 
 
 
 
 
 
  
 
