home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-User.iso / Upgrader.app / Default.upgrade / PostProcess < prev    next >
Encoding:
Text File  |  1997-03-12  |  5.0 KB  |  134 lines

  1. #!/tmp/csh -f
  2. #
  3. # Upgrader post-processing script.
  4.  
  5. set     path = (/bin /usr/bin /etc /usr/etc /usr/ucb)
  6. unalias *
  7.  
  8. if ($#argv != 2) then
  9.     echo "Usage: PostProcess targroot sourceroot"
  10.     exit 1
  11. endif
  12.  
  13. set target = $argv[1]
  14. set source = $argv[2]
  15. set RM = ${target}/UpdatedFiles/rm
  16. set ECHO = ${target}/UpdatedFiles/echo
  17. set MKDIR = ${target}/UpdatedFiles/mkdir
  18. set MV = ${target}/UpdatedFiles/mv
  19. set LN = ${target}/UpdatedFiles/ln
  20. set LS = ${target}/UpdatedFiles/ls
  21. set CP = ${target}/UpdatedFiles/cp
  22. set GREP = ${target}/UpdatedFiles/grep
  23. set COMM = ${target}/UpdatedFiles/comm
  24. set ARCH = ${target}/UpdatedFiles/arch
  25. set AWK = ${target}/UpdatedFiles/awk
  26. set TOUCH = ${target}/UpdatedFiles/touch
  27. set SORT = ${target}/UpdatedFiles/sort
  28. set DATE = ${target}/UpdatedFiles/date
  29.  
  30. ${ECHO} Postprocessing $target for upgrade beginning at `${DATE}` ...
  31.  
  32. foreach language (French German Italian Swedish Spanish English Japanese)
  33.     ${RM} -rf ${target}/NextLibrary/Receipts/${language}.pkg
  34. end
  35.     
  36. set OBSOLETE_PACKAGES = (EpsonWingineDriver SCSITapeDriver EtherExpressDriver SerialPortDriver AutoHostAddPatch ATIDriver DBKitPrerelease EuroKeymaps IntelGXAudio Interceptor S3Driver Adaptec154xDriver Adaptec6x60SCSIDriver CogentEISADriver DOSFileSysPatch DiamondStealth64DisplayDriver EtherLinkIIIDriver HPVectra_XM_XP_LANDriver HPXPDisplayDriver IntelGXAudioDriver InterBaseAdaptor NetWareKernelPatch Number9GXE64ProDisplayDriver RestorePatch SendmailPatch TokenExpressDriver WeitekP9000Driver Adaptec6x60Driver IBMTokenRingDriver IndexingKitPatch SoftPCNetWarePatch pdump)
  37.  
  38. ${ECHO} "Removing old package receipts..."
  39. foreach i ( ${OBSOLETE_PACKAGES} )
  40.     ${RM} -rf ${target}/NextLibrary/Receipts/${i}.pkg
  41. end
  42.  
  43. if (-d ${target}/usr/Devices/System.config) then
  44.       ${ECHO} "Moving old drivers..."
  45.       ${MKDIR} ${target}/UpdatedFiles/usr
  46.       if (-d ${target}/private/tmp/oldDrivers) then
  47.           set oldDrivers=${target}/private/tmp/oldDrivers
  48.       else
  49.       set oldDrivers=${target}/usr/Devices
  50.       endif
  51.       ${MV} ${oldDrivers} ${target}/UpdatedFiles/usr/Devices
  52.       ${ECHO} "Installing drivers..."
  53.       set arch=`${ARCH}`
  54.       ${MKDIR} ${target}/private/Drivers
  55.       ${LN} -s Drivers/${arch} ${target}/private/Devices
  56.       ${LN} -s ../private/Devices ${target}/usr/Devices
  57.       
  58.       # copy non-standard drivers
  59.       cd ${target}/UpdatedFiles
  60.       ${LS} -d -1 ./usr/Devices/*.config | ${SORT} > ${target}/private/tmp/Driver$$
  61.       foreach i (`${COMM} -23 ${target}/private/tmp/Driver$$ ${target}/private/tmp/DriverList`)
  62.       if ( ! -d ${target}/${i} ) then
  63.             ${CP} -r $i ${target}/usr/Devices
  64.           endif
  65.       end
  66.       ${RM} -f ${target}/private/tmp/Driver$$ ${target}/private/tmp/DriverList
  67.  
  68.       # ensure that System.config and Default.table exist
  69.       if (! -d ${target}/private/Drivers/${arch}/System.config) then
  70.         ${MKDIR} ${target}/private/Drivers/${arch}
  71.     ${MKDIR} ${target}/private/Drivers/${arch}/System.config
  72.       endif
  73.       ${RM} -f ${target}/private/Drivers/${arch}/System.config/Default.table
  74.       ${CP} ${source}/private/Drivers/${arch}/System.config/Default.table ${target}/private/Drivers/${arch}/System.config
  75.  
  76.       ${ECHO} "Upgrading drivers..."
  77.       ${source}/Upgrader.app/DriverUpgrade ${target}/UpdatedFiles/usr/Devices ${target}/usr/Devices
  78.       foreach i ( ${target}/UpdatedFiles/usr/Devices/*.config )
  79.      ${MV} ${i} ${i}_Old
  80.       end
  81.       set oldcustom=${target}/UpdatedFiles/usr/Devices/System.config/CDIS.custom
  82.       set newcustom=${target}/private/adm/CDIS.custom
  83.       if (-f ${oldcustom}) then
  84.         if (! -f ${newcustom}) then
  85.                     ${CP} ${oldcustom} ${newcustom}
  86.                 endif
  87.                 ${RM} -f ${oldcustom}
  88.       endif
  89.       if (-f ${newcustom}) then
  90.         set LANGUAGE = `${AWK} -F'=' '/LANGUAGE/ {print $2}' ${newcustom}`
  91.                 
  92.         ${GREP} "Language" ${target}/usr/Devices/System.config/Default.table >> /dev/null
  93.         if ($status != 0 && "${LANGUAGE}" != "") then
  94.                     ${ECHO} '"Language" = "'${LANGUAGE}'";' >> ${target}/usr/Devices/System.config/Default.table
  95.                 endif
  96.     endif
  97. ${ECHO} "Driver upgrade complete."
  98. endif
  99.  
  100. # Delete empty nib, if it exists.
  101. ${RM} -rf /usr/lib/NextStep/loginwindow.app/English.lproj/login.nib
  102.  
  103. # copy thinned boms
  104. set nonomatch = 1
  105. cd ${target}/NextLibrary/Receipts
  106. set packages = ( *.pkg )
  107. foreach package ( ${packages} )
  108.     cd ${target}/NextLibrary/Receipts
  109.     if ( -d ${package} ) then
  110.         cd ${package}
  111.         set bom = *.bom
  112.         set newbom = ${target}/UpdatedBoms/${bom}
  113.         if ( -f ${newbom} ) then
  114.             ${ECHO} Upgrading ${package} bom
  115.             ${CP} ${newbom} ${target}/NextLibrary/Receipts/${package}
  116.         endif
  117.     endif
  118. end
  119. ${CP} ${target}/UpdatedBoms/BaseSystem.bom ${target}/usr/lib/NextStep
  120. ${TOUCH} ${target}/private/adm/BuildDisk.custom
  121.  
  122.  
  123. # execute local postprocessing script
  124. set localscript = ${source}/usr/local/Upgrade/PostProcess
  125. if ( -x ${localscript} ) then
  126.     ${localscript} ${target} ${source} || exit 1
  127. endif
  128.  
  129. ${ECHO} Postprocessing completed at `${DATE}`.
  130. ${ECHO} Upgrade completed. 
  131. ${ECHO} ""
  132.  
  133. exit 0
  134.