home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / private / etc / rc.cdrom < prev    next >
Encoding:
Text File  |  1992-07-24  |  15.7 KB  |  421 lines

  1. #!/bin/sh -u
  2. #
  3. # CD-ROM Software Installation Procedure
  4. #
  5. # Copyright (C) 1992 by NeXT Computer, Inc.  All rights reserved.
  6. #
  7. # This script is invoked automatically when booted from a CD-ROM.
  8. # Trying to run it directly will probably not do what you expect.
  9.  
  10. HOME=/; export HOME
  11. PATH=/etc:/usr/etc:/bin:/usr/bin:/usr/ucb; export PATH
  12.  
  13. (
  14. # Exit with status 1 if we get a SIGINT (from, e.g., a ^C being typed).
  15. trap "exit 1" 2
  16.  
  17. # Check to be sure we're running from a CD-ROM
  18.  
  19. if [ ! -d /NextCD ]; then 
  20.     echo
  21.     echo "This script is used to install the system software onto a hard"
  22.     echo "disk while booted from a CD-ROM.  Since you aren't running from"
  23.     echo "a CD-ROM, don't run this script."
  24.     echo
  25.     exit 1
  26. fi
  27.  
  28. echo
  29. D8g "NeXTSTEP Release 3 Installation"
  30. echo
  31. echo "This procedure installs the Release 3 essentials onto your hard"
  32. echo "disk.  If you just want to use the CD-ROM as a startup device, use"
  33. echo "the -s flag from the console to start up in single-user mode."
  34. echo
  35. echo "If you would like to install documentation or other system extensions,"
  36. echo "use the packages in /NextCD/Packages once this procedure is complete."
  37. echo
  38. echo "You can cancel this procedure by typing Control-c.  If you continue,"
  39. echo "there are a few more questions to answer before any changes are made."
  40. echo
  41. echo "La procedure suivante va installer la version 3 sur votre disque. Nous"
  42. echo "attirons votre attention sur le fait qu'il s'agit bien d'une"
  43. echo "installation complete et non d'une mise a jour. Si vous desirez"
  44. echo "proceder a l'installation de cette version, actionnez la touche 'y'"
  45. echo "(oui), ou 'n' (non) dans le cas contraire, et appuyez sur Return."
  46. echo ""
  47. echo "Diese Prozedur installiert Version 3 auf Ihrer Platte. Es handelt sich"
  48. echo "nicht um einen Upgrade, sondern um eine vollig neue Installation."
  49. echo "Mochten Sie diese Prozedur ausfuhren? Drucken Sie 'y' fur "Ja" oder"
  50. echo "'n' fur "Nein" und anschliessen die Return-Taste."
  51. echo
  52. echo "Questa procedura installa la Versione 3 su disco. Non si tratta di un"
  53. echo "aggiornamento, ma di un'installazione completa. E questa l'operazione"
  54. echo "che vuoi eseguire? Premi 'y' per si e 'n' per no, quindi premi Invio."
  55. echo
  56. echo "Este procedimiento instala la version actualizada 3 en el disco. Es"
  57. echo "una instalacion en si, no una actualizacion. Es esto lo que desea"
  58. echo "hacer? Pulse 'y' para si o 'n' para no y, a continuacion, Intro."
  59. echo
  60. echo "Denna procedur installerar Version 3 pa din disk. Detta ar inte en"
  61. echo "uppgradering utan en helt ny installation.  Vill du utfora denna"
  62. echo "installation?  Tryck pa 'y' for ja eller 'n' for nej och tryck"
  63. echo "darefter pa Retur."
  64. echo 
  65. echo "THIS IS NOT AN UPGRADE.  IT IS A COMPLETE INSTALLATION FROM SCRATCH."
  66. echo
  67. fbshow -S -B -E -I "This procedure will  install*Release 3 on your disk.*Is that what you want?**Press \`y' or \`n', then Return." 
  68. resp=
  69. while [ ${resp}x = x ]; do
  70.     echo -n "Is this what you want? (y/n): "
  71.     read resp
  72.     if [ ${resp}x != yx -a ${resp}x != nx ]; then
  73.     resp=
  74.     fi
  75. done
  76. if [ ${resp}x != yx ]; thenD8h echo
  77.     echo -n "Ok, shutting down..."
  78.     fbshow -S -B -E -I "Shutting down..." 
  79.     halt -e
  80.     exit 1
  81. fi
  82.  
  83. fbshow -S -B -E -I "On which disk should the*software be installed? The*default is \`sd0a'.**Type name, press Return." 
  84. echo
  85. echo "Sur quel disque desirez vous installer la version? Le disque selectionne par defaut est sd0a."
  86. echo "Auf welcher Platte soll die Software installiert werden? Die Voreinstellung ist sd0a."
  87. echo "Su quale disco deve essere installato il software? Quello predefinito e sd0a."
  88. echo "En que disco deberia instalarse el software? El valor por defecto es sd0a."
  89. echo "Pa vilken disk ska mjukvaran installeras? Forinstallningen ar sd0a."
  90. echo
  91. diskie=
  92. while [ ${diskie}x = x ]; do
  93.     echo -n "On which disk should the software be installed? (default = sd0a): "
  94.     read diskie
  95.     if [ ${diskie}x = x ]; then
  96.     diskie=sd0a
  97.     fi
  98.     if [ ! -b /dev/${diskie} ]; then
  99.     echo "That doesn't seem to be a valid disk; the file /dev/${diskie} doesn't exist."
  100.     diskie=
  101.     fi
  102. done
  103.  
  104. echo
  105. echo "If you are already running Release 3.0, you don't need to erase your"
  106. echo "disk before re-installing the software (however, the directory /private"
  107. echo "WILL BE DELETED whether you erase the disk or not.)"
  108. echo
  109. echo "Voulez-vous initialiser (tout effacer) le disque avant de proceder a l'installation du logiciel?"
  110. echo "Mochten Sie die Platte formatieren (loschen), bevor Sie die Software installieren?"
  111. echo "Vuoi inizializzare (cancellare) il disco prima di installare il software?"
  112. echo "Desea inicializar (borrar) el disco antes de instalar el software?"
  113. echo "Vill du formatera (radera) disken innan du installerar mjukvaran?"
  114. echo
  115. fbshow -S -B -E -I "Do you want to initialize*(erase) the disk before*installing the software?**Press\`y' or \`n', then Return." 
  116. doinit=
  117. while [ ${doinit}x = x ]; do
  118.     echo -n "Initialize (erase) disk before installing software? (y/n): "
  119.     read doinit
  120.     if [ ${doinit}x != yx -a ${doinit}x != nx ]; then
  121.     doinit=
  122.     fi
  123. done
  124.  
  125. echo
  126. echo "Ready to perform the installation."
  127. echo "Pret pour l'installation. Desirez-vous lancer l'operation?"
  128. echo "Die Installation kann jetzt durchgefuhrt werden. Wirklich durchfuhren?"
  129. echo "Sono pronto a iniziare l'installazione. Vuoi veramente continuare?"
  130. echo "Preparado para la instalacion. Realmente desea hacerlo?"
  131. echo "Klart att installera mjD8iran.  Vill du gora detta?"
  132. echo
  133. fbshow -S -B -E -I "Ready to install the system*software. Really do it?**Press \`y' or \`n', then Return." 
  134. resp=
  135. while [ ${resp}x = x ]; do
  136.     echo -n "Really do it? (y/n): "
  137.     read resp
  138.     if [ ${resp}x != yx -a ${resp}x != nx ]; then
  139.     resp=
  140.     fi
  141. done
  142.  
  143. if [ ${resp}x != yx ]; then
  144.     echo
  145.     echo -n "Ok, shutting down..."
  146.     fbshow -S -B -E -I "Shutting down..." 
  147.     halt -e
  148.     exit 1
  149. fi
  150.  
  151. # If not re-initializing hard disk, remove /private from it.
  152.  
  153. if [ ${doinit}x = nx ]; then  
  154.  
  155.     echo
  156.     echo "Mounting hard disk..."
  157.     fbshow -S -B -E -I "Mounting hard disk..."
  158.     # We mount -n and avoid writing /etc/mtab because the root
  159.     # device is read-only (it's a CD-ROM...).
  160.     /etc/mount -n /dev/${diskie} /private/tmp
  161.     
  162.     # Mounted OK?  Report if not.
  163.     
  164.     if [ $? -ne 0 ]; then 
  165.     echo 
  166.     echo "The hard disk is damaged, and the software can't be installed"
  167.     echo "without initializing.  Do you want to continue?"
  168.     echo
  169.     echo "Le disque dur est endommage et doit etre initialise. Voulez-vous poursuivre l'operation?"
  170.     echo "Die Festplatte ist beschadigt und muss formatiert werden. Trotzdem fortsetzen?"
  171.     echo "Il disco fisso e danneggiato e deve essere inizializzato. Vuoi continuare comunque?"
  172.     echo "El disco duro esta danado y debe ser inicializado. Continuar de todas formas?"
  173.     echo "Harddisken ar skadad och maste formateras.  Vill du fortsatta anda?"
  174.     echo
  175.     echo -n "Initialize the hard disk? (y/n): "
  176.     fbshow -S -B -E -I -s 5 -f Helvetica-BoldOblique \
  177.         "Hard disk is damaged!" -f Helvetica \
  178.         "Can't continue without*initializing hard disk.*Ok to initialize it?*Press \`y' or \`n', then Return."
  179.     read resp
  180.  
  181.     if [ ${resp}x = yx ]; then
  182.         doinit=y
  183.     else
  184.         (echo) > /dev/console
  185.         (echo "Load of hard disk aborted; halting...") > /dev/console
  186.         fbshow -S -B -E -I "Load aborted, halting..."
  187.         halt -e
  188.         exit 1
  189.     fi
  190.     else
  191.     if [ -f /private/tmp/usr/lib/NextStep/software_version ]; then
  192.         sourcevers=`head -1 /private/tmp/usr/lib/NextStep/software_version`
  193.     else
  194.         sourcevers="2.0"
  195.     fi
  196.     if [ "${sourcevers}x" = "3.0x" ]; then
  197.         (echo "Removing /private...") > /dev/console
  198.         fbshow -S -B -E -I "Removing /private..."
  199.         /bin/rm -rf /private/tmp/private
  200.     else
  201.         echo
  202.         echo "The disk you've selected does not contain Release 3.0.  YoD8pn only install the"
  203.         echo "software without erasing the disk when Release 3.0 has been previously installed."
  204.         echo
  205.         echo "Le disque selectionne ne contient pas la version 3.0. Si vous desirez installer"
  206.         echo "le logiciel sans risquer de perdre toutes les donnees sur le disque, vous devez"
  207.         echo "d'abord installer la version 3.0."
  208.         echo
  209.         echo "Die ausgewahlte Platte enthalt nicht Release 3.0. Sie konnen die Software nur"
  210.         echo "installieren, wenn Release 3.0 bereits vorher installiert wurde. Ansonsten wird"
  211.         echo "die Platte  dabei geloscht."
  212.         echo
  213.         echo "Il disco selezionato non contiene la Versione 3.0. Puoi installare il software"
  214.         echo "senza cancellare il contenuto del disco quando la Versione 3.0 e stata installata"
  215.         echo "precedentemente."
  216.         echo
  217.         echo "El disco que ha seleccionado no contiene la version actualizada 3.0. Solamente se"
  218.         echo "puede instalar el software sin borrar el disco cuando se haya instalado previamente"
  219.         echo "la version actualizada 3.0."
  220.         echo
  221.         echo "Den disk du har valt innehaller inte version 3.0.  Du kan bara installera programvaran"
  222.         echo "utan att radera disken om version 3.0 har installerats tidigare."
  223.         echo
  224.         echo -n "Press Return to shut down: "
  225.         read glop
  226.         sync
  227.         halt
  228.         exit 1
  229.     fi
  230.     fi
  231. fi
  232.  
  233. (echo) > /dev/console
  234.  
  235. rootsize=0
  236.  
  237. # scsimodes -C tells you how big a disk is, in megabytes
  238. disksize=`/usr/etc/scsimodes -C /dev/r${diskie}`
  239. # readlabel -n tells you how many partitions are on a disk, default = 1
  240. numpart=`/NextCD/CDIS/readlabel -n /dev/r${diskie}`
  241.  
  242. if [ $? -ne 0 ]; then
  243.     numpart=1
  244. else 
  245.     rootsize=`/NextCD/CDIS/readlabel -p /dev/r${diskie}`
  246.     # Default to 1 partition if can't determine size of A partition.
  247.     if [ $? -ne 0 ]
  248.     then 
  249.     numpart=1
  250.     (echo "Cannot read root partition size from label...") > /dev/console
  251.     (echo "Treating disk as a single partition.") > /dev/console
  252.     fi
  253. fi
  254.  
  255. # If we're re-initializing the disk, take care of partitioning.
  256.  
  257. if [ ${doinit}x = yx ]; then
  258.     if [ $disksize -gt 500 -a $numpart -eq 2 -a $rootsize -ne 0 ]; then 
  259.     (( 
  260.         echo "Your disk was previously built with two partitions.  Unless"
  261.         echo "this computer supports NetBoot clients, it's probably better"
  262.         echo "to have only one partition. You can choose to rebuD8qthe"
  263.         echo "disk in its current configuration, or to rebuild it with a"
  264.         echo "single partition."
  265.         echo 
  266.         echo "Votre disque est divise en deux partitions. Desirez-vous creer une seule partition?"
  267.         echo "Ihre Platte hat zwei Partitionen. Mochten Sie sie in eine Partition umwandeln?"
  268.         echo "Il tuo disco ha due partizioni; vuoi unificarle?"
  269.         echo "El disco tiene dos particiones. Crear solo una?"
  270.         echo "Din disk har tva partitioner.  Vill du konvertera dessa till en partition?"
  271.         echo
  272.         echo -n "Initialize the disk with one partition? (y/n): "
  273.         fbshow -S -B -E -I "Your disk now has two*partitions. One is preferred.**Build it with one partition?*Press \`y' or \`n', then Return."
  274.         read resp
  275.         echo
  276.         if [ ${resp}x = nx ]; then
  277.         exit 1
  278.         else
  279.         exit 0
  280.         fi
  281.     ) < /dev/console > /dev/console 2>&1 )
  282.     
  283.     if [ $? -eq 0 ]; then 
  284.         numpart=1; 
  285.     fi
  286.     else
  287.     # Support only one partition if disk is 500MB or less.
  288.         numpart=1
  289.     fi
  290.     
  291.     (echo "Initializing hard disk...") > /dev/console
  292.     fbshow -S -B -E -I "Initializing hard disk..."
  293.  
  294.     # Get off the disk before we initialize it!
  295.     cd /NextCD
  296.     
  297.     if [ $numpart -eq 2 ]; then
  298.     (/usr/etc/disk -i -p $rootsize /dev/r${diskie}) > /dev/console 2>&1
  299.     else 
  300.     (/usr/etc/disk -i /dev/r${diskie}) > /dev/console 2>&1
  301.     fi
  302.     
  303.     if [ $? -ne 0 ]; then
  304.     (
  305.         (
  306.         fbshow -S -B -E -s 4 -I -f Helvetica-BoldOblique \
  307.             "Installation failed!" -f Helvetica \
  308.             "*Couldn't initialize disk.*Press Return to halt."
  309.         echo ""
  310.         echo "INSTALLATION FAILED - COULD NOT INTIALIZE DISK"
  311.         echo "L'INSTALLATION A ECHOUE - L'INITIALISATION DU DISQUE N'A PAS ABOUTI"
  312.         echo "INSTALLATION FEHLGESCHLAGEN - PLATTE KONNTE NICHT FORMATIERT WERDEN"
  313.         echo "INSTALLAZIONE NON RIUSCITA - NON SONO RIUSCITO A INIZIALIZZARE IL DISCO"
  314.         echo "LA INSTALACION HA FALLADO - IMPOSIBLE INICIALIZAR EL DISCO"
  315.         echo "INSTALLATIONEN MISSLYCKADES - DISKEN KUNDE INTE FORMATERAS"
  316.         echo
  317.         echo -n "Press Return to shut down: "
  318.         read glop
  319.         sync
  320.         halt -p
  321.         exit 1
  322.         ) < /dev/console > /dev/console 2>&1)
  323.     fi
  324.     
  325.     mount -n /dev/${diskie} /private/tmp
  326.     echo
  327. fi
  328.     
  329. (echo "Installing software...") >/dev/console
  330. fbshow -S -B -E -I "Installing software..."
  331.  
  332. # First, write the boot block.
  333. disk -b /dev/r${diskie} > /dev/null &>/dev/consoleD8rNext, install the files.  
  334.  
  335. cd /private/tmp
  336. (/NextCD/CDIS/bomcopy /usr/lib/NextStep/BaseSystem.bom / /private/tmp \
  337.     > /dev/console 2>&1)
  338.  
  339. if [ $? -ne 0 ]; then
  340.     (
  341.     (
  342.         fbshow -S -B -E -s 4 -I -f Helvetica-BoldOblique \
  343.         "Installation failed!" -f Helvetica \
  344.         "*Not enough disk space.*Press Return to halt."
  345.         echo ""
  346.         echo "INSTALLATION FAILED - PERHAPS NOT ENOUGH DISK SPACE"
  347.         echo "L'INSTALLATION A ECHOUE - L'ESPACE DISQUE EST PEUT-ETRE INSUFFISANT"
  348.         echo "INSTALLATION FEHLGESCHLAGEN - EVENTUELL NICHT GENUG PLATTENSPEICHER"
  349.         echo "INSTALLAZIONE NON RIUSCITA - FORSE LO SPAZIO SU DISCO E INSUFFICIENTE"
  350.         echo "LA INSTALACION HA FALLADO - PUEDE QUE NO HAYA ESPACIO SUFICIENTE EN EL DISCO"
  351.         echo "INSTALLATIONEN MISSLYCKADES - DISKUTRYMMET KANSKE AR OTILLRACKLIGT"
  352.         echo " "
  353.         echo "You will have to REPEAT the installation procedure.  You can"
  354.         echo "either boot single user and remove some files from the hard"
  355.         echo "disk first, or ask that the disk be initialized before the"
  356.         echo "software is installed."
  357.         echo " "
  358.         echo -n "Press Return to shut down: "
  359.         read glop
  360.         sync
  361.         halt -p
  362.         exit 1
  363.     ) < /dev/console > /dev/console 2>&1)
  364. fi
  365.  
  366. # If the disk was partitioned, patch over fstab to include /clients
  367.  
  368. if [ $numpart -eq 2 ]; then
  369.     (echo "Installing two-partition /etc/fstab...") >/dev/console
  370.     fbshow -S -B -E -I "Installing /etc/fstab file..."
  371.     cp -p /private/etc/fstab.sd660 /private/tmp/private/etc/fstab
  372. fi
  373.  
  374. if [ -d /Upgrade_3.0.app/Default.upgrade/Languages ]; then
  375.     (echo "Checking sizes for languages...") > /dev/console
  376.     freekbytes=`/NextCD/CDIS/freespace /dev/r${diskie}`
  377.     langkbytes=`du -s /Upgrade_3.0.app/Default.upgrade/Languages | awk '{print $1}'`
  378.     (echo "Languages require ${langkbytes}K, and ${freekbytes}K are available.") > /dev/console
  379.     if [ $freekbytes -gt `expr $langkbytes + 1000` ]; then
  380.         (echo "Installing languages...") > /dev/console
  381.     mkdirs /private/tmp/NextLibrary/Receipts
  382.     cd /Upgrade_3.0.app/Default.upgrade/Languages
  383.     tar cf - *.pkg | (cd /private/tmp/NextLibrary/Receipts; tar xfp -)
  384.     else
  385.         (echo "There isn't enough space to install all the languages.") > /dev/console
  386.     (echo "Checking sizes for English help...") > /dev/console
  387.     langkbytes=`du -s /Upgrade_3.0.app/Default.upgrade/LanguagesD8slish.pkg | awk '{print $1}'`
  388.     (echo "English help requires ${langkbytes}K, and ${freekbytes}K are available.") > /dev/console
  389.     if [ $freekbytes -gt `expr $langkbytes + 1000` ]; then
  390.         (echo "Installing English help...") > /dev/console
  391.         mkdirs /private/tmp/NextLibrary/Receipts
  392.         cd /Upgrade_3.0.app/Default.upgrade/Languages
  393.         tar cf - English.pkg | (cd /private/tmp/NextLibrary/Receipts; tar xfp -)
  394.     else
  395.         (echo "There isn't enough space to install English help.") > /dev/console
  396.     fi
  397.     fi
  398. fi
  399.  
  400. ((
  401.     fbshow -S -B -E -s 3 -I -f Helvetica-BoldOblique \
  402.         "Installation complete!" -f Helvetica \
  403.         "*Press Return to restart."
  404.     echo ""
  405.     echo "INSTALLATION COMPLETE!"
  406.     echo
  407.     echo "INSTALLATION TERMINEE! Appuyez sur Return pour relancer le systeme.   "
  408.     echo "INSTALLATION FERTIG! Drucken Sie die Return-Taste, um neu zu starten."
  409.     echo "INSTALLAZIONE COMPLETA! Premi Invio per riavviare."
  410.     echo "INSTALACION TERMINADA! Pulse Intro para arrancar."
  411.     echo "INSTALLATIONEN KLAR!  Tryck pa Retur for att starta om."
  412.     echo
  413.     echo -n "Press Return to restart from the hard disk: "
  414.     read glop
  415.     sync ; reboot sd
  416.     exit 1
  417. ) < /dev/console > /dev/console 2>&1)
  418. ) < /dev/console > /dev/console 2>&1
  419. exit 0
  420.  
  421.