home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd2.bin / suse / inst-sys / lib / YaST2 / clients / inst_mode.ycp < prev    next >
Encoding:
Text File  |  2000-03-30  |  3.0 KB  |  105 lines

  1. /**
  2.  *
  3.  * Author:    Klaus KΣmpf
  4.  *
  5.  * Purpose:     This module asks the installation method: "New installation" or "update"
  6.  *
  7.  * user_settings:
  8.  *
  9.  * sh@suse.de:    THIS HAS CHANGED A LOT!
  10.  *         THE OLD INST_MODES ARE OBSOLETE; NOW THE USER CAN ONLY
  11.  *         CHOOSE BETWEEN "INSTALL" OR UPDATE!
  12.  *
  13.  * rw: instmode:    `install or `update
  14.  *
  15.  * <OBSOLETE>
  16.  * wr: softwaresel:    to ".default" if user selects "Straight forward"
  17.  * wr: install_sources:    to "false"    if user selects "Straight forward"
  18.  * wr: commercial:    to "false"    if user selects "Straight forward"
  19.  *
  20.  * </OBSOLETE>
  21.  *
  22.  * $Id: inst_mode.ycp,v 1.10 2000/03/10 13:43:23 kkaempf Exp $
  23.  */
  24. {
  25.     boolean instmode_update = (lookup(user_settings, "instmode") == `update);
  26.  
  27.     term contents =
  28.     `RadioButtonGroup( `id( `options ),
  29.                `HSquash(
  30.                     `Frame (
  31.                         // message above radiobuttons (installation/update)
  32.                         _("Please select"),
  33.                         `VBox(
  34.                           `Left(`RadioButton(`id(`install),
  35.                                      // label for radiobutton 1, New installation
  36.                                      _("New &installation"), ! instmode_update ) ),
  37.                           `Left(`RadioButton(`id(`update),
  38.                                      // label for radiobutton 2, update
  39.                                      _("&Update an existing system"), instmode_update ))
  40.                           )
  41.                         )
  42.                     )
  43.                );
  44.  
  45.     // help text for installation method
  46.     string help_text = UI(_("\
  47. <p>
  48. Select <b>update an existing system</b> to upgrade a SuSE Linux system
  49. already installed on your machine. This option will preserve
  50. configuration settings from your existing system whenever possible.
  51. </p>" ) );
  52.  
  53.     help_text = help_text + UI(_("\
  54. <p>
  55. Select <b>new installation</b> if there is no existing SuSE Linux
  56. system on your machine or if you want to completely replace an
  57. existing SuSE Linux system, abandoning all its configuration settings.
  58. </p>
  59. <br>" ) );
  60.  
  61.       // screen title for installation method
  62.       any dlg = UI(`SetWizardContents(_("Install SuSE Linux"),
  63.                       contents,
  64.                       help_text,
  65.                       Args(0), true));
  66.  
  67.     // Event handling
  68.  
  69.     any ret = nil;
  70.     while (true) {
  71.     ret = UI(`UserInput());
  72.     if (ret == `next || ret == `back) {
  73.         any newmode = UI(`QueryWidget(`id(`options), `CurrentButton));
  74.         if (newmode == nil) {
  75.         // no installation method was selected
  76.         if ( ret != `back )
  77.         {
  78.            UI(`DisplayMessage(_("You have to choose one of the\noptions in order to continue.")));
  79.            continue;
  80.         }
  81.         }
  82.         else {
  83.         user_settings = add(user_settings, "instmode", newmode);
  84.         // revert to default software selection for `auto mode
  85.         if (newmode == `auto) {
  86.             user_settings = add(user_settings, "softwaresel", [.default]);
  87.             user_settings = add(user_settings, "install_sources", false);
  88.             user_settings = add(user_settings, "commercial", false);
  89.         }
  90.         else if (newmode == `install) {
  91.             Shell("rm -f /tmp/update_mode");
  92.         }
  93.         else if (newmode == `update) {
  94.             Shell("touch /tmp/update_mode");
  95.             return `cancel;
  96.         }
  97.         }
  98.         // Handle your option here
  99.         break;
  100.     }
  101.     else break;
  102.     }
  103.     return ret;
  104. }
  105.