#! /bin/sh
#
# ident "@(#)postinstall 1.24	99/06/08 SMI"
#
# Copyright (c) 1999 by Sun Microsystems, Inc.
# All rights reserved.
#

PATH="/bin:/usr/bin:/usr/sbin:${PATH}"
export PATH

EXIT=0

TMP=/tmp/$$

#
# this function updates the $BASEDIR/etc/remote file with
#	the PCMCIA serial port entries
#
update_etc_remote()
{

    egrep -s '^pc0:' $BASEDIR/etc/remote

    if [ "$?" != 0 ]
      then
	cp $BASEDIR/etc/remote $TMP.remote
	( echo "1"
	  echo "i"
	  echo "# The next 17 lines are for the PCMCIA serial/modem cards."
	  echo "#"
          echo "pc0:\\"
          echo '	:dv=/dev/cua/pc0:br#38400:el=^C^S^Q^U^D:ie=%$:oe=^D:nt:hf:'
          echo "pc1:\\"
       	  echo '	:dv=/dev/cua/pc1:br#38400:el=^C^S^Q^U^D:ie=%$:oe=^D:nt:hf:'
          echo "pc2:\\"
       	  echo '	:dv=/dev/cua/pc2:br#38400:el=^C^S^Q^U^D:ie=%$:oe=^D:nt:hf:'
          echo "pc3:\\"
       	  echo '	:dv=/dev/cua/pc3:br#38400:el=^C^S^Q^U^D:ie=%$:oe=^D:nt:hf:'
          echo "pc4:\\"
       	  echo '	:dv=/dev/cua/pc4:br#38400:el=^C^S^Q^U^D:ie=%$:oe=^D:nt:hf:'
          echo "pc5:\\"
       	  echo '	:dv=/dev/cua/pc5:br#38400:el=^C^S^Q^U^D:ie=%$:oe=^D:nt:hf:'
          echo "pc6:\\"
       	  echo '	:dv=/dev/cua/pc6:br#38400:el=^C^S^Q^U^D:ie=%$:oe=^D:nt:hf:'
          echo "pc7:\\"
       	  echo '	:dv=/dev/cua/pc7:br#38400:el=^C^S^Q^U^D:ie=%$:oe=^D:nt:hf:'
	  echo "." ; echo "w" ; echo "q"
	) | ed -s $TMP.remote > /dev/null
	cp $TMP.remote $BASEDIR/etc/remote
      fi

}

grep '^pcser\>' ${BASEDIR}/etc/name_to_major > /dev/null && \
rem_drv -b ${BASEDIR} pcser
add_drv -b ${BASEDIR} -n \
	-m '* 0666 uucp uucp' \
	-i '"pccard,serial" "pccard102,5" "pccard102,2" "pccard,Intel_MODEM_2400+_iNC110US_A-"' \
	pcser \
|| EXIT=1

#
# update the $BASEDIR/etc/remote file
#
update_etc_remote

exit ${EXIT}
