home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / acl / install / preremove < prev   
Text File  |  1998-08-19  |  2KB  |  120 lines

  1. #ident    "@(#)preremove    1.3"
  2. #ident    "$Header: $"
  3.  
  4. FAILURE=2        # exit code if anything goes wrong
  5.  
  6. REBUILD=0
  7.  
  8. CONFDIR=/etc/conf
  9. CONFBIN=${CONFDIR}/bin
  10.  
  11. PKGMSG=${PKGINST}.pkg
  12. LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-"C"}}}
  13.  
  14. if [ ! -f /usr/lib/locale/${LOCALE}/LC_MESSAGES/${PKGMSG} ]
  15. then
  16.    if [ -f ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} -a \
  17.     -d /usr/lib/locale/${LOCALE}/LC_MESSAGES ]
  18.    then
  19.     cp ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} \
  20.        /usr/lib/locale/${LOCALE}/LC_MESSAGES
  21.    fi
  22. fi
  23.  
  24. turnoff () {
  25. cd /etc/conf/sdevice.d
  26. for i in $*
  27. do
  28. if [ -f $i ]
  29. then
  30. ed $i << END > /dev/null 2>&1
  31. 1,\$s/    Y    /    N    /
  32. w
  33. w
  34. q
  35. END
  36. fi
  37. done
  38. }
  39.  
  40. NOTOOLS=`pfmt -s error -g ${PKGMSG}:7 " The Installable Driver feature has been removed.  The %s cannot be removed." "${NAME}" 2>&1`
  41.  
  42. # determine that ID/TP tools are available
  43.  
  44. if
  45.     [ ! -x ${CONFBIN}/idbuild -o ! -x ${CONFBIN}/idinstall ]
  46. then
  47.     message ${NOTOOLS}
  48.     exit $FAILURE
  49. fi
  50.  
  51. SEDCMD="s/[     ]Y/    N/"
  52.  
  53. do_remove() {
  54.     OPTS="" # part of idinstall and -a -clop hack
  55.     ${CONFBIN}/idcheck -p ${1}
  56.     RET="$?"
  57.     if
  58.         [ "${RET}" -ne "100" -a "${RET}" -ne "0" ]
  59.     then
  60.         # The module cannot be completely removed.  The stub.c
  61.         # mdevice.d and sdevice.d files
  62.         # must remain configured. 
  63.         turnoff ${1}
  64.         mkdir /tmp/${1} 2> /dev/null
  65.         if [ -f ${CONFDIR}/pack.d/${1}/stubs.c ]
  66.         then
  67.             cp ${CONFDIR}/pack.d/${1}/stubs.c /tmp/${1}/stubs.c
  68.         fi
  69.         cp ${CONFDIR}/sdevice.d/${1} /tmp/${1}/${1}.s
  70.         cp ${CONFDIR}/mdevice.d/${1} /tmp/${1}/${1}.m
  71.     
  72.         ${CONFBIN}/idinstall -P ${PKGINST} -d${OPTS} ${1}
  73.         if [ ! -d ${CONFDIR}/pack.d/${1} ]
  74.         then
  75.             mkdir ${CONFDIR}/pack.d/${1}
  76.         fi
  77.         cp /tmp/${1}/${1}.s ${CONFDIR}/sdevice.d/${1}
  78.         cp /tmp/${1}/${1}.m ${CONFDIR}/mdevice.d/${1}
  79.         if [ -f /tmp/${1}/stubs.c ]
  80.         then
  81.             cp /tmp/${1}/stubs.c ${CONFDIR}/pack.d/${1}/stubs.c
  82.         fi
  83.         pfmt -s nostd -g ${PKGMSG}:8 "Removing %s %s module ...\n" "${NAME}" "${1}" 2>&1
  84.     
  85.         REBUILD=1
  86.     fi
  87. }
  88.  
  89. do_remove dac
  90.  
  91. if
  92.     [ "${REBUILD}" = "1" ]
  93. then
  94.     # rebuild for changes to take effect
  95.     
  96.     ${CONFBIN}/idbuild
  97.     if
  98.         [ "$?" -ne "0" ]
  99.     then
  100.         exit ${FAILURE}
  101.     else
  102.         exit 10
  103.     fi
  104. else
  105.     exit 0
  106. fi
  107.  
  108. while read cmd role
  109. do
  110.     adminrole -r $cmd $role
  111. done <<!
  112. getacl SSO
  113. setacl SSO
  114. tcpio  SSO
  115. tcpio  SOP
  116. !
  117.  
  118. exit 10            # indicates that the system should be rebooted
  119.  
  120.