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

  1. #ident    "@(#)postinstall    1.2"
  2. #ident    "$Header: $"
  3.  
  4. # Menu setup
  5.  
  6. CONFDIR=/etc/conf
  7. CONFBIN=${CONFDIR}/bin
  8.  
  9. PKGMSG=${PKGINST}.pkg
  10. LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-"C"}}}
  11.  
  12. if [ ! -f /usr/lib/locale/${LOCALE}/LC_MESSAGES/${PKGMSG} ]
  13. then
  14.    if [ -f ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} -a \
  15.     -d /usr/lib/locale/${LOCALE}/LC_MESSAGES ]
  16.    then
  17.     cp ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} \
  18.        /usr/lib/locale/${LOCALE}/LC_MESSAGES
  19.    fi
  20. fi
  21.  
  22. NOTOOLS=`pfmt -s error -g ${PKGMSG}:1 " The Installable Driver feature has been removed. The %s cannot be installed." "${NAME}" 2>&1`
  23.  
  24. SEDCMD1="s/[     ]N[     ]/    Y    /"
  25. SEDCMD2="s/[     ]N/    Y/"
  26.  
  27. # install a module.  $1 is the module name
  28.  
  29. do_install() {
  30.     ERR=/tmp/${1}.err
  31.     IDCOMPS="Driver.o Driver_atup.o Driver_mp.o Master System Space.c Stubs.c Mtune Dtune"
  32.     if [ -f ${1}.Dr ]; then mv ${1}.Dr Driver.o; fi
  33.     if [ -f ${1}_atup.Dr ]; then mv ${1}_atup.Dr Driver_atup.o; fi
  34.     if [ -f ${1}_mp.Dr ]; then mv ${1}_mp.Dr Driver_mp.o; fi
  35.  
  36.     if
  37.         [ -f ${1}.Sp ]
  38.     then
  39.         mv ${1}.Sp Space.c
  40.     fi
  41.     if
  42.         [ -f ${1}.St ]
  43.     then
  44.         mv ${1}.St Stubs.c
  45.     fi
  46.     if
  47.         [ -f ${1}.Mt ]
  48.     then
  49.         mv ${1}.Mt Mtune
  50.     fi
  51.     if
  52.         [ -f ${1}.Dt ]
  53.     then
  54.         mv ${1}.Dt Dtune
  55.     fi
  56.     if
  57.         [ -f ${1}.Ma ]
  58.     then
  59.         grep -v "^[\*#]ident" ${1}.Ma > Master
  60.         rm -rf ${1}.Ma
  61.     fi
  62.     if
  63.         [ -f ${1}.Sy ]
  64.     then
  65.         grep -v "^[\*#]ident" ${1}.Sy |
  66.             sed "${SEDCMD1}"  > System
  67.         rm -rf ${1}.Sy
  68.     fi
  69.     pfmt -s nostd -g ${PKGMSG}:2 "Installing %s %s module ...\n" "${NAME}" "${1}" 2>&1
  70.     ${CONFBIN}/idcheck -p ${1} > ${ERR} 2>&1
  71.     RET=$?
  72.     if [ ${RET} = 0 ] || [ ${RET} = 8 ]
  73.     then
  74.         ${CONFBIN}/idinstall -P ${PKGINST} -a ${1} > ${ERR} 2>&1
  75.         RET=$?
  76.     else
  77.         ${CONFBIN}/idinstall -P ${PKGINST} -u ${1} > ${ERR} 2>&1
  78.         RET=$?
  79.     fi
  80.     rm -rf ${IDCOMPS}
  81.     if [ ${RET} != 0 ]
  82.     then
  83.         message -d `pfmt -s error -g ${PKGMSG}:3 " The installation cannot be completed due to an error in the driver installation during the installation of the %s module of the %s.  The file %s contains the errors." "${1}" "${NAME}" "${ERR}" 2>&1`
  84.         exit ${FAILURE}
  85.     fi
  86.     rm -rf ${ERR}
  87. }
  88.  
  89. errflag=0
  90.  
  91. # determine that ID/TP tools are available
  92.  
  93. if
  94.     [ ! -x ${CONFBIN}/idbuild -o ! -x ${CONFBIN}/idinstall \
  95.         -o ! -x ${CONFBIN}/idcheck ]
  96. then
  97.     message -d ${NOTOOLS}
  98.     exit $FAILURE
  99. fi
  100.  
  101. VOLATILES=`echo /tmp/acl/*`
  102. cd /tmp/acl
  103. # install drivers/modules
  104.  
  105. do_install dac
  106.  
  107. #
  108. #The following while-loop reads the commands and the roles
  109. #to which these commands are to be assigned.  If privileges, 
  110. #separated by a colon, appear next to the role in the script that 
  111. #this while-loop reads in, it means that those privileges are to
  112. #be shutoff for that command when it is assigned to the role.
  113. #
  114. while read cmd roles
  115. do
  116.     base=`basename $cmd`
  117.     privs=`
  118.     egrep ":${cmd}$" /etc/security/tcb/privs|    # Find command in tcb database
  119.     sed 's/^.*%inher,\(.*\):.*/\1/p' |          # get the set of inher privs
  120.     sed 's/^.*%fixed,\(.*\):.*//p' |            # delete the fixed privs
  121.     sed 's/,/:/gp'                              # changed ,'s to :'s
  122.     `
  123.     if [ -z "$privs" ]
  124.     then
  125.         if [ -f $cmd ]
  126.         then
  127.             prvd="no"
  128.         else
  129.         pfmt -s warn -g {PKGMSG}:4 " %s not found on the system.  Not adding to TFM.\n" ${cmd} 2>&1
  130.             continue
  131.         fi
  132.     else
  133.         prvd="yes"
  134.     fi
  135.     set $roles
  136.     save="$privs"
  137.     while [ $# -gt 0 ]
  138.     do
  139.         role=$1
  140.         if echo "$1" | grep ":" > /dev/null
  141.         then
  142.             role=`
  143.             echo "$1" | sed 's/:.*$//p'`
  144.             if [ "$prvd" = "yes" ]
  145.             then
  146.                 shutoff=`
  147.                 echo "$1" | sed 's/^[A-Z]*://p'`
  148.                 shutoff=`echo "$shutoff"|sed 's/:/ /gp'`
  149.                 fullset=`echo "$save"|sed 's/:/ /gp'`
  150.                 for i in $shutoff    #check if privileges to be shut off
  151.                 do                    #are in full set of privilges
  152.                     found="false"
  153.                     for j in $fullset
  154.                     do
  155.                         if [ "$i" = "$j" ]
  156.                         then
  157.                             found="true"
  158.                             break
  159.                         fi
  160.                     done
  161.                     privs=""
  162.                     if [ "$found" = "false" ]
  163.                     then
  164.                         pfmt -s warn -g ${PKGMSG}:5 " %s privilege specified to be shut off for %s,\n         but it is NOT in its set of privileges.\n" $i $cmd 2>&1
  165.                         break
  166.                     fi
  167.                 done
  168.                 if [ -z "$shutoff" ]
  169.                 then
  170.                     privs="$save"
  171.                 else
  172.                     for i in $fullset
  173.                     do
  174.                         found="false"
  175.                         for j in $shutoff
  176.                         do
  177.                             if [ "$i" = "$j" ]
  178.                             then
  179.                                 found="true"
  180.                                 break
  181.                             fi
  182.                         done
  183.                         if [ "$found" = "false" ]
  184.                         then
  185.                             if [ -z "$privs" ]
  186.                             then
  187.                                 privs=$i
  188.                             else
  189.                                 privs=$privs:$i
  190.                             fi
  191.                         fi
  192.                     done
  193.                 fi
  194.             fi
  195.         else
  196.             privs="$save"
  197.         fi
  198.         if [ -z "$privs" ]
  199.         then
  200.             adminrole -a $base:$cmd $role
  201.         else
  202.             adminrole -a $base:$cmd:$privs $role
  203.         fi
  204.         shift
  205.     done
  206. done <<-!
  207. /usr/bin/getacl    SSO
  208. /usr/bin/setacl    SSO
  209. /usr/bin/tcpio    SOP:dacwrite:macwrite    SSO
  210. !
  211.  
  212. #
  213. #
  214. #
  215. #    make a new UNIX(R)
  216. #
  217. # rebuild for changes to take effect
  218.  
  219. TMP=/tmp/acl.$$
  220. ${CONFBIN}/idbuild 2>>${TMP}
  221. if
  222.     [ "$?" -ne "0" ]
  223. then
  224.     pfmt -s nostd -g ${PKGMSG}:6 "An error has occurred during the rebuild of the UNIX System.  Errors have been written to the file %s.\n" ${TMP} 2>&1
  225.     exit ${FAILURE}
  226. fi
  227.  
  228. rm -f ${TMP} 1>/dev/null 2>&1
  229.  
  230. removef ${PKGINST} ${VOLATILES} /tmp/acl >/dev/null 2>&1
  231. removef -f ${PKGINST} >/dev/null 2>&1
  232.  
  233. installf -f ${PKGINST}
  234.  
  235. exit 10            # indicates that the system should be rebooted
  236.