home *** CD-ROM | disk | FTP | other *** search
/ Caldera Network Desktop 1.0 / caldera-network-desktop-1.0.bin / images / ramdisk2-beta.img / usr / lib / perl / bootstrap < prev    next >
Text File  |  1995-12-04  |  3KB  |  131 lines

  1. ## -*-perl-*-
  2.  
  3. # install the bootstrap system
  4.  
  5. # Path from $rhspath to the bootstrap tar file
  6. $fsstnd_cpio = "RedHat/base/fsstnd.cgz";
  7. $skel_cpio = "RedHat/base/skeleton.cgz";
  8.  
  9. $bootstrap_file_count = 143;
  10.  
  11. sub install_bootstrap {
  12.  
  13.     local ( $ret, $tmp );
  14.  
  15.     if (! $fs_mounted) {
  16.     &rhs_msgbox("Error",
  17. <<EOM
  18. >
  19. Your installation filesystem must be mounted
  20. before you can initialize it.
  21. >
  22. EOM
  23.             , 60);
  24.     return 0;
  25.     }
  26.  
  27.     # cd to the installation filesystem
  28.     chdir($fsmount);
  29.  
  30.     &rhs_infobox("Filesystem Initialization",
  31. <<EOM
  32. >
  33. Setting up initial filesystem structure.
  34. >
  35. EOM
  36.          , 70);
  37.  
  38.     if ($installsource eq "ftp") {
  39.     if (! $ftp_configured) {
  40.         $ret = 1;
  41.         &rhs_msgbox("FTP Failed",
  42. <<EOM
  43. >
  44. FTP is not configured.  You will have to configure it before
  45. continuing.
  46. EOM
  47.             , 60);
  48.     } else {
  49.         if (&get_ftp_file($fsstnd_cpio, "fsstnd.cpio.gz")) {
  50.         open(SAVEERR, ">&STDERR");
  51.         open(STDERR, ">/dev/tty3");
  52.         $ret = &invoke("gunzip -dc fsstnd.cpio.gz | cpio --extract");
  53.         open(STDERR, ">&SAVEERR");
  54.         unlink("fsstnd.cpio.gz");
  55.         if (&get_ftp_file($skel_cpio, "skel.cpio.gz")) {
  56.             open(SAVEERR, ">&STDERR");
  57.             open(STDERR, ">/dev/tty3");
  58.             $ret += &invoke("gunzip -dc skel.cpio.gz | cpio --extract");
  59.             open(STDERR, ">&SAVEERR");
  60.             unlink("skel.cpio.gz");
  61.         } else {
  62.             $ret = 1;
  63.         }
  64.         } else {
  65.         $ret = 1;
  66.         }
  67.         if ($ret != 0) {
  68.         &rhs_msgbox("FTP Failed",
  69. <<EOM
  70. >
  71. FTP failed!
  72. >
  73. Error returned: $ftp_error
  74. EOM
  75.                 , 60);
  76.         }
  77.     }
  78.     } elsif ($installsource eq "floppy") {
  79.     mkdir("/mnt/tmp", 0755);
  80.  
  81.     &floppy_copy_file("fsstnd.cgz", "/mnt/tmp", *nogauge);
  82.     &floppy_copy_file("skeleton.cgz", "/mnt/tmp", *nogauge);
  83.  
  84.     open(SAVEERR, ">&STDERR");
  85.     open(STDERR, ">/dev/tty3");
  86.     $ret = &invoke("gunzip -dc /mnt/tmp/fsstnd.cgz | cpio --extract");
  87.     $ret += &invoke("gunzip -dc /mnt/tmp/skeleton.cgz | cpio --extract");
  88.     open(STDERR, ">&SAVEERR");
  89.  
  90.     unlink("/mnt/tmp/fsstnd.cgz");
  91.     unlink("/mnt/tmp/skeleton.cgz");
  92.     } else {
  93.     open(SAVEERR, ">&STDERR");
  94.     open(STDERR, ">/dev/tty3");
  95.     $ret = &invoke("gunzip -dc $rh_mountpath/$fsstnd_cpio | cpio --extract");
  96.     $ret += &invoke("gunzip -dc $rh_mountpath/$skel_cpio | cpio --extract");
  97.     open(STDERR, ">&SAVEERR");
  98.     }
  99.  
  100.     chdir("/");
  101.     if ($ret != 0) {
  102.     &rhs_msgbox("Filesystem Initialization",
  103. <<EOM
  104. >
  105. The initial archive was not extracted properly.
  106. The archive was probably not found, or the filesystem is corrupted.
  107. Make sure the Red Hat CD (or NFS volume) is mounted.
  108. EOM
  109.             , 60);
  110.     return 0;
  111.     }
  112.     
  113.     if (! $express_install) {
  114.     &rhs_msgbox("Bootstrap Install",
  115. <<EOM
  116. >
  117. The bootstrap installation is complete.
  118. EOM
  119.             , 70);
  120.     }
  121.  
  122.     return 1;
  123. }
  124.  
  125. #######################
  126. 1;
  127.