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

  1. #ident    "@(#)pkg.acp:preremove    1.2.4.9"
  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 /var/sadm/pkg/${PKGINST}/install/inst/locale/${LOCALE}/${PKGMSG} \
  10.     -a -d "/usr/lib/locale/${LOCALE}/LC_MESSAGES" ]
  11.    then
  12.     ln -s ${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. ERR=/tmp/acp.rm.err
  23.  
  24. trap '' 1 2 3 5 15 
  25.  
  26. NOTOOLS=`pfmt -s error -g ${PKGMSG}:101 " The Installable Driver feature has been removed. The %s cannot be removed." ${NAME} 2>&1`
  27.  
  28. # determine that ID/TP tools are available
  29.  
  30. if
  31.     [ ! -x ${CONFBIN}/idbuild -o ! -x ${CONFBIN}/idinstall ]
  32. then
  33.     message ${NOTOOLS}
  34.     exit $FAILURE
  35. fi
  36.  
  37.  
  38. rem_module () {
  39.  
  40. MODULE=$1
  41. MODARGS=$2
  42.  
  43.     ${CONFBIN}/idinstall -gs ${MODULE} | /usr/bin/sed -e\
  44.         's/    Y/    N/' > System 2>/dev/null
  45.     ${CONFBIN}/idinstall -us ${MODULE} > ${ERR} 2>&1
  46.  
  47.     if [ $? != 0 ]
  48.         then
  49.             message `pfmt -s nostd -g ${PKGMSG}:102 " The removal of %s cannot be completed due to an error in the removal of the driver module. The file %s contains the errors." ${MODULE} ${ERR} 2>&1`
  50.             exit $FAILURE
  51.         fi
  52.         ${CONFBIN}/idinstall -P ${PKGINST} -d${MODARGS} ${MODULE} > ${ERR} 2>&1
  53.  
  54. }
  55.  
  56. ## remove the xnamfs: Driver.o, space.c, sdevice.d, mtune.d, Modstub.o
  57. rem_module xnamfs opsTb
  58.  
  59. for MODULE in XENIX consem devadp i286x isocket osocket sp v3compat xout
  60. do
  61.     ${CONFBIN}/idcheck -p ${MODULE}
  62.     RET="$?"
  63.     if
  64.         [ "${RET}" -ne "100" -a "${RET}" -ne "0" ]
  65.     then
  66.  
  67.         ${CONFBIN}/idinstall -P ${PKGINST} -d ${MODULE} 2>> /tmp/${module}.err
  68.         REBUILD=1
  69.     fi
  70. done
  71.  
  72. #
  73. # remove the SCO portion of PTM with by calling sco_pt.install with zero.
  74. # this will update the ptm/pts/ptem system file, the ptm/pts node file
  75. # and remove the ptm rc file. The only thing this script won't remove
  76. # is the 'putdev's' we did. we need to do that first by ourselves
  77. #
  78.  
  79. # create temporary /etc/conf/cf.d/mtune; it's blown away
  80. # below after we're done playing w/the tuneables....
  81. # do not clobber mtune if it exists already
  82. MTUNEORG=/usr/tmp/mtune.$$
  83. if [ -f /etc/conf/cf.d/mtune ]
  84. then
  85.         cp /etc/conf/cf.d/mtune $MTUNEORG
  86.         cat /etc/conf/mtune.d/* >> /etc/conf/cf.d/mtune
  87. else
  88.         cat /etc/conf/mtune.d/* > /etc/conf/cf.d/mtune
  89. fi
  90.  
  91. set - `${CONFBIN}/idtune -g NUMSCOPT`
  92. NUMSCOPT=$1
  93.  
  94. # if mtune existed restore it, else remove temp /etc/conf/cf.d/mtune
  95. if [ -f $MTUNEORG ]
  96. then
  97.         cp $MTUNEORG /etc/conf/cf.d/mtune
  98.         rm -f $MTUNEORG
  99. else
  100.         rm -f /etc/conf/cf.d/mtune 2>/dev/null 1>/dev/null
  101. fi
  102.  
  103.  
  104.  
  105. TEMP=0
  106. until
  107.     [ "$TEMP" -eq $NUMSCOPT ]
  108. do
  109.     /sbin/putdev -d ptyp${TEMP} > /dev/null 2>&1
  110.     TEMP=`expr $TEMP + 1`
  111. done
  112.  
  113. /sbin/sh /var/sadm/pkg/acp/install/sco_pt.install 0
  114.  
  115.  
  116. #change the group of /dev/[r]dsk/[01]s5 back to sys
  117. #change the group perms of /dev/[r]dsk/[01]s5 back to  0
  118.  
  119. if [ -b /dev/dsk/[01]s5 ]
  120. then 
  121.     chgrp sys /dev/dsk/[01]s5
  122.     chmod g-rw /dev/dsk/[01]s5
  123. fi
  124.  
  125. if [ -c /dev/rdsk/[01]s5 ]
  126. then 
  127.     chgrp sys /dev/rdsk/[01]s5
  128.          chmod g-rw /dev/rdsk/[01]s5
  129. fi
  130.  
  131. #remove the group dos from /etc/group
  132. groupdel dos > /dev/null 2>&1 
  133.  
  134. rm -f /dev/hd1[0-6] > /dev/null 2>&1
  135. rm -f /dev/rhd1[0-6] > /dev/null 2>&1
  136. rm -f /dev/install1 /dev/rinstall1 /dev/fd148ds8 /dev/fd148ds9 /dev/fd148 /dev/rfd148ds8 /dev/rfd148ds9 /dev/rfd148 > /dev/null 2>&1
  137. rm -f /dev/fd196ds15 /dev/fd196 /dev/rfd196ds15 /dev/rfd196 /dev/rfd148 > /dev/null 2>&1
  138. rm -f /dev/rfd1135ds18 /dev/rfd196ds18 /dev/rdsk/f1q18dt /dev/rfd1135ds9 /dev/rfd196ds9 /dev/rdsk/f1q9dt /dev/rdsk/f1d8t /dev/rdsk/f1d9t > /dev/null 2>&1
  139. rm -f /dev/fd1135ds18 /dev/fd196ds18 /dev/dsk/f1q18dt /dev/fd1135ds9 /dev/fd196ds9 /dev/dsk/f1q9dt /dev/dsk/f1d8t /dev/dsk/f1d9t > /dev/null 2>&1
  140. rm -f /dev/hd1a /dev/u[012] /dev/rhd1a /dev/rd1d /dev/sctfdm1 /dev/sctfdm129
  141.  
  142.  
  143.  
  144. rm -f $TMP > /dev/null 2>&1 
  145.  
  146. if
  147.     [ "${REBUILD}" = "1" ]
  148. then
  149.     # rebuild for changes to take effect
  150.     
  151.     ${CONFBIN}/idbuild
  152.     if
  153.         [ "$?" -ne "0" ]
  154.     then
  155.         exit ${FAILURE}
  156.     else
  157.         exit 10
  158.     fi
  159. else
  160.     exit 0
  161.  
  162. fi
  163.