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

  1. #ident    "@(#)postinstall    1.2"
  2.  
  3. ETCLP=/etc/lp
  4. USRSBIN=/usr/sbin
  5. LPADMIN=${USRSBIN}/lpadmin
  6. LPFILTER=${USRSBIN}/lpfilter
  7. LPSCHED=${USRLIB}/lp/lpsched
  8. LPSHUT=${USRSBIN}/lpshut
  9. ACCEPT=${USRSBIN}/accept
  10. REJECT=${USRSBIN}/reject
  11. LPSTAT=${USRBIN}/lpstat
  12. DUMPOLP=${USRSBIN}/dumpolp
  13. ENABLE=${USRBIN}/enable
  14. DISABLE=${USRBIN}/disable
  15. TMP=/tmp/lp.err
  16. PKGMSG=${PKGINST}.pkg
  17. LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-"C"}}}
  18.  
  19. if [ ! -f /usr/lib/locale/${LOCALE}/LC_MESSAGES/${PKGMSG} ]
  20. then
  21.    if [ -f ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} -a \
  22.     -d /usr/lib/locale/${LOCALE}/LC_MESSAGES ]
  23.    then
  24.     cp ${REQDIR}/inst/locale/${LOCALE}/${PKGMSG} \
  25.        /usr/lib/locale/${LOCALE}/LC_MESSAGES
  26.    fi
  27. fi
  28. ##########
  29. #
  30. # Patch the main menu file to use the correct FML object
  31. ##########
  32.  
  33. OAMBASE=${OAMBASE:-/var/sadm/sysadm}
  34. INTFBASE=${INTFBASE:-${OAMBASE}/menu}
  35.  
  36. ##########
  37. ##
  38. ## Set up the LP print service configuration.
  39. ##
  40. ##########
  41.  
  42. ##########
  43. #
  44. # Get rid of any old startup/shutdown scripts.
  45. ##########
  46. rm -f /etc/rc.d/lp /etc/shutdown.d/lp 2>/dev/null
  47.  
  48.  
  49. ##########
  50. #
  51. # ``Compile'' the filter table entries. This is a tad
  52. # complicated, because we want to preserve the original
  53. # filter.table and filter.table.i entries.
  54. #
  55. # Note: We do this whether or not we are installing any particular
  56. # sub-package (e.g. PostScript), so that it gets done in one place.
  57. # The OAM installation process won't install a class not listed
  58. # in the $CLASSES variable, so we won't be compiling anything
  59. # we shouldn't.
  60. ##########
  61.  
  62. FILTERTABLE=${ETCLP}/filter.table
  63. FILTERTABLE_I=${ETCLP}/filter.table.i  #Factory-installed
  64. FDTMP=${ETCLP}/fd
  65. FILTERTABLE_TMP=${FDTMP}/filter.table
  66.  
  67. if ls ${FDTMP}/*.fd > /tmp/FDLIST 2>/dev/null
  68. then
  69.     #####
  70.     #
  71.     # The regular filter table:
  72.     #####
  73.     while read fd
  74.     do
  75.         filter=`expr "${fd}" : '.*/\([^/]*\)\.fd$'`
  76.         ${LPFILTER} -f ${filter} -F ${fd} 2>>${TMP}
  77.     done < /tmp/FDLIST
  78.     #####
  79.     #
  80.     # The ``factory installed'' filter table:
  81.     #####
  82.     mv ${FILTERTABLE} ${FILTERTABLE_TMP}
  83.     mv ${FILTERTABLE_I} ${FILTERTABLE} 2>/dev/null
  84.  
  85.     while read fd
  86.     do
  87.         filter=`expr "${fd}" : '.*/\([^/]*\)\.fd$'`
  88.         ${LPFILTER} -f ${filter} -F ${fd} 2>>${TMP}
  89.     done < /tmp/FDLIST
  90.  
  91.     mv ${FILTERTABLE} ${FILTERTABLE_I}
  92.     mv ${FILTERTABLE_TMP} ${FILTERTABLE}
  93.  
  94.     removef ${PKGINST} - < /tmp/FDLIST > /dev/null 2>&1
  95.     rm -f ${FDTMP}/*.fd
  96. fi
  97. removef ${PKGINST} ${FDTMP} >/dev/null
  98. rm -rf ${FDTMP} /tmp/FDLIST
  99.  
  100. ##########
  101. #
  102. # We no longer need the program that dumps old LP Spooler
  103. # status files. It was added in this installation procedure
  104. # only so we could use it to convert from old to new.
  105. ##########
  106. removef ${PKGINST} ${DUMPOLP} >/dev/null
  107. rm -f ${DUMPOLP}
  108.  
  109.  
  110. # download command expects to find Type 1 PostScript fonts for 
  111. # downloading in the directory /usr/share/lib/hostfontdir and 
  112. # mapping of fontnames to filenames in a file named map
  113.  
  114. > /usr/share/lib/hostfontdir/map
  115. chmod 755 /usr/share/lib/hostfontdir/map
  116. chown lp /usr/share/lib/hostfontdir/map
  117. chgrp lp /usr/share/lib/hostfontdir/map
  118. installf ${PKGINST} /usr/share/lib/hostfontdir/map v 0755 lp lp
  119.  
  120.  
  121. ##########
  122. #
  123. # Complete the installation database
  124. ##########
  125. removef  -f ${PKGINST} > /dev/null 2>&1
  126. installf -f ${PKGINST} > /dev/null 2>&1
  127.  
  128.  
  129. #
  130. #The following defines the administrative roles for the TFM database.
  131. #
  132. #
  133. #
  134. while read cmd roles
  135. do
  136.     base=`basename $cmd`
  137.     privs=`
  138.     egrep ":${cmd}$" /etc/security/tcb/privs|    # Find command in tcb database
  139.     sed 's/^.*%inher,\(.*\):.*/\1/p' |          # get the set of inher privs
  140.     sed 's/^.*%fixed,\(.*\):.*//p' |            # delete the fixed privs
  141.     sed 's/,/:/gp'                              # changed ,'s to :'s
  142.     `
  143.     if [ -z "$privs" ]
  144.     then
  145.        echo $cmd $roles >> /tmp/rolelist
  146.        continue
  147.     else
  148.         prvd="yes"
  149.     fi
  150.     set $roles
  151.     save="$privs"
  152.     while [ $# -gt 0 ]
  153.     do
  154.         role=$1
  155.         if echo "$1" | grep ":" > /dev/null
  156.         then
  157.             role=`
  158.             echo "$1" | sed 's/:.*$//p'`
  159.             if [ "$prvd" = "yes" ]
  160.             then
  161.                 shutoff=`
  162.                 echo "$1" | sed 's/^[A-Z]*://p'`
  163.                 shutoff=`echo "$shutoff"|sed 's/:/ /gp'`
  164.                 fullset=`echo "$save"|sed 's/:/ /gp'`
  165.                 for i in $shutoff    #check if privileges to be shut off
  166.                 do                    #are in full set of privilges
  167.                     found="false"
  168.                     for j in $fullset
  169.                     do
  170.                         if [ "$i" = "$j" ]
  171.                         then
  172.                             found="true"
  173.                             break
  174.                         fi
  175.                     done
  176.                     privs=""
  177.                     if [ "$found" = "false" ]
  178.                     then
  179.                         pfmt -s warn -g ${PKGMSG}:52 " %s privilege specified to be shut off for %s,\n         but it is NOT in its set of privileges.\n" $i $cmd 2>&1
  180.                         break
  181.                     fi
  182.                 done
  183.                 if [ -z "$shutoff" ]
  184.                 then
  185.                     privs="$save"
  186.                 else
  187.                     for i in $fullset
  188.                     do
  189.                         found="false"
  190.                         for j in $shutoff
  191.                         do
  192.                             if [ "$i" = "$j" ]
  193.                             then
  194.                                 found="true"
  195.                                 break
  196.                             fi
  197.                         done
  198.                         if [ "$found" = "false" ]
  199.                         then
  200.                             if [ -z "$privs" ]
  201.                             then
  202.                                 privs=$i
  203.                             else
  204.                                 privs=$privs:$i
  205.                             fi
  206.                         fi
  207.                     done
  208.                 fi
  209.             fi
  210.         else
  211.             privs="$save"
  212.         fi
  213.         if [ -z "$privs" ]
  214.         then
  215.             adminrole -a $base:$cmd $role 2>> ${TMP}
  216.         else
  217.             adminrole -a $base:$cmd:$privs $role 2>> ${TMP}
  218.         fi
  219.         shift
  220.     done
  221. done <<! 2>&1 
  222. /usr/bin/lpstat        OP    SOP    SSO
  223. /usr/sbin/lpfilter    SOP    SSO
  224. /usr/sbin/lpforms    SOP    SSO
  225. /usr/sbin/accept    OP    SOP    SSO
  226. /usr/sbin/reject    SOP    SSO
  227. /usr/sbin/lpmove    SOP    SSO
  228. /usr/sbin/lpusers    SOP    SSO
  229. !
  230.  
  231. [ "$PKGINSTALL_TYPE" != NEWINSTALL ] || exit 0
  232.  
  233. ############# Begin UPGRADE AND OVERLAY #######################
  234.  
  235. SCRIPTS=/usr/sbin/pkginst
  236. . ${SCRIPTS}/updebug
  237.  
  238. [ "$UPDEBUG" = YES ] && set -x
  239.  
  240. [ "$AUTOMERGE" = NULL ] || {
  241.  
  242.     #    If AUTOMERGE=Yes, ${SCRIPTS}/pkgmrgconf will 
  243.     #    merge the config files listed in $UPGRADE_STORE/${PKGINST}.sav.
  244.     #    If merge failed, it informs user which files the merge failed.
  245.  
  246.     #    If AUTOMERGE=No, ${SCRIPTS}/pkgmrgconf will 
  247.     #    inform user where there old config files live and that
  248.     #    the system will use new versions of the config. files
  249.  
  250.     [ "$UPDEBUG" = YES ] && goany
  251.  
  252.     ${SCRIPTS}/pkgmrgconf "${PKGINST}" "$AUTOMERGE" "$NAME"
  253.  
  254.     [ "$UPDEBUG" = YES ] && goany
  255. }
  256.  
  257. # cleanup patch files from /var/sadm/install/contents and rm them
  258.  
  259. ${SCRIPTS}/up_cleanup "${PKGINST}"
  260.  
  261. ############# End   UPGRADE AND OVERLAY #######################
  262.  
  263. exit 0
  264.