home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / nsu / install / preremove < prev    next >
Text File  |  1998-08-19  |  4KB  |  180 lines

  1. #ident    "@(#)preremove    1.3"
  2. #ident    "$Header: $"
  3.  
  4. PKGMSG=${PKGINST}.pkg
  5. LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-"C"}}}
  6.  
  7. if [ ! -f /usr/lib/locale/${LOCALE}/LC_MESSAGES/${PKGMSG} ]
  8. then
  9.    if [ -f ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} -a \
  10.     -d /usr/lib/locale/${LOCALE}/LC_MESSAGES ]
  11.    then
  12.     cp ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} \
  13.        /usr/lib/locale/${LOCALE}/LC_MESSAGES
  14.    fi
  15. fi
  16. FAILURE=1    # fatal error
  17.  
  18. REBUILD=0
  19.  
  20. CONFDIR=/etc/conf
  21. CONFBIN=$CONFDIR/bin
  22.  
  23. NOTOOLS=`pfmt -s error -g ${PKGMSG}:51 " The Installable Driver feature has been removed. The %s cannot be removed." ${NAME} 2>&1`
  24.  
  25. # determine that ID/TP tools are available
  26.  
  27. if
  28.     [ ! -x ${CONFBIN}/idbuild -o ! -x ${CONFBIN}/idinstall \
  29.             -o ! -x ${CONFBIN}/idcheck ]
  30. then
  31.     message ${NOTOOLS}
  32.     exit $FAILURE
  33. fi
  34.  
  35. #
  36. #    Do the following for TSA
  37. #
  38.  
  39. #trap 'exit 3' 15
  40.  
  41. # These variables should have been set by the request script.
  42. #[ "$DEBUG" ] && set -x
  43. #DOT=${DOT:-/opt/bin} export DOT
  44. TCPPORT=${TCPPORT:-413}
  45.  
  46. # shut down the daemon
  47. /bin/sh /etc/init.d/unixtsa stop
  48.  
  49. # Edit /etc/inet/services
  50. grep '^unixtsa' /etc/inet/services >/dev/null 2>&1
  51. if [ $? -eq 0 ]
  52. then
  53.     TMP=/var/tmp/unixtsa.$$
  54.     egrep -v '^unixtsa' /etc/inet/services >$TMP
  55.     cat $TMP >/etc/inet/services
  56.     rm -f $TMP
  57. fi
  58. #    Work for TSA is done
  59.  
  60. for MODULE in timod tirdwr pckt ptem ptm pts ticlts ticots ticotsor ntty net md5
  61. do
  62.     ${CONFBIN}/idcheck -p ${MODULE}
  63.     RES="$?"
  64.     if
  65.         [ "${RES}" -ne "100" -a "${RES}" -ne "0" ]
  66.     then
  67.         ${CONFBIN}/idinstall -P ${PKGINST} -d ${MODULE}
  68.         REBUILD=1
  69.     fi
  70. done
  71.  
  72. #
  73. #remove entries added to the device database
  74. #
  75. for DEVICE in pseudo_master ticlts ticots ticotsord
  76. do
  77.     # Error may only indicate we are not running an ES system
  78.     # or entry does not exist.
  79.     MSG="`/sbin/putdev -d ${DEVICE} 2>&1`"
  80.     RETURN=$?
  81.     if    [ "$RETURN" = 1 -o "$RETURN" = 2 -o "$RETURN" = 5 ]
  82.         # there's a fatal error that will affect the other devices, too.
  83.         # so print error and abort the loop
  84.     then    pfmt -s nostd -g ${PKGMSG}:52 "Device Database Error %s when deleting %s\n" $RETURN $DEVICE 2>&1
  85.         echo $MSG
  86.         break
  87.     elif    [ "$RETURN" != 0 -a "$RETURN" != 3 ]
  88.         # return 0: everything worked.
  89.         # return 3: entry was not there to delete
  90.         #when none of the above, error gets printed and we loop
  91.     then    pfmt -s nostd -g ${PKGMSG}:52 "Device Database Error %s when deleting %s\n" $RETURN $DEVICE 2>&1
  92.         echo $MSG
  93.     fi
  94. done
  95.  
  96. # The lp Networking service must be down to be removed!
  97.  
  98. /usr/sbin/lpshut >/dev/null 2>&1
  99.  
  100. #
  101. # remove the listener id
  102. #
  103. /usr/sbin/userdel listen  >/dev/null 2>&1
  104. #
  105. # remove listen-type port monitors and any symbolic links that might
  106. # be lying arount
  107. #
  108. sacadm -L -t listen 2>/dev/null | cut -f1 -d: >/tmp/listeners
  109. for i in `cat /tmp/listeners`
  110. do
  111.     sacadm -r -p $i >/dev/null 2>&1
  112. done
  113. # Remove the cmds added to the NET administration role
  114. #    cp is needed by nsu and dfs, so neither preremoves remove it.
  115. #    The packages can then remain independent.
  116. #/usr/bin/adminrole -r \
  117. #   pmadm,nlsadmin,sacadm,cs,keymaster,idadmin,rxservice,cat \
  118. #   NET >/dev/null 2>&1
  119. #
  120. # symlinks and links
  121. #
  122. LHOME=$BASEDIR/usr/net/nls
  123. if [ -f $LHOME/listen ]
  124. then
  125.     rm $LHOME/listen
  126. fi
  127. if [ -f $LHOME/dbfconv ]
  128. then
  129.     rm $LHOME/dbfconv
  130. fi
  131. if [ -f $LHOME/nlps_server ]
  132. then
  133.     rm $LHOME/nlps_server
  134. fi
  135. if [ -f /usr/bin/nlsadmin ]
  136. then
  137.     rm /usr/bin/nlsadmin
  138. fi
  139. rm /tmp/listeners
  140.  
  141. #
  142. #    Remove entries from /etc/netconfig
  143. #
  144.  
  145. grep -v '[     ]loopback[     ][     ]*-[     ][     ]*/dev/ticlts[     ]' /etc/netconfig 2>/dev/null >/tmp/$$.1
  146. grep -v '[     ]loopback[     ][     ]*-[     ][     ]*/dev/ticotsord[     ]' /tmp/$$.1 2>/dev/null >/tmp/$$.2
  147. grep -v '[     ]loopback[     ][     ]*-[     ][     ]*/dev/ticots[     ]' /tmp/$$.2 2>/dev/null >/etc/netconfig
  148.  
  149. rm -f /rmp/$$.1 /tmp/$$.2
  150.  
  151. #
  152. #    Remove entries from OAM scripts...
  153. #
  154. # OAM - OAM
  155. if [ -f /usr/sadm/sysadm/menu/netservices/netserve.menu ] 
  156. then
  157.     fgrep -v 'name_to_address^Machine and Service Address Management^name_to_addr/map.menu' /usr/sadm/sysadm/menu/netservices/netserve.menu 2>/dev/null >/tmp/$$.3
  158.     cp /tmp/$$.3 /usr/sadm/sysadm/menu/netservices/netserve.menu
  159. fi
  160.  
  161. removef -f $PKGINST
  162.  
  163. #
  164. if
  165.     [ "${REBUILD}" = "1" ]
  166. then
  167.     # rebuild for changes to take effect
  168.     
  169.     ${CONFBIN}/idbuild
  170.     if
  171.         [ "$?" -ne "0" ]
  172.     then
  173.         exit ${FAILURE}
  174.     else
  175.         exit 10
  176.     fi
  177. else
  178.     exit 0
  179. fi
  180.