home *** CD-ROM | disk | FTP | other *** search
/ Caldera Network Desktop 1.0 / caldera-network-desktop-1.0.bin / images / ramdisk2.img / usr / lib / perl / mount_rh < prev    next >
Text File  |  1995-09-06  |  2KB  |  150 lines

  1. # Mounts RHS stuff, either from CD or over NFS -*-perl-*-
  2.  
  3. # Only mount_rhs() and unmount_rhs() are interactive
  4.  
  5. # Entry point: mount_rhs()
  6. #   unmounts rhs stuff if it is mounted (ask first)
  7. #   ask NFS or CD
  8. #   NFS: if net not configed, config it
  9. #        ask for details and try mount
  10. #   CD: probe
  11. # if fails, try again
  12.  
  13. ##
  14. ## Variables
  15. ##
  16.  
  17. # $rh_mountpath is point at which to mount the device
  18. # $rpppath is the path from $rh_mountpath to the rpp directory,
  19. #     which is used to verify that this is indeed RHS stuff
  20.  
  21. $rh_mountpath = "/image";
  22. $rpppath = "rpps";
  23.  
  24. # This is, "CD", "NFS"
  25. $rh_mounttype = "";
  26.  
  27. $rh_mountdevice = "";
  28. $rh_mountdevicetype = "";
  29.  
  30. ##
  31. ## Functions
  32. ##
  33.  
  34. sub mount_rhs {
  35.  
  36.     local ($try_again, $ret);
  37.  
  38.     if ($rh_available) {                 # we're probably testing stuff
  39.     return 1;
  40.     }
  41.     ## Now get to the real stuff
  42.     if (! &rhs_menu("Base Install",
  43. <<EOM
  44. >
  45. From where are you mounting the Red Hat distribution?
  46. >
  47. EOM
  48.             , 70, 2,
  49.             "CD", "CD-ROM Installation",
  50.             "NFS", "Network Installation" )) {
  51.     return 0;
  52.     }
  53.  
  54.     $rh_mounttype = $dialog_result;
  55.     if ($rh_mounttype eq "NFS") {
  56.     $ret = &nfs_mount;
  57.     } elsif ($rh_mounttype eq "CD") {
  58.     $ret = &probe_rhs_cdrom;
  59.     } else {
  60.     # NOTREACHED !!
  61.     # Bad install style if we get here
  62.     print "mount_rhs(): Bad install style $rh_mounttype\n";
  63.     exit 1;
  64.     }
  65.  
  66.     if (! $ret) {
  67.     &rhs_msgbox("Error",
  68. <<EOM
  69. >
  70. Without access to the Red Hat Linux files the
  71. install can not continue!  Sorry.
  72. >
  73. EOM
  74.             , 50);
  75.     return 0;
  76.     }
  77.  
  78.     return 1;
  79. }
  80.  
  81. sub unmount_rhs {
  82.  
  83.     if (! $rh_mounted) {
  84.     &rhs_msgbox("Error",
  85. <<EOM
  86. >
  87. The Red Hat stuff does not appear to be mounted.
  88. >
  89. EOM
  90.             , 60);
  91.     return 1;
  92.     }
  93.  
  94.     if (&__umount_rhs != 0) {
  95.     &rhs_msgbox("Error",
  96. <<EOM
  97. >
  98. There was an error unmounting the Red Hat stuff.
  99. Perhaps it was not really mounted.
  100. >
  101. EOM
  102.             , 60);
  103.     return 0;
  104.     }
  105.     
  106.     if (! $express_install) {
  107.     &rhs_msgbox("Success",
  108. <<EOM
  109. >
  110. Red Hat stuff unmounted successfully.
  111. >
  112. EOM
  113.             , 60);
  114.     }
  115.  
  116.     return 1;
  117. }
  118.  
  119. sub verify_rhs_files {
  120.     return -d "$rh_mountpath/RedHat";
  121. }
  122.  
  123. sub finish_cd {
  124.  
  125.     if ($rh_mounttype eq "CD") {
  126.     open(FD, ">>$fsmount/etc/fstab");
  127.  
  128.     print FD
  129. <<EOM
  130.  
  131. #
  132. # Red Hat CD-ROM
  133. #
  134. EOM
  135.     ;
  136.     
  137.     printf(FD "%-30s %-15s %-6s %s\n", $rh_mountdevice, "/mnt/cdrom", "iso9660", "ro,noauto");
  138.     close FD;
  139.  
  140.  
  141.     symlink($rh_mountdevice, "$fsmount/dev/cdrom");
  142.     }
  143.  
  144.     return 1;
  145. }
  146.  
  147. ############
  148. 1;
  149.  
  150.