home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3.4.17 [SPARC, PA-RISC] / nextstep33_risc.iso / Upgrader.app / Default.upgrade / PostProcess < prev    next >
Encoding:
Text File  |  1994-10-26  |  9.1 KB  |  235 lines

  1. #!/bin/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.  
  16. echo Postprocessing $target for upgrade beginning at `date` ...
  17.  
  18. cd ${target}/etc/netinfo
  19. set databases = `ls ${target}/etc/netinfo`
  20.  
  21. foreach database ($databases)
  22.  
  23.     echo "Updating NetInfo database ${database}:"
  24.     set tag = `basename ${database} .nidb`
  25.     if ($tag == $database) then
  26.     echo "    ...but it's not a database.  Skipping."
  27.     continue
  28.     endif
  29.     if (${target}x != "/x") then
  30.     mv ${tag}.nidb XXXX.nidb
  31.     (/usr/etc/netinfod XXXX &) > /dev/null
  32.     set usetag = XXXX
  33.     else 
  34.     set usetag = $tag
  35.     endif
  36.     
  37.     # If root directory isn't writable, we probably aren't the master.
  38.     
  39.     niutil -createprop -t localhost/${usetag} / _thing _thing >& /dev/null
  40.     if ($status != 0) then
  41.         echo "    ...but this isn't the master server for it.  Skipping."
  42.     goto killdomain
  43.     else
  44.         niutil -destroyprop -t localhost/${usetag} / _thing
  45.     endif
  46.  
  47.     echo -n "    Updating user accounts..."
  48.     set nacct = `niutil -list -t localhost/${usetag} /users | awk '{print $2}' | ${source}/Upgrader.app/Default.upgrade/FixUsers ${usetag}`
  49.     echo "$nacct accounts"
  50.     
  51.     echo "    Creating /locations/renderers..."
  52.     niutil -list -t localhost/${usetag} /locations/renderers >& /dev/null
  53.     if ($status != 0) then
  54.     niutil -create -t localhost/${usetag} /locations/renderers >& /dev/null
  55.     niutil -createprop -t localhost/${usetag} /locations/renderers _writers '*' >& /dev/null
  56.     niutil -create -t localhost/${usetag} /locations/renderers/localhost >& /dev/null
  57.     niutil -createprop -t localhost/${usetag} /locations/renderers/localhost _writers '*' >& /dev/null
  58.     niutil -createprop -t localhost/${usetag} /locations/renderers/localhost note "Local Renderer" >& /dev/null
  59.     endif
  60.  
  61.     echo "    Updating /rpcs..."
  62.     niutil -list -t localhost/${usetag} /rpcs/renderd >& /dev/null
  63.     if ($status != 0) then
  64.     niutil -create -t localhost/${usetag} /rpcs/renderd >& /dev/null
  65.     niutil -createprop -t localhost/${usetag} /rpcs/renderd number 200100002 >& /dev/null
  66.     niutil -destroyprop -t localhost/${usetag} /rpcs/rexd number >& /dev/null
  67.     niutil -destroy -t localhost/${usetag} /rpcs/rexd >& /dev/null
  68.     endif
  69.     
  70.     echo "    Removing decode alias..."
  71.     niutil -destroyprop -t localhost/${usetag} /aliases/decode members >& /dev/null
  72.     niutil -destroy -t localhost/${usetag} /aliases/decode >& /dev/null
  73.  
  74.     if ($tag == "local") then
  75.     echo "    Creating /localconfig..."
  76.     niutil -list -t localhost/${usetag} /localconfig >& /dev/null
  77.     if ($status != 0) then
  78.         niutil -create -t localhost/${usetag} /localconfig
  79.     endif
  80.     # Make sure old language and keyboard dirs aren't around.
  81.     niutil -destroy -t localhost/${usetag} /localconfig/language >& /dev/null
  82.     niutil -destroy -t localhost/${usetag} /localconfig/keyboard >& /dev/null
  83.     niutil -list -t localhost/${usetag} /screens >& /dev/null
  84.     if ($status == 0) then
  85.         set screens = `niutil -list -t localhost/${usetag} /screens | awk '{print $2}'`
  86.         foreach screen ($screens) 
  87.         foreach prop (slot unit bounds active) 
  88.             set value = `niutil -read . /screens/$screen | grep $prop | awk -F: '{print $2}'`
  89.             niutil -destroyprop -t localhost/${usetag} /screens/$screen $prop
  90.         end
  91.         niutil -destroyprop -t localhost/${usetag} /screens/$screen _writers >& /dev/null
  92.         niutil -destroy -t localhost/${usetag} /screens/$screen
  93.         end 
  94.         niutil -destroy -t localhost/${usetag} /screens
  95.     endif
  96.     if (-f ${target}/private/etc/exports && ! -f ${target}/private/etc/exports.old) then
  97.         echo "    Converting /etc/exports to NetInfo..."
  98.         ${source}/Upgrader.app/loadexports -t exports localhost/${usetag} < ${target}/private/etc/exports
  99.         mv ${target}/private/etc/exports ${target}/private/etc/exports.old
  100. cat > ${target}/private/etc/exports << XXX
  101. # THIS FILE IS OBSOLETE.  NFS exports are now stored in NetInfo.
  102. #
  103. # To export disks, use the NFSManager application located in /NextAdmin. 
  104. # You can also niload an old-format exports file, or add the entries
  105. # to the /exports directory of your local NetInfo domain by hand.
  106. #
  107. # Your old /etc/exports has been saved in /etc/exports.old.
  108. XXX
  109.     endif
  110.     endif
  111.     
  112.     killdomain:
  113.     
  114.     if (${target}x != "/x") then
  115.     set pid = `ps ax | grep "netinfod XXXX" | grep -v grep | awk '{print $1}'`
  116.     kill -TERM $pid
  117.     mv XXXX.nidb ${tag}.nidb
  118.     endif
  119.     
  120. end
  121.  
  122. echo -n "NetInfo changes complete. "
  123.  
  124. foreach language (French German Italian Swedish Spanish English Japanese)
  125.     /bin/rm -rf ${target}/NextLibrary/Receipts/${language}.pkg
  126. end
  127.     
  128. 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)
  129.  
  130. echo "Removing old package receipts..."
  131. foreach i ( ${OBSOLETE_PACKAGES} )
  132.     rm -rf ${target}/NextLibrary/Receipts/${i}.pkg
  133. end
  134.  
  135. if (-d ${target}/usr/Devices/System.config) then
  136.       echo "Moving old drivers..."
  137.       mkdirs ${target}/UpdatedFiles/usr
  138.       if (-d ${target}/private/tmp/oldDrivers) then
  139.           set oldDrivers=${target}/private/tmp/oldDrivers
  140.       else
  141.       set oldDrivers=${target}/usr/Devices
  142.       endif
  143.       mv ${oldDrivers} ${target}/UpdatedFiles/usr/Devices
  144.       echo "Installing drivers..."
  145.       set arch=`/usr/bin/arch`
  146.       mkdirs ${target}/private/Drivers
  147.       ln -s Drivers/${arch} ${target}/private/Devices
  148.       ln -s ../private/Devices ${target}/usr/Devices
  149.       
  150.       # copy non-standard drivers
  151.       cd ${target}/UpdatedFiles
  152.       ls -d -1 ./usr/Devices/*.config | sort > ${target}/private/tmp/Driver$$
  153.       foreach i (`comm -23 ${target}/private/tmp/Driver$$ ${target}/private/tmp/DriverList`)
  154.       if ( ! -d ${target}/${i} ) then
  155.             cp -r $i ${target}/usr/Devices
  156.           endif
  157.       end
  158.       rm -f ${target}/private/tmp/Driver$$ ${target}/private/tmp/DriverList
  159.  
  160.       # ensure that System.config and Default.table exist
  161.       if (! -d ${target}/private/Drivers/${arch}/System.config) then
  162.         mkdirs ${target}/private/Drivers/${arch}/System.config
  163.       endif
  164.       rm -f ${target}/private/Drivers/${arch}/System.config/Default.table
  165.       cp ${source}/private/Drivers/${arch}/System.config/Default.table ${target}/private/Drivers/${arch}/System.config
  166.  
  167.       echo "Upgrading drivers..."
  168.       ${source}/Upgrader.app/DriverUpgrade ${target}/UpdatedFiles/usr/Devices ${target}/usr/Devices
  169.       foreach i ( ${target}/UpdatedFiles/usr/Devices/*.config )
  170.      mv ${i} ${i}_Old
  171.       end
  172.       set oldcustom=${target}/UpdatedFiles/usr/Devices/System.config/CDIS.custom
  173.       set newcustom=${target}/private/adm/CDIS.custom
  174.       if (-f ${oldcustom}) then
  175.         if (! -f ${newcustom}) then
  176.                     cp ${oldcustom} ${newcustom}
  177.                 endif
  178.                 /bin/rm -f ${oldcustom}
  179.       endif
  180.       if (-f ${newcustom}) then
  181.         set LANGUAGE = `awk -F'=' '/LANGUAGE/ {print $2}' ${newcustom}`
  182.                 
  183.         grep "Language" ${target}/usr/Devices/System.config/Default.table >> /dev/null
  184.         if ($status != 0 && "${LANGUAGE}" != "") then
  185.                     echo '"Language" = "'${LANGUAGE}'";' >> ${target}/usr/Devices/System.config/Default.table
  186.                 endif
  187.     endif
  188. echo "Driver upgrade complete."
  189. endif
  190.  
  191. # Delete empty nib, if it exists.
  192. rm -rf /usr/lib/NextStep/loginwindow.app/English.lproj/login.nib
  193.  
  194. # Do Kanji processing, if necessary.
  195. if (-f ${source}/NextLibrary/Fonts/Kanji/.fpexData) then
  196.     /bin/cp ${source}/NextLibrary/Fonts/Kanji/.fpexData ${target}/NextLibrary/Fonts/Kanji
  197.     if (-f ${source}/NextLibrary/Fonts/Kanji/FS/FSInit) then
  198.         /bin/cp ${source}/NextLibrary/Fonts/Kanji/FS/FSInit ${target}/NextLibrary/Fonts/Kanji/FS/FSInit
  199.     endif
  200.     /usr/bin/dwrite GLOBAL NXSystemFonts "GothicBBBHelvetica;Helvetica"
  201.     /usr/bin/dwrite GLOBAL NXBoldSystemFonts "GothicBBBHelvetica-Bold;Helvetica-Bold"
  202. endif
  203.  
  204. # copy thinned boms
  205. set nonomatch = 1
  206. cd ${target}/NextLibrary/Receipts
  207. set packages = ( *.pkg )
  208. foreach package ( ${packages} )
  209.     cd ${target}/NextLibrary/Receipts
  210.     if ( -d ${package} ) then
  211.         cd ${package}
  212.         set bom = *.bom
  213.         set newbom = ${target}/UpdatedBoms/${bom}
  214.         if ( -f ${newbom} ) then
  215.             echo Upgrading ${package} bom
  216.             /bin/cp ${newbom} ${target}/NextLibrary/Receipts/${package}
  217.         endif
  218.     endif
  219. end
  220. /bin/cp ${target}/UpdatedBoms/BaseSystem.bom ${target}/usr/lib/NextStep
  221. /usr/bin/touch ${target}/private/adm/BuildDisk.custom
  222.  
  223.  
  224. # execute local postprocessing script
  225. set localscript = ${source}/usr/local/Upgrade/PostProcess
  226. if ( -x ${localscript} ) then
  227.     ${localscript} ${target} ${source} || exit 1
  228. endif
  229.  
  230. echo Postprocessing completed at `date`.
  231. echo Upgrade completed. 
  232. echo ""
  233.  
  234. exit 0
  235.