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

  1. #ident    "@(#)preremove    1.2"
  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. #
  26. # determine that ID/TP tools are available
  27. #
  28. if [ ! -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. # remove modules installed by the nfs package
  37. #
  38. for MODULE in nfss nfs klm
  39. do
  40.     ${CONFBIN}/idcheck -p ${MODULE}
  41.     RES="$?"
  42.     if [ "${RES}" -ne "100" -a "${RES}" -ne "0" ]
  43.     then
  44.         if [ "${MODULE}" = "nfs" ]
  45.         then
  46.             # NFS cannot be completely removed. A stub
  47.             # must remain configured for nfssys()
  48.             mkdir /tmp/nfs$$ 2> /dev/null
  49.             cp ${CONFDIR}/pack.d/nfs/stubs.c /tmp/nfs$$/stubs.c
  50.             cp ${CONFDIR}/mdevice.d/nfs /tmp/nfs$$/nfs.m
  51.         fi
  52.         ${CONFBIN}/idinstall -P ${PKGINST} -d${OPTS} ${MODULE}
  53.         if [ "${MODULE}" = "nfs" ]
  54.         then
  55.             if [ ! -d ${CONFDIR}/pack.d/nfs ]
  56.             then
  57.                 mkdir ${CONFDIR}/pack.d/nfs
  58.                 chmod 0755 ${CONFDIR}/pack.d/nfs
  59.                 chgrp sys  ${CONFDIR}/pack.d/nfs
  60.                 chown root ${CONFDIR}/pack.d/nfs
  61.             fi
  62.             cp /tmp/nfs$$/nfs.m ${CONFDIR}/mdevice.d/nfs
  63.             cp /tmp/nfs$$/stubs.c ${CONFDIR}/pack.d/nfs/stubs.c
  64.  
  65.             chmod 0644 ${CONFDIR}/mdevice.d/nfs ${CONFDIR}/pack.d/nfs/stubs.c
  66.             chgrp sys  ${CONFDIR}/mdevice.d/nfs ${CONFDIR}/pack.d/nfs/stubs.c
  67.             chown root ${CONFDIR}/mdevice.d/nfs ${CONFDIR}/pack.d/nfs/stubs.c
  68.             rm -rf /tmp/nfs$$
  69.         fi
  70.         REBUILD=1
  71.     fi
  72. done
  73.  
  74. #
  75. # remove nfs from /etc/dfs/fstypes
  76. #
  77. /usr/bin/egrep -v '^nfs' /etc/dfs/fstypes > /tmp/fstypes.$$
  78. cp /tmp/fstypes.$$ /etc/dfs/fstypes
  79. rm /tmp/fstypes.$$
  80.  
  81. #
  82. # remove nfs commands from TFM database for role NET
  83. #
  84. #adminrole -r biod,mountd,automount,nfsd,exportfs,lockd  NET
  85. #adminrole -r statd,bootparamd,pcnfsd,showmount,nfsstat  NET 
  86.  
  87. #
  88. # eliminate reference to class file from installation
  89. #
  90. /usr/bin/ed /usr/X/lib/classdb/dtadmin > /dev/null 2>&1 <<EOT
  91. g/INCLUDE nfs.cdb;/d
  92. w
  93. q
  94. EOT
  95.  
  96. if [ "${REBUILD}" = "1" ]
  97. then
  98.     # rebuild for changes to take effect
  99.     
  100.     ${CONFBIN}/idbuild
  101.     if [ "$?" -ne "0" ]
  102.     then
  103.         exit ${FAILURE}
  104.     else
  105.         exit 10
  106.     fi
  107. else
  108.     exit 0
  109. fi
  110.