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

  1. # -*-perl-*-
  2.  
  3. $force_config = 0;
  4.  
  5. sub xinstall {
  6.     local ( $config_again );
  7.     local ( $first_config );
  8.  
  9.     $config_again = 1;
  10.     $first_config = 1;
  11.  
  12.     do {
  13.     # get X configured
  14.     if ($config_again) {
  15.         undef $xserver;
  16.  
  17.         &mount_bootdisk();
  18.         if ($first_config && -f "/bootdisk/defaults/xsetup" ) {
  19.         require "/bootdisk/defaults/xsetup";
  20.         }
  21.  
  22.         if ($first_config && defined $xserver) {
  23.         unlink("/etc/X11/X");
  24.         symlink("/usr/X11R6/bin/XF86_$xserver", "/etc/X11/X");
  25.         if (defined $mouseport) {
  26.             unlink("/dev/mouse");
  27.             symlink("$mouseport", "/dev/mouse");
  28.         }
  29.         
  30.         open(IN, "</bootdisk/defaults/XF86Config");
  31.         open(OUT, ">/etc/X11/XF86Config");
  32.         while (<IN>) {
  33.             print OUT;
  34.         }
  35.         close IN;
  36.         close OUT;
  37.         } else {
  38.         $force_config = 1;
  39.         $ret = &configure_mouse;
  40.         $ret = &select_x_server;
  41.         $force_config = 0;
  42.  
  43.         $first_config = 0;
  44.  
  45.         &invoke("/usr/rhs/install/Xconfigurator $xserver $mousetype");
  46.         }
  47.     }
  48.  
  49.     &rhs_msgbox ( "X Install",
  50. <<EOM
  51. >
  52. X is about to start.  If it succeeds you will have a few seconds
  53. to press a button on the screen.  If you do not see the button,
  54. X has most likely been misconfigured, and a timeout will occur,
  55. bringing you back to text mode for further instructions.
  56. >
  57. This could take as long as two minutes on a slow network or using
  58. a slow CDROM drive. Please be patient.
  59. >
  60. EOM
  61.              , 70);
  62.  
  63.     &invoke('/usr/X11/bin/startx');
  64.  
  65.     if (! (-f "/tmp/xworked")) {
  66.         &rhs_menu("X Error",
  67. <<EOM
  68. >
  69. X seems to have failed to configure and/or run properly.
  70. >
  71. What do you want to do?
  72. EOM
  73.               , 70, 3,
  74.               "Retry", "Just try X again",
  75.               "Reconfigure", "Reconfigure X and try again",
  76.               "text", "Fall back to text based install");
  77.         if ($dialog_result eq "text") {
  78.         return 0;
  79.         }
  80.         if ($dialog_result eq "Retry") {
  81.         $config_again = 0;
  82.         } else {
  83.         $config_again = 1;
  84.         }
  85.     } else {
  86.         # X worked
  87.         open(FD, "/etc/X11/XF86Config");
  88.         $fsmount = "/mnt";
  89.         open(OFD, ">$fsmount/etc/X11/XF86Config");
  90.         while (<FD>) {
  91.         print OFD $_;
  92.         }
  93.         close(FD);
  94.         close(OFD);
  95.  
  96.         unlink("$fsmount/etc/X");
  97.         unlink("$fsmount/etc/X11/X");
  98.         symlink("../../usr/X11R6/bin/XF86_$xserver", "$fsmount/etc/X11/X");
  99.         unlink("$fsmount/usr/X11R6/bin/X");
  100.         symlink("../../../etc/X11/X", "$fsmount/usr/X11R6/bin/X");
  101.         
  102.         &finish_mouse;
  103.         &finish_pcmcia;
  104.         &finish_cd;
  105.     }
  106.     } while (! (-f "/tmp/xworked"));
  107.  
  108.     return 1;
  109. }
  110.  
  111. 1;
  112.