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

  1. #ident    "@(#)pkg.cmds:i386/pkg/cmds/preremove    1.6.1.8"
  2.  
  3. PKGMSG=${PKGINST}.pkg
  4. LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-"C"}}}
  5.  
  6. if [ ! -f /usr/lib/locale/${LOCALE}/LC_MESSAGES/${PKGMSG} ]
  7. then
  8.    if [ -f ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} -a \
  9.     -d /usr/lib/locale/${LOCALE}/LC_MESSAGES ]
  10.    then
  11.     cp ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} \
  12.        /usr/lib/locale/${LOCALE}/LC_MESSAGES
  13.    fi
  14. fi
  15. CONFDIR=/etc/conf
  16. CONFBIN=${CONFDIR}/bin
  17.  
  18. FAILURE=1       # fatal error
  19. REBUILD=0
  20.  
  21. NOTOOLS=`pfmt -s error -g ${PKGMSG}:101 " The Installable Driver feature has been removed. The %s cannot be removed." ${NAME} 2>&1`
  22.  
  23. # determine that ID/TP tools are available
  24.  
  25. if [ ! -x ${CONFBIN}/idbuild -o ! -x ${CONFBIN}/idinstall \
  26.     -o ! -x ${CONFBIN}/idcheck ]
  27. then
  28.     message ${NOTOOLS}
  29.     exit $FAILURE
  30. fi
  31.  
  32. #------Remove drivers
  33.  
  34. #Full removal
  35. for MODULE in fp lockstat fc mirrorcon
  36. do
  37.     ${CONFBIN}/idcheck -p ${MODULE}
  38.     RES="$?"
  39.     if [ "${RES}" -ne "100" -a "${RES}" -ne "0" ]
  40.     then
  41.         ${CONFBIN}/idinstall -P ${PKGINST} -d ${MODULE} 2>> /tmp/${MODULE}.err
  42.         REBUILD=1
  43.     fi
  44. done
  45.  
  46. #Partial removal
  47. for MODULE in prf
  48. do
  49.         ${CONFBIN}/idcheck -p ${MODULE}
  50.         RES="$?"
  51.         if
  52.                 [ "${RES}" -ne "100" -a "${RES}" -ne "0" ]
  53.         then
  54.                 ${CONFBIN}/idinstall -gs  ${MODULE} |/usr/bin/sed -e 's/Y/N/' > System 2> ${ERR}
  55.                 ${CONFBIN}/idinstall -us  ${MODULE} > ${ERR} 2>&1
  56.                 ${CONFBIN}/idinstall -P ${PKGINST} -dopnT  ${MODULE} > ${ERR} 2>&1
  57.  
  58.         fi
  59. done
  60.  
  61.  
  62. # remove filter table stuff
  63.  
  64. if [ ! -z "`echo ${CLASSES} | grep post`" ]
  65. then
  66.     ETCLP=/etc/lp
  67.     USRSBIN=/usr/sbin
  68.     LPADMIN=${USRSBIN}/lpadmin
  69.     LPFILTER=${USRSBIN}/lpfilter
  70.     LPSCHED=${USRLIB}/lp/lpsched
  71.     LPSHUT=${USRSBIN}/lpshut
  72.     ACCEPT=${USRSBIN}/accept
  73.     REJECT=${USRSBIN}/reject
  74.     LPSTAT=${USRBIN}/lpstat
  75.     DUMPOLP=${USRSBIN}/dumpolp
  76.     ENABLE=${USRBIN}/enable
  77.     DISABLE=${USRBIN}/disable
  78.     TMP=/tmp/cmds.err
  79.     
  80.     FILTERTABLE=${ETCLP}/filter.table
  81.     FILTERTABLE_I=${ETCLP}/filter.table.i
  82.     FILTERTABLE_TMP=/var/tmp/flt.tbl$$
  83.  
  84.     rm -f /tmp/FDLIST
  85.     for filter in \
  86.         dpost \
  87.         postdaisy \
  88.         postdmd \
  89.         postplot \
  90.         posttek
  91.     do
  92.         echo "${filter}" >> /tmp/FDLIST
  93.     done
  94.  
  95.     while read filter
  96.     do
  97.         ${LPFILTER} -f ${filter} -x 2>>${TMP}
  98.     done < /tmp/FDLIST
  99.  
  100.     #####
  101.     #
  102.     # The ``factory installed'' filter table:
  103.     #####
  104.     mv ${FILTERTABLE} ${FILTERTABLE_TMP}
  105.     mv ${FILTERTABLE_I} ${FILTERTABLE} 2>/dev/null
  106.     
  107.     while read filter
  108.     do
  109.         ${LPFILTER} -f ${filter} -x 2>>${TMP}
  110.     done < /tmp/FDLIST
  111.  
  112.     mv ${FILTERTABLE} ${FILTERTABLE_I}
  113.     mv ${FILTERTABLE_TMP} ${FILTERTABLE}
  114.  
  115.     rm -f /tmp/FDLIST
  116.  
  117. fi  # end of post class removal
  118.  
  119. if [ "${REBUILD}" = "1" ]
  120. then
  121.     # rebuild for changes to take effect
  122.  
  123.     ${CONFBIN}/idbuild
  124.     if [ "$?" -ne "0" ]
  125.     then
  126.         exit ${FAILURE}
  127.     else
  128.         exit 10
  129.     fi
  130. else
  131.     exit 0
  132. fi
  133.  
  134.