home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-User.iso / Upgrader.app / Default.upgrade / PreProcess < prev    next >
Text File  |  1997-03-11  |  3KB  |  84 lines

  1. #!/bin/csh -f
  2. #
  3. # Upgrader pre-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: PreProcess targroot sourceroot"
  10.     exit 1
  11. endif
  12.  
  13. set target = $argv[1]
  14. set source = $argv[2]
  15.  
  16. echo Preparing $target for upgrade at `date` ...
  17.  
  18. # execute local preprocessing script
  19. set localscript = ${source}/usr/local/Upgrade/PreProcess
  20. if ( -x ${localscript} ) then
  21.     ${localscript} ${target} ${source} || exit 1
  22. endif
  23.  
  24. # Pre-remove compressed languages to try and free up as much space as possible.
  25. foreach language (French German Italian Swedish Spanish English)
  26.    set statusfile = ${target}/NextLibrary/Receipts/${language}.pkg/${language}.status
  27.    if (-f $statusfile) then
  28.       if (`/bin/cat $statusfile` == "compressed") then
  29.         echo Removing files for ${language}, which was never used...
  30.         /bin/rm -rf ${target}/NextLibrary/Receipts/${language}.pkg
  31.       endif
  32.    endif
  33. end
  34.  
  35. # Grab list of drivers supplied with the system.
  36. /bin/rm -f ${target}/private/tmp/DriverList
  37. ${source}/usr/etc/lsbom -s ${target}/usr/lib/NextStep/BaseSystem.bom | egrep '\.config$' | sort > ${target}/private/tmp/DriverList
  38.  
  39. # Copy driver instances.
  40. set arch=`/usr/bin/arch`
  41. set oldDrivers=${target}/private/tmp/oldDrivers
  42. if (-d ${target}/private/Drivers/${arch}) then
  43.     /bin/rm -rf ${oldDrivers}
  44.     /bin/mkdir ${oldDrivers}
  45.     set olddir=`/bin/pwd`
  46.     cd ${target}/private/Drivers/${arch}
  47.     /usr/bin/find . \( -name \*.table -o -name \*.strings -o -name \*.modes -o -name \*.custom \) -print | /usr/bin/cpio -pd ${oldDrivers}
  48.     cd ${olddir}
  49. endif
  50.  
  51. # Remove boms if left over from previous upgrade attempt
  52. /bin/rm -rf ${target}/UpdatedBoms.old
  53. if (-d ${target}/UpdatedBoms) then
  54.     /bin/mv ${target}/UpdatedBoms ${target}/UpdatedBoms.old
  55. endif
  56.  
  57. # Move old updated files out of the way
  58. /bin/rm -rf ${target}/UpdatedFiles.old
  59. if (-d ${target}/UpdatedFiles) then
  60.     /bin/mv ${target}/UpdatedFiles ${target}/UpdatedFiles.old
  61. endif
  62.  
  63. # Copy old binaries to use in the post process
  64. /bin/mkdirs ${target}/UpdatedFiles
  65. /bin/cp -p /bin/rm ${target}/UpdatedFiles/rm
  66. /bin/cp -p /bin/echo ${target}/UpdatedFiles/echo
  67. /bin/cp -p /bin/mkdir ${target}/UpdatedFiles/mkdir
  68. /bin/cp -p /bin/mv ${target}/UpdatedFiles/mv
  69. /bin/cp -p /bin/ln ${target}/UpdatedFiles/ln
  70. /bin/cp -p /bin/ls ${target}/UpdatedFiles/ls
  71. /bin/cp -p /bin/cp ${target}/UpdatedFiles/cp
  72. /bin/cp -p /bin/grep ${target}/UpdatedFiles/grep
  73. /bin/cp -p /usr/bin/comm ${target}/UpdatedFiles/comm
  74. /bin/cp -p /usr/bin/arch ${target}/UpdatedFiles/arch
  75. /bin/cp -p /bin/awk ${target}/UpdatedFiles/awk
  76. /bin/cp -p /usr/bin/touch ${target}/UpdatedFiles/touch
  77. /bin/cp -p /bin/csh /tmp/csh
  78. /bin/cp -p /usr/bin/sort ${target}/UpdatedFiles/sort
  79. /bin/cp -p /bin/date ${target}/UpdatedFiles/date
  80.  
  81. echo Upgrade preparation completed at `date`.
  82. echo ""
  83. exit 0
  84.