home *** CD-ROM | disk | FTP | other *** search
-
- /**
- * Module: inst_sw_details.ycp
- *
- * Authors: Mathias Kettner (kettner@suse.de)
- * Klaus Kaempf (kkaempf@suse.de) (initial)
- * Stefan Hundhammer (sh@suse.de)
- * Stefan Schubert (schubi@suse.de)
- *
- * Purpose:
- * Display detailed software selection screen.
- * Show checkboxes for software categories.
- * Let the user select his software.
- *
- * user_settings read: "softwaresel"
- * "language"
- * "install_sources"
- * "install_info"
- *
- * user_settings write: "softwaresel"
- * "have_x11"
- * "install_sources"
- * "install_info"
- *
- *
- *
- *
- * $Id: inst_sw_details.ycp,v 1.28 2000/03/10 14:52:09 kkaempf Exp $
- */
-
- {
- list current_sel = lookup(user_settings, "softwaresel", [.default]);
- string language = lookup(user_settings, "language", default_language);
- list(map) required_partition = [];
-
-
- map targetMap = lookup( user_settings, "targets", $[] );
-
- define GetFreeSpace( list partion_list ) ``{
-
- integer free_space = 0;
-
- foreach( `part, partion_list, ``{
- free_space = free_space + lookup( part, "free" );
- } );
-
- return ( UI( `size_text( free_space*1024) ) );
- };
-
- if ( lookup(user_settings, "test_mode", false) == true )
- {
- // TEST VALUES !!!
- targetMap = $[
- "/dev/sda":$[
- "bus":"SCSI",
- "name":"1. SCSI, 8.54 GB, /dev/sda, IBM-DNES-309170W",
- "cyl_count":1114,
- "cyl_size":8224768,
- "vendor":"IBM DNES-309170W",
- "partitions":[
- $["fsid":131, // YES: mount
- "mount":"/boot",
- "fstype":"Linux native",
- "nr":1,
- "region":[1, 254],
- "type":`primary],
- $["delete":true, // NO: no mount
- "fsid":130,
- "fstype":"Linux swap",
- "nr":2,
- "region":[255, 299],
- "type":`primary],
- $["create":false, // NO: create false
- "fsid":131,
- "mount":"/var",
- "fstype":"Linux native",
- "nr":3,
- "region":[300, 499],
- "type":`primary],
- $["create":true, // YES: create true + mount
- "fsid":131,
- "mount":"/",
- "nr":4,
- "format":true,
- "region":[500, 844],
- "type":`primary
- ]
- ]
- ],
- "/dev/sdb":$[
- "bus":"SCSI",
- "name":"1. SCSI, 8.54 GB, /dev/sda, IBM-DNES-309170W",
- "cyl_count":11141,
- "cyl_size":8224768,
- "vendor":"IBM DNES-309170-XEW",
- "partitions":[
- $["fsid":131, // NO: nothing
- "fstype":"Linux native",
- "nr":1,
- "region":[1, 254],
- "type":`primary],
- $["create":true, // NO: no mount
- "fsid":130,
- "fstype":"Linux swap",
- "nr":2,
- "region":[255, 299],
- "type":`primary],
- $["delete":true, // NO: delete false
- "fsid":131,
- "mount":"/var",
- "fstype":"Linux native",
- "nr":3,
- "region":[300, 499],
- "type":`primary],
- $[ "delete":false, // YES: delete true
- "fsid":130,
- "mount":"/usr",
- "fstype":"Linux swap", // user-visible string
- "nr":4, // partition number, as seen by linux (!)
- "region": [500,10871], // start end of region in cyl.s
- "use":true, // mark as 'used' in inst_target_partition
- "type":`primary
- ]
- ] ] ];
-
- // End TEST VALUES
- }
-
- // Get information about available partitions
- list partition = get_partition_info( targetMap, true );
- _debug("partition:", partition);
-
- // screen title for detailed software selection
- locale title = _("Detailed Software Selection");
-
- list pacsels = [];
- if ( lookup(user_settings, "test_mode", false) )
- {
- pacsels = filter(`sel,
- Read("/lib/YaST2/pacsel/index.ycp"),
- ``(select(sel, 1) != .paylist));
- }
- else
- {
- pacsels = filter(`sel,
- Read("/var/adm/mount/suse/setup/descr/pacsel/index.ycp"),
- ``(select(sel, 1) != .paylist));
- }
-
- // Construct Box with Checkbox for each software category
-
- // Title of frame around "basic software"
- term categories = `VBox();
- list baseconf = [];
-
- foreach(`sel, pacsels, ``{
- path selid = select(sel, 0);
- path group = select(sel, 1);
- map langmap = select(sel, 2);
-
- string seldesc = translate(langmap, language );
-
- if ( group == .addon )
- {
- categories = add(categories, `Left(`CheckBox(`id(selid), `opt(`notify),
- seldesc, contains(current_sel, selid))));
- }
- if ( group == .baseconf )
- {
- baseconf = add ( baseconf, selid );
- }
- });
-
- // recognize the current selected baseconf ( .default, .Minimal, .All )
- path software_group_path = .;
- list software_group = [];
- foreach(`sel, current_sel, ``{
- if ( contains ( baseconf, sel ) )
- {
- software_group_path = sel;
- }
- });
- if ( size ( software_group_path ) > 0 )
- {
- software_group = add ( software_group, software_group_path );
- }
- _debug ( "Software_group = ", software_group );
-
-
- categories = add(categories, `Label( " " ) ); // spacing
- categories = add(categories, `Left(`CheckBox(`id(`sources),`opt(`notify),
- // Check box for installing all source code packages
- _("&Install available sources"), // false ) ) );
- lookup(user_settings, "install_sources", false) ) ) );
-
- // get information about free disk space
- required_partition = PKGINFO ( `getDiskSpace ( partition ) );
-
-
- // Build and show dialog
- term contents = `VBox(
- `VWeight( 80, `VCenter( `HSquash( `Frame( _( "Categories" ), categories ) ) ) ),
- `Label( `id(`free_space), sformat( UI(_("%1 remaining free space on hard disk")), GetFreeSpace( required_partition ) ) ),
- `VWeight( 10, `HBox(
- `HWeight( 10, `HStretch() ),
- `HWeight( 35, `PushButton( `id(`sw_pay ), `opt(`hstretch), _( "&Commercial software..." ) ) ),
- `HWeight( 2, `HStretch() ),
- `HWeight( 35, `PushButton( `id(`sw_single ), `opt(`hstretch), _( "&Select single packages..." ) ) ),
- `HWeight( 10, `HStretch() )
- )
- ),
- `VWeight( 10, `VStretch() )
- );
-
-
- // Explain additional software categories
- // (E.g. Multimedia, Games, Development, ...).
- // help part 1 of 3
- string helptext = UI(_("<p>
- Select categories of software to install.
- </p>
-
- <p>
- The basic system will always be installed. The software categories
- automatically include other system components as required,
- i.e. if you select a desktop like <i>KDE</i> or <i>GNOME</i>, the X
- Window System will automatically be installed.
- </p>"));
- // help part 2 of 3
- helptext = helptext + UI(_("<p>
- Software categories may overlap, i.e. there may be software packages
- that belong to <i>Multimedia</i> as well as to <i>KDE</i>.
- That's why the required disk space is not displayed along with the
- categories - the total disk space required depends on the combination
- of selected categories.
- </p>"));
- // help part 3 of 3
- helptext = helptext + UI(_("<p>
- SuSE Linux comes with all free sources, so you have the option to
- <b>install available sources</b> for selected components. Please
- note: Sources are not available for commercial software.
- </p>
- <br>"));
-
- UI(`SetWizardContents(title, contents, helptext, Args(0),Args(1)));
-
- any ret = nil;
- while (true)
- {
- ret = UI(`UserInput());
-
- if ( ret == `back || ret == `cancel )
- {
- break;
- }
-
-
- current_sel = software_group;
-
- // Query the addon checkboxes
-
- foreach(`sel, filter(`ps, pacsels, ``(select(ps, 1) == .addon)), ``{
- path id = select(sel, 0);
- if (UI(`QueryWidget(`id(id), `Value)))
- current_sel = add(current_sel, id);
- });
-
- user_settings = add(user_settings, "softwaresel", current_sel);
-
- // .Minimal has no X11
- if (contains(current_sel, .Minimal)
- && (!(contains(current_sel, .Kde) || contains (current_sel, .Gnome))))
- user_settings = add(user_settings, "have_x11", false);
- else
- user_settings = add(user_settings, "have_x11", true);
-
- user_settings = add(user_settings, "install_sources",
- UI(`QueryWidget(`id(`sources), `Value)));
-
- // Get package-install-list for the preselected package-groups
- list package_list = CallFunction( `inst_pkg_toinstall( user_settings ) );
-
- _debug ("Packages to install:", package_list );
-
-
- // setting all packages to server pkginfo. If there was a single selected package
- // ( made in frame inst_single_select), this selection will not be reset.
- // ( second parameter of setInstallSelection )
- PKGINFO ( `setInstallSelection ( package_list, true ) );
-
- PKGINFO ( `setSourceInstallation(lookup(user_settings, "install_sources", false)) );
-
- if ( lookup(user_settings, "test_mode", false) )
- {
- // TEST MODE !!!
- // Check, if there is a unresolved dependency
- map pac_depends = $[];
- list(map) or_depends = [];
- list(map) xor_depends = [];
- pac_depends = PKGINFO(`getDependencies());
- _debug ( "TESTMODE: check-dependencies BEFORE solving" );
- or_depends = lookup( pac_depends, "OR" );
- _debug( "OR Dependencies:", or_depends );
- xor_depends = lookup( pac_depends, "XOR" );
- _debug( "XOR Dependencies:", xor_depends );
- list install_info = PKGINFO ( `getInstallSet() );
- _debug( "getInstallSet =",install_info );
- }
-
- if ( ret == `sw_pay )
- {
- ret = CallFunction( `inst_sw_single( `pay, `not_only_checked ) );
-
- if ( ret == `ok || ret == `cancel )
- ret = `again;
- break;
- }
- else if ( ret == `sw_single )
- {
- ret = CallFunction( `inst_sw_single( `single, `not_only_checked ) );
-
- if ( ret == `ok || ret == `cancel )
- ret = `again;
- break;
- }
-
- // Check, if there is a unresolved dependency
- map pac_depends = $[];
- list(map) or_depends = [];
- list(map) xor_depends = [];
- pac_depends = PKGINFO(`getDependencies());
-
- or_depends = lookup( pac_depends, "OR" );
- _debug( "OR Dependencies:", or_depends );
- xor_depends = lookup( pac_depends, "XOR" );
- _debug( "XOR Dependencies:", xor_depends );
-
- if ( or_depends != [] || xor_depends != [] )
- {
- // There is an unresolved dependency -> call single-package-selection
- // to solve it ( only if user did any single selection before )
- if ( PKGINFO( `isSingleSelected() ) )
- {
- CallFunction( `inst_sw_single( `single, `only_check ) );
- }
- else
- {
- y2log(.warning, "inst_sw_details", 1, sformat("Unresolved: OR: %1, XOR: %2", or_depends, xor_depends));
- }
- }
-
- if ( lookup(user_settings, "test_mode", false) )
- {
- // TEST MODE !!!
- // Check, if there is a unresolved dependency
- map pac_depends = $[];
- list(map) or_depends = [];
- list(map) xor_depends = [];
- pac_depends = PKGINFO(`getDependencies());
- _debug ( "TESTMODE: check-dependencies AFTER solving" );
- or_depends = lookup( pac_depends, "OR" );
- _debug( "OR Dependencies:", or_depends );
- xor_depends = lookup( pac_depends, "XOR" );
- _debug( "XOR Dependencies:", xor_depends );
- list install_info = PKGINFO ( `getInstallSet() );
- _debug( "getInstallSet =",install_info );
- }
-
-
- // calculating size
-
- required_partition = PKGINFO ( `getDiskSpace ( partition ) );
-
- _debug("Required partitions :",required_partition );
-
- UI( `ChangeWidget( `id(`free_space), `Value, sformat( UI(_("%1 remaining free space on hard disk")), GetFreeSpace( required_partition ) ) ) );
-
- string message = "";
-
- // Construct a popup like:
- // +-----------------------------------------------+
- // | Partition / needs 200 KB more disk space. |
- // | Partition etc needs 40 MB more disk space. |
- // | |
- // | Please deselect some packages. |
- // +-----------------------------------------------+
- foreach( `par, required_partition,
- ``{
- if ( lookup( par, "free", 0 ) < 0 )
- {
- message = message + sformat ( UI(_("Partition \"%1\" needs %2 more disk space.")),
- lookup ( par, "name" ), UI( `size_text(lookup ( par, "free" ) * -1 *1024) ) ) + "\n";
- }
- } );
-
- if ( size ( message ) > 0 )
- {
- message = message + "\n" + UI(_("Please deselect some packages."));
- _debug("Warning:", message );
- UI(`DisplayMessage(message));
- }
- else
- {
- if ( ret == `next || ret == `again )
- {
- break;
- }
- }
- }
-
- _debug ( "inst_sw_details return :", ret );
-
- return ret;
- }
-