Module: Yast::ProductCreatorKiwiDialogsInclude
- Defined in:
- ../../src/include/product-creator/kiwi_dialogs.rb
Instance Method Summary (collapse)
-
- (Object) BrowseDirectoryHandler(key, label)
universal handler for directory browsing.
-
- (Object) BrowseFileHandler(key, label)
universal handler for file browsing.
-
- (Object) CheckForAvailablePackages(ignore_allowed)
Check if selected packages are available (some of them may not after deleting some repository) return true if there was no conflict.
-
- (Object) CheckForDeletedPackages(packages_before)
check the conflicts between packages selected and marked for deletion (fate#305254).
-
- (Object) CheckPackageDependencies
Check if all selected packages and patterns can be installed If dependency problem was found, open package selector.
-
- (Object) CreateImage(key, event)
handler for main action: create the iso image with kiwi.
- - (Object) get_widget_description
-
- (Object) GetAvailableImages(subdir)
read available the images under /usr/share/kiwi/image/ directory.
-
- (Object) HandleAddEditUser(key, event)
Handle changes in users table.
-
- (Object) HandleAddToConfigDir(key, event)
add new subdir to the 'config' directory.
-
- (Object) HandleAddToRootDir(key, event)
add new subdir to the 'root' directory.
-
- (Object) HandleBootCombo(key, event)
handler for combo box with boot items.
-
- (Object) HandleBrowseConfigDirectory(key, event)
handler for 'config' directory browse.
-
- (Object) HandleBrowseRootDirectory(key, event)
handler for 'root' directory browse.
- - (Object) HandleCompressionCombo(key, event)
-
- (Object) HandleDeleteFromConfigDir(key, event)
delete subdir from the 'config' directory.
-
- (Object) HandleDeleteFromRootDir(key, event)
delete subdir from the 'root' directory.
-
- (Object) HandleDeleteUser(key, event)
handle delete user button.
-
- (Object) HandleDescription(key, event)
handler for string-value “description” related widgets: store on exit/save.
- - (Object) HandleDiskPassword(key, event)
- - (Object) HandleEncryptDisk(key, event)
-
- (Object) HandleGeneric(key, event)
handler for general string-value widgets: store their value on exit/save.
-
- (Object) HandleImportConfigFile(key, event)
Handler for importing config.sh file.
-
- (Object) HandleImportImagesFile(key, event)
Handler for importing images.sh file TODO same function as HandleImportConfigFile.
-
- (Object) HandlePreferences(key, event)
handler for string-value “preferences” related widgets: store on exit/save.
-
- (Object) HandleSize(key, event)
handler for size widget: store value on exit/save.
- - (Object) HandleSWDelete(key, event)
- - (Object) HandleSWIgnore(key, event)
-
- (Object) HandleSWSelection(key, event)
Handler for software selection.
-
- (Object) HandleSWSelectionCombo(key, event)
handler for combo box with package sets items.
-
- (Object) HandleVersion(key, event)
handler for version.
-
- (Object) InitBootCombo(id)
initialize the value of combo box with boot items.
-
- (Object) InitCompressionCombo(id)
**************************************************************************** widget handlers **************************************************************************.
-
- (Object) InitConfigDirTable(id)
initialize the table with config dir contents.
-
- (Object) InitDescription(id)
initialize the string value of “description” related widget.
- - (Object) InitDiskPassword(id)
-
- (Object) InitGeneric(id)
universal widget: initialize the string value of widget @param.
- - (Object) initialize_product_creator_kiwi_dialogs(include_target)
-
- (Object) InitImageConfiguration
Global init function for Kiwi image dialog - read saved settings and fill in defaults.
-
- (Object) InitKeytableCombo(id)
initialize the list value of “keytable” combo box.
-
- (Object) InitLabel(id)
initialize the product label.
-
- (Object) InitLocaleCombo(id)
initialize the list value of “locale” combo box.
-
- (Object) InitPreferences(id)
initialize the string value of “preferences” related widget.
-
- (Object) InitRootDirTable(id)
initialize the table with root dir contents.
-
- (Object) InitSize(id)
initialize the values of “size”, “sizeunit” and “additive” widgets.
-
- (Object) InitSWDelete(id)
Initialize the widget with packages intended for deletion.
-
- (Object) InitSWIgnore(id)
Initialize the widget with ignored packages.
-
- (Object) InitSWRichText(id)
Initialize the contents of richtext with selected software.
-
- (Object) InitSWSelectionCombo(id)
initialize the combo box with package selection groups.
-
- (Object) InitTimezoneCombo(id)
initialize the list value of “timezone” combo box.
-
- (Object) InitUsersTable(id)
initialize the table with users.
-
- (Object) InitVersion(id)
initialize the value of version.
-
- (Object) KiwiDialog
Main dialog for Kiwi image configuration.
-
- (Object) modifyBootIncludePackages(packages)
Popup for modifying the list of 'bootinclude' packages.
-
- (Object) modifyPackageSelection(sw_contents)
open package selector with given set of packages, return modified set or nil on cancel.
-
- (Object) NotImplementedHandler(key, event)
generic popup.
-
- (Object) PrepareDialog
Prepare dialog: define kiwi data without product-creator.
-
- (Object) StoreBootCombo(key, event)
store the value of current boot image.
- - (Object) StoreCompressionCombo(key, event)
-
- (Object) StoreDescription(key, event)
store the string value of “description” related given widget.
- - (Object) StoreDiskPassword(key, event)
-
- (Object) StoreGeneric(key, event)
store the string value of given widget.
-
- (Object) StorePreferences(key, event)
store the string value of “preferences” related given widget.
-
- (Object) StoreSize(key, event)
store the values of “size”, “sizeunit” and “additive” widgets.
- - (Object) StoreSWDelete(key, event)
- - (Object) StoreSWIgnore(key, event)
- - (Object) StoreSWSelectionCombo(key, event)
-
- (Object) StoreVersion(key, event)
store the value of current version.
-
- (Object) tabs_descr
return map with description of tabs it is a function, to be able to adapt to actual state).
Instance Method Details
- (Object) BrowseDirectoryHandler(key, label)
universal handler for directory browsing
1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1376 def BrowseDirectoryHandler(key, label) current = Convert.to_string(UI.QueryWidget(Id(key), :Value)) current = "" if current == nil dir = UI.AskForExistingDirectory(current, label) if dir != nil UI.ChangeWidget(Id(key), :Value, dir) StoreGeneric(key, {}) end dir end |
- (Object) BrowseFileHandler(key, label)
universal handler for file browsing
1406 1407 1408 1409 1410 1411 1412 1413 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1406 def BrowseFileHandler(key, label) file = UI.AskForExistingFile(key, "", label) if file != nil && key != "config.sh" && key != "root/build-custom" UI.ChangeWidget(Id(key), :Value, file) StoreGeneric(key, {}) end file end |
- (Object) CheckForAvailablePackages(ignore_allowed)
Check if selected packages are available (some of them may not after deleting some repository) return true if there was no conflict
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1468 def CheckForAvailablePackages(ignore_allowed) packages_section = Ops.get_list(@KiwiConfig, "packages", []) index = 0 ret = :ok Builtins.foreach(packages_section) do |pmap| type = Ops.get_string(pmap, "type", "") if type != "delete" Popup.ShowFeedback( _("Checking packages availability..."), _("Please wait...") ) n_a = [] bi_packages = [] original_pmap = deep_copy(pmap) Ops.set( pmap, "package", Builtins.filter(Ops.get_list(pmap, "package", [])) do |p| if Ops.get_string(p, "bootinclude", "") == "true" bi_packages = Builtins.add(bi_packages, p) # do not check bootinclude packages elsif Ops.get_string(p, "name", "") != "" && !Pkg.IsAvailable(Ops.get_string(p, "name", "")) n_a = Builtins.add(n_a, Ops.get_string(p, "name", "")) end Ops.get_string(p, "bootinclude", "") != "true" end ) Popup.ClearFeedback if Ops.greater_than(Builtins.size(n_a), 0) ret = :missing type_label = Ops.get_string(@section_type_label, type, type) UI.OpenDialog( Opt(:decorated), HBox( VSpacing(25), VBox( HSpacing(70), Left(Heading(_("Missing packages"))), VSpacing(0.2), # popup text RichText( Builtins.sformat( _( "<p>Packages from section '%1' are not available with selected repositories:</p>\n" + "<p>%2.</p>\n" + "<p>\n" + "Either remove the packages from the section, check the detailed package selection or ignore the situation.</p>\n" + "<p>\n" + "Going to detailed package selection and accepting the view without any further changes results in removal of problematic packages from the section.\n" + "</p>\n" ), type_label, Builtins.mergestring(Builtins.sort(n_a), "<br>") ) ), HBox( # button label PushButton(Id(:remove), Opt(:default), _("Remove Packages")), # button label PushButton(Id(:selection), _("Check Package Selection")), # button label PushButton( Id(:ignore), ignore_allowed ? _("Ignore") : _("Cancel") ) ) ) ) ) r = UI.UserInput UI.CloseDialog if r == :remove Ops.set( @KiwiConfig, ["packages", index, "package"], Builtins.filter(Ops.get_list(original_pmap, "package", [])) do |p| !Builtins.contains(n_a, Ops.get_string(p, "name", "")) end ) ret = :removed end if r == :selection sw_contents = modifyPackageSelection(pmap) if sw_contents != nil Ops.set( sw_contents, "package", Builtins.union( Ops.get_list(sw_contents, "package", []), bi_packages ) ) Ops.set(@KiwiConfig, ["packages", index], sw_contents) ret = :selection end end end end index = Ops.add(index, 1) end ret end |
- (Object) CheckForDeletedPackages(packages_before)
check the conflicts between packages selected and marked for deletion (fate#305254)
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 499 def CheckForDeletedPackages(packages_before) packages_before = deep_copy(packages_before) Builtins.y2milestone("checking list of selected packages...") StoreSWDelete("delete_sw", {}) to_delete = {} Builtins.foreach(Ops.get_list(@KiwiConfig, "packages", [])) do |pmap| type = Ops.get_string(pmap, "type", "") if type == "delete" to_delete = Builtins.listmap(Ops.get_list(pmap, "package", [])) do |pacmap| { Ops.get_string(pacmap, "name", "") => true } end end end conflicting = false if Ops.greater_than(Builtins.size(to_delete), 0) Builtins.foreach(Pkg.ResolvableProperties("", :package, "")) do |package| raise Break if conflicting name = Ops.get_string(package, "name", "") # only look at packages selected in last package selector run if Ops.get(package, "status") == :selected && !Builtins.haskey(packages_before, name) transact_by = Ops.get_symbol(package, "transact_by", :none) if transact_by == :solver || transact_by == :user || transact_by == :app_high if Builtins.haskey(to_delete, name) Builtins.y2milestone( "packege %1 selected by %2 is present in the delete list", name, transact_by ) conflicting = true end end end end end conflicting end |
- (Object) CheckPackageDependencies
Check if all selected packages and patterns can be installed If dependency problem was found, open package selector. Return false if package selector was canceled
1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1578 def CheckPackageDependencies ret = true packages_section = Ops.get_list(@KiwiConfig, "packages", []) index = 0 Builtins.foreach(packages_section) do |pmap| type = Ops.get_string(pmap, "type", "") if type != "delete" Pkg.ResolvableNeutral("", :package, true) Pkg.ResolvableNeutral("", :pattern, true) Builtins.foreach(Ops.get_list(pmap, "namedCollection", [])) do |pat| Pkg.ResolvableInstall(Ops.get_string(pat, "name", ""), :pattern) end ProductCreator.MarkTaboo( Builtins.maplist(Ops.get_list(pmap, "ignore", [])) do |i| Ops.get_string(i, "name", "") end ) # remember bootinclude packages: in Package selector we will lose this information (bnc#750739) bi_packages = {} Builtins.foreach( Ops.get_list(@KiwiConfig, ["packages", index, "package"], []) ) do |p| if Ops.get_string(p, "bootinclude", "") == "true" Ops.set(bi_packages, Ops.get_string(p, "name", ""), true) end InstallPackageOrProvider(Ops.get_string(p, "name", "")) end solved = Pkg.PkgSolve(true) if !solved sw_contents = modifyPackageSelection( Ops.get_map(@KiwiConfig, ["packages", index], {}) ) if sw_contents != nil Ops.set( sw_contents, "package", Builtins.maplist(Ops.get_list(sw_contents, "package", [])) do |p| name = Ops.get_string(p, "name", "") if Ops.get_boolean(bi_packages, name, false) Builtins.y2milestone( "package %1 was marked as bootinclude", name ) Ops.set(p, "bootinclude", "true") end deep_copy(p) end ) Ops.set(@KiwiConfig, ["packages", index], sw_contents) else ret = false end end end index = Ops.add(index, 1) end ret end |
- (Object) CreateImage(key, event)
handler for main action: create the iso image with kiwi
1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1643 def CreateImage(key, event) event = deep_copy(event) return true if Ops.get(event, "ID") != :next ret = true question = { # popup question "iso" => _("Create ISO image now?"), # popup question "xen" => _("Create Xen image now?"), # popup question "vmx" => _("Create virtual disk image now?") } success = { # popup message, %1 is a dir "iso" => _( "ISO image successfully created in\n" + "%1\n" + "directory." ), # popup message, %1 is a dir "xen" => _( "Xen image files successfully created in\n" + "%1\n" + "directory.\n" ), # popup message, %1 is a dir "vmx" => _( "Virtual disk image successfully created in\n" + "%1\n" + "directory." ) } create_image_now = false selected_profiles = "" if Ops.greater_than( Builtins.size(Ops.get_list(@KiwiConfig, "profiles", [])), 0 ) items = VBox(VSpacing(0.5)) profiles = Builtins.maplist( Ops.get_list(@KiwiConfig, ["profiles", 0, "profile"], []) ) do |prof| name = Ops.get_string(prof, "name", "") desc = Ops.get_string(prof, "description", "") items = Builtins.add( items, Left( CheckBox( Id(name), desc == "" ? name : Builtins.sformat("%1 (%2)", name, desc) ) ) ) name end UI.OpenDialog( Opt(:decorated), HBox( HSpacing(0.5), VBox( VSpacing(0.5), # popup label Label( Ops.get_locale(question, @kiwi_task, _("Create image now?")) ), items, HBox( PushButton(Id(:yes), Opt(:key_F10), Label.YesButton), PushButton(Id(:no), Opt(:key_F9), Label.NoButton) ), VSpacing(0.5) ), HSpacing(0.5) ) ) while true ret2 = UI.UserInput if ret2 == :no create_image_now = false break end if ret2 == :yes create_image_now = true Builtins.foreach( Convert.convert(profiles, :from => "list", :to => "list <string>") ) do |name| if UI.QueryWidget(Id(name), :Value) == true selected_profiles = Ops.add( Ops.add(selected_profiles, " --add-profile "), name ) end end break end end UI.CloseDialog else create_image_now = # default question Popup.YesNo( Ops.get_locale(question, @kiwi_task, _("Create image now?")) ) end if create_image_now if CheckForAvailablePackages(false) == :missing Builtins.y2milestone( "there were missing packages, not going to build" ) InitSWRichText("rt_sw") return false end if !CheckPackageDependencies() Builtins.y2milestone( "there was unresolved dependency problem, not going to build" ) InitSWRichText("rt_sw") return false end # write XML now, after possible modification of the package list Kiwi.WriteConfigXML(@KiwiConfig, @kiwi_task) out_dir = Ops.get_string(@KiwiConfig, "iso-directory", "") if FileUtils.CheckAndCreatePath(out_dir) && Kiwi.PrepareAndCreate(out_dir, selected_profiles) # default popup message, %1 is a dir Popup.Message( Builtins.sformat( Ops.get_locale( success, @kiwi_task, _( "Image successfully created in\n" + "%1\n" + "directory." ) ), out_dir ) ) else ret = false end else Kiwi.WriteConfigXML(@KiwiConfig, @kiwi_task) end dir = Kiwi.SaveConfiguration(@KiwiConfig, @kiwi_task) if dir != nil && dir != "" Ops.set( ProductCreator.Config, Ops.add("kiwi_configuration_", @kiwi_task), dir ) end ret end |
- (Object) get_widget_description
2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 2347 def # ------------------ { # global widgets "global" => { "widget" => :empty, "validate_type" => :function, "validate_function" => fun_ref( method(:CreateImage), "boolean (string, map)" ), "no_help" => true }, "compression" => { "widget" => :combobox, "opt" => [:hstretch, :notify], "items" => [], # textentry label "label" => _("Co&mpression"), # help text "help" => _( "<p>Select the value for image <b>Compression</b>. This will modify the\n<i>flags</i> value of the image type. Check the kiwi manual for an explanation of available values.</p>" ), "init" => fun_ref(method(:InitCompressionCombo), "void (string)"), "store" => fun_ref( method(:StoreCompressionCombo), "void (string, map)" ), "handle" => fun_ref( method(:HandleCompressionCombo), "symbol (string, map)" ) }, "sw_selection" => { "widget" => :combobox, "opt" => [:hstretch, :notify], # combo box label "label" => _("So&ftware Selection"), # help text for "So&ftware selection" "help" => "", "items" => [], "init" => fun_ref(method(:InitSWSelectionCombo), "void (string)"), "store" => fun_ref( method(:StoreSWSelectionCombo), "void (string, map)" ), "handle" => fun_ref( method(:HandleSWSelectionCombo), "symbol (string, map)" ) }, "rt_sw" => { "widget" => :richtext, "init" => fun_ref(method(:InitSWRichText), "void (string)"), "help" => "", "label" => "&L" }, "configure_sw" => { "widget" => :push_button, # pusbutton label "label" => _("Ch&ange..."), "help" => _( "<p>Adapt the software selection with <b>Change</b>.</p>" ), "handle" => fun_ref( method(:HandleSWSelection), "symbol (string, map)" ) }, "ignore" => { "widget" => :multi_line_edit, # label "label" => _("&Ignored Software"), "init" => fun_ref(method(:InitSWIgnore), "void (string)"), "store" => fun_ref(method(:StoreSWIgnore), "void (string, map)"), "handle" => fun_ref(method(:HandleSWIgnore), "symbol (string, map)"), # help text for "&Ignored software" "help" => _( "<p>For <b>ignored software</b>, enter each entry (like 'smtp_daemon') on a new line.</p>" ) }, "delete_sw" => { "widget" => :multi_line_edit, # label "label" => _("Packages to &Delete"), "init" => fun_ref(method(:InitSWDelete), "void (string)"), "store" => fun_ref(method(:StoreSWDelete), "void (string, map)"), "handle" => fun_ref(method(:HandleSWDelete), "symbol (string, map)"), # help text for "&Ignored software" "help" => _( "<p>Each entry of <b>Packages to Delete</b> is one package name to be uninstalled from the target image.</p>" ) }, "version" => { "widget" => :textentry, # textentry label "label" => _("&Version"), "help" => _( "<p>Enter the <b>Version</b> of your image configuration.</p>" ), "valid_chars" => Ops.add(String.CDigit, "."), "init" => fun_ref(method(:InitVersion), "void (string)"), "store" => fun_ref(method(:StoreVersion), "void (string, map)"), "handle" => fun_ref( method(:HandleVersion), "symbol (string, map)" ) }, "size" => { "widget" => :intfield, "opt" => [:hstretch], # textentry label "label" => _("&Size"), # help text for "Size" field and "Additive" checkbox "help" => _( "<p>Set the image <b>Size</b> in the specified <b>Unit</b>.\nIf <b>Additive</b> is checked, the meaning of <b>Size</b> is different: it is the minimal free space available on the image.</p>" ), "init" => fun_ref(method(:InitSize), "void (string)"), "store" => fun_ref(method(:StoreSize), "void (string, map)"), "handle" => fun_ref(method(:HandleSize), "symbol (string, map)") }, "sizeunit" => # stored and handled by "size" { "widget" => :combobox, # combo box label (MB/GB values) "label" => _("&Unit"), "no_help" => true, "items" => [] }, "additive" => { "widget" => :checkbox, # check box label "label" => _("Additive"), "no_help" => true }, "encrypt_disk" => { "widget" => :checkbox, "opt" => [:notify], # check box label "label" => _("Encrypt Image with LUKS"), # help text "help" => _( "<p>To create an encrypted file system, check <b>Encrypt Image with LUKS</b> and enter the password.</p>" ), "handle" => fun_ref( method(:HandleEncryptDisk), "symbol (string, map)" ) }, "disk_password" => { "widget" => :textentry, # textentry label "label" => _("Encrypted Image LUKS Password"), "init" => fun_ref(method(:InitDiskPassword), "void (string)"), "store" => fun_ref(method(:StoreDiskPassword), "void (string, map)"), "handle" => fun_ref( method(:HandleDiskPassword), "symbol (string, map)" ), "no_help" => true }, # ---------------- widgtes for directory structure "general_scripts" => { "widget" => :empty, # general help for directory structure tab "help" => _( "<p>Edit the configuration scripts used to build your image.</p>" ) }, "general_directories" => { "widget" => :empty, # general help for directory structure tab "help" => _( "<p>Point to the configuration directories for building your image.</p>" ) }, "root_dir" => { "widget" => :textentry, # textentry label "label" => _( "Directory with System Configur&ation" ), # help text "help" => _( "<p>Define the path to the <b>Directory with System Configuration</b> (the <tt>root</tt> directory). The entire directory is copied into the root of the image tree using <tt>cp -a</tt>.</p>" ), "init" => fun_ref(method(:InitGeneric), "void (string)"), "store" => fun_ref(method(:StoreGeneric), "void (string, map)"), "handle" => fun_ref(method(:HandleGeneric), "symbol (string, map)") }, "browse_root_dir" => { "widget" => :push_button, "label" => Label.BrowseButton, "help" => "", "handle" => fun_ref( method(:HandleBrowseRootDirectory), "symbol (string, map)" ) }, "root_dir_table" => { "widget" => :custom, "custom_widget" => VBox( # label (above table) Left(Label(_("Directory with System Configuration"))), Table( Id("roottable"), Header( # table header _("Path to Directory") ) ) ), # help for table with users "help" => _( "<p>Configure the <b>Directory with System Configuration</b> (the <tt>root</tt> directory). The entire directory is copied into the root of the image tree using <tt>cp -a</tt>.</p>" ), "init" => fun_ref(method(:InitRootDirTable), "void (string)") }, "root_dir_add" => { "widget" => :push_button, "label" => Label.AddButton, "no_help" => true, "handle" => fun_ref( method(:HandleAddToRootDir), "symbol (string, map)" ) }, "root_dir_delete" => { "widget" => :push_button, "label" => Label.DeleteButton, "no_help" => true, "handle" => fun_ref( method(:HandleDeleteFromRootDir), "symbol (string, map)" ) }, "config_dir_table" => { "widget" => :custom, "custom_widget" => VBox( # label (above table) Left(Label(_("Directory with Scripts"))), Table( Id("configtable"), Header( # table header _("Path to File") ) ) ), # help for table with users "help" => _( "<p>Configure the <b>Directory with Scripts</b> (the <tt>config</tt> directory). It contains scripts that are run after the installation of all the image packages.</p>" ), "init" => fun_ref( method(:InitConfigDirTable), "void (string)" ) }, "config_dir_add" => { "widget" => :push_button, "label" => Label.AddButton, "no_help" => true, "handle" => fun_ref( method(:HandleAddToConfigDir), "symbol (string, map)" ) }, "config_dir_delete" => { "widget" => :push_button, "label" => Label.DeleteButton, "no_help" => true, "handle" => fun_ref( method(:HandleDeleteFromConfigDir), "symbol (string, map)" ) }, "root/build-custom" => { "widget" => :multi_line_edit, # textentry label "label" => _("Studio Custom Build Script"), "init" => fun_ref(method(:InitGeneric), "void (string)"), "store" => fun_ref(method(:StoreGeneric), "void (string, map)"), "handle" => fun_ref(method(:HandleGeneric), "symbol (string, map)") }, "import_root/build-custom" => { "widget" => :push_button, # textentry label "label" => _("&Import..."), "help" => "", "handle" => fun_ref( method(:HandleImportConfigFile), "symbol (string, map)" ) }, "config.sh" => { "widget" => :multi_line_edit, # textentry label "label" => _("I&mage Configuration Script"), "help" => _( "<p>Edit your <b>Image Configuration Script</b>, called <tt>config.sh</tt>. This script is run at the end of the installation but before the package scripts have run.</p>" ), "init" => fun_ref(method(:InitGeneric), "void (string)"), "store" => fun_ref(method(:StoreGeneric), "void (string, map)"), "handle" => fun_ref(method(:HandleGeneric), "symbol (string, map)") }, "import_config.sh" => { "widget" => :push_button, # textentry label "label" => _("&Import..."), "help" => "", "handle" => fun_ref( method(:HandleImportConfigFile), "symbol (string, map)" ) }, "config_dir" => { "widget" => :textentry, # textentry label "label" => _("Pa&th to Directory with Scripts"), "help" => _( "<p>The optional <b>Directory with Scripts</b> (<tt>config</tt> directory) contains scripts that are run after the installation of all the image packages.</p>" ), "init" => fun_ref(method(:InitGeneric), "void (string)"), "store" => fun_ref(method(:StoreGeneric), "void (string, map)"), "handle" => fun_ref(method(:HandleGeneric), "symbol (string, map)") }, "browse_config_dir" => { "widget" => :push_button, # push button label "label" => _("Br&owse..."), "help" => "", "handle" => fun_ref( method(:HandleBrowseConfigDirectory), "symbol (string, map)" ) }, "images.sh" => { "widget" => :multi_line_edit, # textentry label "label" => _("C&leanup Script"), "help" => _( "<p>Edit your <b>Cleanup Script</b> (<tt>images.sh</tt>). This script is run at the beginning of the image creation process.</p>" ), "init" => fun_ref(method(:InitGeneric), "void (string)"), "store" => fun_ref(method(:StoreGeneric), "void (string, map)"), "handle" => fun_ref(method(:HandleGeneric), "symbol (string, map)") }, "import_images.sh" => { "widget" => :push_button, # textentry label "label" => _("Im&port..."), "help" => "", "handle" => fun_ref( method(:HandleImportImagesFile), "symbol (string, map)" ) }, # ---------------- widgtes for description tab "author" => { "widget" => :textentry, # textentry label "label" => _("&Author"), # help text for Author, Contact and Specification widgets "help" => _( "<p>Set the values for <b>Author</b> of the image, <b>Contact Information</b>, and the image <b>Specification</b>.</p>" ), "init" => fun_ref(method(:InitDescription), "void (string)"), "store" => fun_ref(method(:StoreDescription), "void (string, map)"), "handle" => fun_ref( method(:HandleDescription), "symbol (string, map)" ) }, "contact" => { "widget" => :textentry, # textentry label "label" => _("C&ontact"), "init" => fun_ref(method(:InitDescription), "void (string)"), "store" => fun_ref(method(:StoreDescription), "void (string, map)"), "handle" => fun_ref( method(:HandleDescription), "symbol (string, map)" ), "no_help" => true }, "specification" => { "widget" => :multi_line_edit, # textentry label "label" => _("&Specification"), "init" => fun_ref(method(:InitDescription), "void (string)"), "store" => fun_ref(method(:StoreDescription), "void (string, map)"), "handle" => fun_ref( method(:HandleDescription), "symbol (string, map)" ), "no_help" => true }, "locale" => { "widget" => :combobox, "opt" => [:hstretch, :notify], "items" => [], # textentry label "label" => _("&Locale"), "init" => fun_ref(method(:InitLocaleCombo), "void (string)"), "store" => fun_ref(method(:StorePreferences), "void (string, map)"), "handle" => fun_ref( method(:HandlePreferences), "symbol (string, map)" ), # help text for locale (heading) "help" => _( "<p><b>Locale Settings</b></p>" ) + # help text for locale _( "<p>The value of <b>Locale</b> (e.g. <tt>en_US</tt>) defines the contents of the RC_LANG variable in <t>/etc/sysconfig/language</tt>.</p>" ) }, "keytable" => { "widget" => :combobox, "opt" => [:hstretch, :notify, :editable], # textentry label "label" => _("&Keyboard Layout"), "init" => fun_ref(method(:InitKeytableCombo), "void (string)"), "store" => fun_ref(method(:StorePreferences), "void (string, map)"), "handle" => fun_ref( method(:HandlePreferences), "symbol (string, map)" ), # help text for keytable "help" => _( "<p><b>Keyboard Layout</b> specifies the name of the console keymap to use. The value corresponds to a map file in <tt>/usr/share/kbd/keymaps</tt>.</p>" ) }, "timezone" => { "widget" => :combobox, "opt" => [:hstretch, :notify], "items" => [], # textentry label "label" => _("&Time Zone"), "init" => fun_ref(method(:InitTimezoneCombo), "void (string)"), "store" => fun_ref(method(:StorePreferences), "void (string, map)"), "handle" => fun_ref( method(:HandlePreferences), "symbol (string, map)" ), # help text for timezone "help" => _( "<p>It is possible to set a specific <b>Time zone</b>. Available time zones are located in the <tt>/usr/share/zoneinfo</tt> directory.</p>" ) }, # ---------------- widgtes for users tab "general_users" => { "widget" => :empty, # general help for users tab "help" => _( "<p>Create users that should be available on the target system.</p>" ) }, "userstable" => { "widget" => :custom, "custom_widget" => Table( Id("table"), Opt(:notify), Header( # table header _("Login Name"), # table header _("Full Name"), # table header _("UID"), # table header _("Home Directory"), # table header _("Group"), # table header _("GID") ) ), # help for table with users "help" => _( "<p>For each user, specify the <b>Name</b>, <b>Password</b>, <b>Home Directory</b> and group\nto which the users belongs.</p>\n" ), "init" => fun_ref(method(:InitUsersTable), "void (string)"), "handle" => fun_ref( method(:HandleAddEditUser), "symbol (string, map)" ) }, "adduser" => { "widget" => :push_button, "label" => Label.AddButton, "no_help" => true, "handle" => fun_ref( method(:HandleAddEditUser), "symbol (string, map)" ) }, "edituser" => { "widget" => :push_button, "label" => Label.EditButton, "no_help" => true, "handle" => fun_ref( method(:HandleAddEditUser), "symbol (string, map)" ) }, "deleteuser" => { "widget" => :push_button, "label" => Label.DeleteButton, "no_help" => true, "handle" => fun_ref( method(:HandleDeleteUser), "symbol (string, map)" ) } } end |
- (Object) GetAvailableImages(subdir)
read available the images under /usr/share/kiwi/image/ directory
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 81 def GetAvailableImages(subdir) ret = [] dir = "/usr/share/kiwi/image/" out = Convert.to_map( SCR.Execute( path(".target.bash_output"), Builtins.sformat("ls %1/%2", dir, subdir) ) ) return deep_copy(ret) if Ops.get_integer(out, "exit", 0) != 0 Builtins.foreach( Builtins.splitstring(Ops.get_string(out, "stdout", ""), "\n") ) do |file| if file != "" && FileUtils.IsDirectory( Builtins.sformat("%1/%2/%3", dir, subdir, file) ) ret = Builtins.add( ret, Item( Id(file), file, file == Ops.get_string(@KiwiConfig, subdir, "") ) ) end end deep_copy(ret) end |
- (Object) HandleAddEditUser(key, event)
Handle changes in users table
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1052 def HandleAddEditUser(key, event) event = deep_copy(event) if Ops.get(event, "ID") != key && (key != "userstable" || Ops.get(event, "ID") != "table") return nil end key = "edituser" if key == "userstable" current_user = Convert.to_string( UI.QueryWidget(Id("table"), :CurrentItem) ) user_map = {} group_map = {} if key == "edituser" Builtins.foreach(Ops.get_list(@KiwiConfig, "users", [])) do |gmap| user_map = Builtins.find(Ops.get_list(gmap, "user", [])) do |umap| current_user == Ops.get_string(umap, "name", "") end if user_map != {} && user_map != nil group_map = deep_copy(gmap) raise Break end end end # store original names user = Ops.get_string(user_map, "name", "") group = Ops.get_string(group_map, "group", "") UI.OpenDialog( Opt(:decorated), HBox( HSpacing(0.5), VBox( VSpacing(0.5), # popup label Label(Id(:label), _("Add New User")), # text entry label InputField(Id(:username), Opt(:hstretch), _("Login &Name")), # text entry label InputField(Id("realname"), Opt(:hstretch), _("&Full Name")), Password(Id(:pw1), Opt(:hstretch), Label.Password, ""), Password(Id(:pw2), Opt(:hstretch), Label.ConfirmPassword, ""), # text entry label InputField(Id("home"), Opt(:hstretch), _("&Home Directory")), # text entry label InputField(Id("id"), Opt(:hstretch), _("&UID")), HBox( # text entry label InputField(Id(:group), Opt(:hstretch), _("G&roup Name")), # text entry label InputField(Id(:gid), Opt(:hstretch), _("&GID")) ), HBox( PushButton(Id(:ok), Opt(:key_F10), Label.OKButton), PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton) ), VSpacing(0.5) ), HSpacing(0.5) ) ) UI.ChangeWidget(Id("id"), :ValidChars, String.CDigit) UI.ChangeWidget(Id(:gid), :ValidChars, String.CDigit) if key == "edituser" UI.ChangeWidget(Id(:username), :Value, current_user) UI.ChangeWidget( Id("realname"), :Value, Ops.get_string(user_map, "realname", "") ) UI.ChangeWidget( Id("home"), :Value, Ops.get_string(user_map, "home", "") ) UI.ChangeWidget(Id("id"), :Value, Ops.get_string(user_map, "id", "")) UI.ChangeWidget(Id(:gid), :Value, Ops.get_string(group_map, "id", "")) UI.ChangeWidget( Id(:group), :Value, Ops.get_string(group_map, "group", "") ) if Ops.get_string(user_map, "password", "") != "" UI.ChangeWidget(Id(:pw1), :Value, user_map["password"]) UI.ChangeWidget(Id(:pw2), :Value, user_map["password"]) end # popup label UI.ChangeWidget(Id(:label), :Value, _("Edit User")) end ret = nil begin ret = UI.UserInput if ret == :ok username = Convert.to_string(UI.QueryWidget(Id(:username), :Value)) password = Convert.to_string(UI.QueryWidget(Id(:pw1), :Value)) new_group = Convert.to_string(UI.QueryWidget(Id(:group), :Value)) gid = Convert.to_string(UI.QueryWidget(Id(:gid), :Value)) if username == "" # popup message Report.Error(_("Enter the user name.")) ret = :notnext next end if password != UI.QueryWidget(Id(:pw2), :Value) # popup message Report.Error(_("The passwords do not match.\nTry again.")) ret = :notnext next end # ok, now update the structures user_map = { "password" => password, "encrypted" => Ops.get_boolean(user_map, "encrypted", false) && password == Ops.get_string(user_map, "password", ""), "name" => username } Builtins.foreach(["home", "realname", "id"]) do |key2| if UI.QueryWidget(Id(key2), :Value) != "" Ops.set(user_map, key2, UI.QueryWidget(Id(key2), :Value)) end end new_group = username == "root" ? "root" : "users" if new_group == "" group_modified = false Ops.set( @KiwiConfig, "users", Builtins.maplist(Ops.get_list(@KiwiConfig, "users", [])) do |gmap| # the group is already defined if Ops.get_string(gmap, "group", "") == new_group Ops.set(gmap, "id", gid) if gid != "" user_modified = false Ops.set( gmap, "user", Builtins.maplist(Ops.get_list(gmap, "user", [])) do |umap| if Ops.get(umap, "name") == user || Ops.get(umap, "name") == username umap = deep_copy(user_map) user_modified = true end deep_copy(umap) end ) if !user_modified Ops.set( gmap, "user", Builtins.add(Ops.get_list(gmap, "user", []), user_map) ) end group_modified = true # remove user from original group (= group was 'renamed') elsif Ops.get_string(gmap, "group", "") == group Ops.set( gmap, "user", Builtins.filter(Ops.get_list(gmap, "user", [])) do |umap| Ops.get(umap, "name") != user end ) end deep_copy(gmap) end ) if !group_modified if Ops.get_list(@KiwiConfig, "users", []) == [] Ops.set(@KiwiConfig, "users", []) end group_map = { "group" => new_group, "user" => [user_map] } Ops.set(group_map, "id", gid) if gid != "" Ops.set( @KiwiConfig, "users", Builtins.add(Ops.get_list(@KiwiConfig, "users", []), group_map) ) end # remove empty groups Ops.set( @KiwiConfig, "users", Builtins.filter(Ops.get_list(@KiwiConfig, "users", [])) do |gmap| Ops.get_list(gmap, "user", []) != [] end ) end end until ret == :ok || ret == :cancel UI.CloseDialog InitUsersTable("table") if ret == :ok nil end |
- (Object) HandleAddToConfigDir(key, event)
add new subdir to the 'config' directory
1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1343 def HandleAddToConfigDir(key, event) event = deep_copy(event) return nil if Ops.get(event, "ID") != key # popup for file selection dialog dir = UI.AskForExistingFile("", "", _("Script to Import")) if dir != nil Ops.set( @KiwiConfig, "config_dir", Builtins.union(Ops.get_list(@KiwiConfig, "config_dir", []), [dir]) ) InitConfigDirTable("configtable") end nil end |
- (Object) HandleAddToRootDir(key, event)
add new subdir to the 'root' directory
1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1295 def HandleAddToRootDir(key, event) event = deep_copy(event) return nil if Ops.get(event, "ID") != key # popup for file selection dialog dir = UI.AskForExistingDirectory("", _("Directory to Import")) if dir != nil Ops.set( @KiwiConfig, "root_dir", Builtins.union(Ops.get_list(@KiwiConfig, "root_dir", []), [dir]) ) InitRootDirTable("roottable") end nil end |
- (Object) HandleBootCombo(key, event)
handler for combo box with boot items
701 702 703 704 705 706 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 701 def HandleBootCombo(key, event) event = deep_copy(event) # store the value on exiting StoreBootCombo(key, event) if Ops.get(event, "ID") == :next nil end |
- (Object) HandleBrowseConfigDirectory(key, event)
handler for 'config' directory browse
1397 1398 1399 1400 1401 1402 1403 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1397 def HandleBrowseConfigDirectory(key, event) event = deep_copy(event) return nil if Ops.get(event, "ID") != key # popup for file selection dialog ('config' is a name, do not translate) BrowseDirectoryHandler("config_dir", _("Path to config Directory")) nil end |
- (Object) HandleBrowseRootDirectory(key, event)
handler for 'root' directory browse
1388 1389 1390 1391 1392 1393 1394 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1388 def HandleBrowseRootDirectory(key, event) event = deep_copy(event) return nil if Ops.get(event, "ID") != key # popup for file selection dialog ('root' is a name, do not translate) BrowseDirectoryHandler("root_dir", _("Path to root Directory")) nil end |
- (Object) HandleCompressionCombo(key, event)
164 165 166 167 168 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 164 def HandleCompressionCombo(key, event) event = deep_copy(event) StoreCompressionCombo(key, event) if Ops.get(event, "ID") == :next nil end |
- (Object) HandleDeleteFromConfigDir(key, event)
delete subdir from the 'config' directory
1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1360 def HandleDeleteFromConfigDir(key, event) event = deep_copy(event) return nil if Ops.get(event, "ID") != key current = Convert.to_string(UI.QueryWidget(Id("configtable"), :Value)) Ops.set( @KiwiConfig, "config_dir", Builtins.filter(Ops.get_list(@KiwiConfig, "config_dir", [])) do |f| f != current end ) InitConfigDirTable("configtable") nil end |
- (Object) HandleDeleteFromRootDir(key, event)
delete subdir from the 'root' directory
1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1312 def HandleDeleteFromRootDir(key, event) event = deep_copy(event) return nil if Ops.get(event, "ID") != key current = Convert.to_string(UI.QueryWidget(Id("roottable"), :Value)) Ops.set( @KiwiConfig, "root_dir", Builtins.filter(Ops.get_list(@KiwiConfig, "root_dir", [])) do |f| f != current end ) InitRootDirTable("roottable") nil end |
- (Object) HandleDeleteUser(key, event)
handle delete user button
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1246 def HandleDeleteUser(key, event) event = deep_copy(event) return nil if Ops.get(event, "ID") != key current_user = Convert.to_string( UI.QueryWidget(Id("table"), :CurrentItem) ) is_empty = false Ops.set( @KiwiConfig, "users", Builtins.maplist(Ops.get_list(@KiwiConfig, "users", [])) do |gmap| Ops.set(gmap, "user", Builtins.filter(Ops.get_list(gmap, "user", [])) do |umap| Ops.get_string(umap, "name", "") != current_user end) is_empty = true if Builtins.size(Ops.get_list(gmap, "user", [])) == 0 deep_copy(gmap) end ) if is_empty # remove empty groups Ops.set( @KiwiConfig, "users", Builtins.filter(Ops.get_list(@KiwiConfig, "users", [])) do |gmap| Ops.get_list(gmap, "user", []) != [] end ) end InitUsersTable("table") nil end |
- (Object) HandleDescription(key, event)
handler for string-value “description” related widgets: store on exit/save
878 879 880 881 882 883 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 878 def HandleDescription(key, event) event = deep_copy(event) # store the value on exiting StoreDescription(key, event) if Ops.get(event, "ID") == :next nil end |
- (Object) HandleDiskPassword(key, event)
213 214 215 216 217 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 213 def HandleDiskPassword(key, event) event = deep_copy(event) StoreDiskPassword(key, event) if Ops.get(event, "ID") == :next nil end |
- (Object) HandleEncryptDisk(key, event)
219 220 221 222 223 224 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 219 def HandleEncryptDisk(key, event) event = deep_copy(event) value = Convert.to_boolean(UI.QueryWidget(Id(key), :Value)) UI.ChangeWidget(Id("disk_password"), :Enabled, value) nil end |
- (Object) HandleGeneric(key, event)
handler for general string-value widgets: store their value on exit/save
847 848 849 850 851 852 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 847 def HandleGeneric(key, event) event = deep_copy(event) # store the value on exiting StoreGeneric(key, event) if Ops.get(event, "ID") == :next nil end |
- (Object) HandleImportConfigFile(key, event)
Handler for importing config.sh file
1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1416 def HandleImportConfigFile(key, event) event = deep_copy(event) return nil if Ops.get(event, "ID") != key name = Builtins.substring(key, 7) # removing 'import_' button id prefix # popup for file selection dialog file = BrowseFileHandler( name, Builtins.sformat(_("Path to %1 File"), name) ) if file != nil if FileUtils.Exists(file) cont = Convert.to_string(SCR.Read(path(".target.string"), file)) if cont != nil UI.ChangeWidget(Id(name), :Value, cont) StoreGeneric(name, event) end end end nil end |
- (Object) HandleImportImagesFile(key, event)
Handler for importing images.sh file TODO same function as HandleImportConfigFile
1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1439 def HandleImportImagesFile(key, event) event = deep_copy(event) return nil if Ops.get(event, "ID") != key # popup for file selection dialog file = BrowseFileHandler("images.sh", _("Path to images.sh File")) if file != nil if FileUtils.Exists(file) imagessh = Convert.to_string(SCR.Read(path(".target.string"), file)) if imagessh != nil UI.ChangeWidget(Id("images.sh"), :Value, imagessh) StoreGeneric("images.sh", event) end end end nil end |
- (Object) HandlePreferences(key, event)
handler for string-value “preferences” related widgets: store on exit/save
1008 1009 1010 1011 1012 1013 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1008 def HandlePreferences(key, event) event = deep_copy(event) # store the value on exiting StorePreferences(key, event) if Ops.get(event, "ID") == :next nil end |
- (Object) HandleSize(key, event)
handler for size widget: store value on exit/save
808 809 810 811 812 813 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 808 def HandleSize(key, event) event = deep_copy(event) # store the value on exiting StoreSize(key, event) if Ops.get(event, "ID") == :next nil end |
- (Object) HandleSWDelete(key, event)
319 320 321 322 323 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 319 def HandleSWDelete(key, event) event = deep_copy(event) StoreSWDelete(key, event) if Ops.get(event, "ID") == :next nil end |
- (Object) HandleSWIgnore(key, event)
261 262 263 264 265 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 261 def HandleSWIgnore(key, event) event = deep_copy(event) StoreSWIgnore(key, event) if Ops.get(event, "ID") == :next nil end |
- (Object) HandleSWSelection(key, event)
Handler for software selection
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 539 def HandleSWSelection(key, event) event = deep_copy(event) if Ops.get(event, "ID") == key package_set = Ops.get_integer(@KiwiConfig, "package_set", 0) bootinclude = false if Ops.get(@index2package_set, package_set, "") == "bootinclude" package_set = Ops.get(@package_set2index, "image", 0) bootinclude = true end sw_contents = Ops.get_map(@KiwiConfig, ["packages", package_set], {}) packages_before = {} # separate bootinclude packages from normal ones bi_packages = [] Ops.set( sw_contents, "package", Builtins.filter(Ops.get_list(sw_contents, "package", [])) do |p| Ops.set(packages_before, Ops.get_string(p, "name", ""), true) if Ops.get_string(p, "bootinclude", "") == "true" bi_packages = Builtins.add(bi_packages, p) end Ops.get_string(p, "bootinclude", "") != "true" end ) if bootinclude bi_packages = modifyBootIncludePackages(bi_packages) else again = true while again sw_contents = modifyPackageSelection(sw_contents) again = CheckForDeletedPackages(packages_before) if again && Popup.YesNo( _( "Some of the packages that are selected for installation\n" + "are also included in the list for deletion.\n" + "Continue anyway?" ) ) again = false end end end if sw_contents != nil && bi_packages != nil Ops.set( sw_contents, "package", Builtins.union( Ops.get_list(sw_contents, "package", []), bi_packages ) ) Ops.set(@KiwiConfig, ["packages", package_set], sw_contents) end InitSWRichText("rt_sw") end nil end |
- (Object) HandleSWSelectionCombo(key, event)
handler for combo box with package sets items
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 664 def HandleSWSelectionCombo(key, event) event = deep_copy(event) id = Ops.get(event, "ID") # store the value on exiting if id == :next StoreSWSelectionCombo(key, event) elsif Ops.get(event, "ID") == key selected = Convert.to_integer(UI.QueryWidget(Id(key), :Value)) if selected != Ops.get_integer(@KiwiConfig, "package_set", -1) Ops.set(@KiwiConfig, "package_set", selected) StoreSWSelectionCombo(key, event) InitSWRichText("rt_sw") end end nil end |
- (Object) HandleVersion(key, event)
handler for version
739 740 741 742 743 744 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 739 def HandleVersion(key, event) event = deep_copy(event) # store the value on exiting StoreVersion(key, event) if Ops.get(event, "ID") == :next nil end |
- (Object) InitBootCombo(id)
initialize the value of combo box with boot items
683 684 685 686 687 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 683 def InitBootCombo(id) UI.ChangeWidget(Id(id), :Items, GetAvailableImages(id)) nil end |
- (Object) InitCompressionCombo(id)
**************************************************************************** widget handlers **************************************************************************
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 115 def InitCompressionCombo(id) current_method = "none" Builtins.foreach( Ops.get_list(@KiwiConfig, ["preferences", 0, "type"], []) ) do |typemap| if Ops.get_string(typemap, "image", "") == @kiwi_task current_method = Ops.get_string(typemap, "flags", current_method) end end methods = { "unified" => "unified", "compressed" => "compressed", "clic" => "clic", # combo box label "none" => _("None") } items = Builtins.maplist(methods) do |method, label| Item(Id(method), label, method == current_method) end UI.ChangeWidget(Id(id), :Items, items) nil end |
- (Object) InitConfigDirTable(id)
initialize the table with config dir contents
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1328 def InitConfigDirTable(id) items = Builtins.maplist(Ops.get_list(@KiwiConfig, "config_dir", [])) do |file| Item(Id(file), file) end UI.ChangeWidget(Id("configtable"), :Items, items) UI.ChangeWidget( Id("config_dir_delete"), :Enabled, Ops.greater_than(Builtins.size(items), 0) ) nil end |
- (Object) InitDescription(id)
initialize the string value of “description” related widget
855 856 857 858 859 860 861 862 863 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 855 def InitDescription(id) UI.ChangeWidget( Id(id), :Value, Ops.get_string(@KiwiConfig, ["description", 0, id, 0, @content_key], "") ) nil end |
- (Object) InitDiskPassword(id)
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 170 def InitDiskPassword(id) disk_password = "" Builtins.foreach( Ops.get_list(@KiwiConfig, ["preferences", 0, "type"], []) ) do |typemap| if Ops.get_string(typemap, "image", "") == @kiwi_task disk_password = Ops.get_string(typemap, "luks", disk_password) end end UI.ChangeWidget(Id(id), :Value, disk_password) UI.ChangeWidget(Id(id), :Enabled, disk_password != "") UI.ChangeWidget(Id("encrypt_disk"), :Value, disk_password != "") nil end |
- (Object) InitGeneric(id)
universal widget: initialize the string value of widget @param
828 829 830 831 832 833 834 835 836 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 828 def InitGeneric(id) UI.ChangeWidget(Id(id), :Value, Ops.get_string(@KiwiConfig, id, "")) if (id == "config.sh" || id == "images.sh") && Builtins.haskey(@KiwiConfig, "root/build-custom") UI.ChangeWidget(Id(id), :Enabled, false) end nil end |
- (Object) initialize_product_creator_kiwi_dialogs(include_target)
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 30 def initialize_product_creator_kiwi_dialogs(include_target) Yast.import "Pkg" Yast.import "UI" textdomain "product-creator" Yast.import "Arch" Yast.import "CWM" Yast.import "CWMTab" Yast.import "Directory" Yast.import "FileUtils" Yast.import "Keyboard" Yast.import "Kiwi" Yast.import "Label" Yast.import "Message" Yast.import "Package" Yast.import "PackageLock" Yast.import "PackageSystem" Yast.import "Popup" Yast.import "ProductCreator" Yast.import "SourceDialogs" Yast.import "SourceManager" Yast.import "String" Yast.import "Summary" Yast.import "URL" Yast.import "Wizard" Yast.include include_target, "product-creator/dialogs.rb" Yast.include include_target, "product-creator/routines.rb" # map of current image configuration @KiwiConfig = {} # what are we configuring now ("iso"/"xen"/...) @kiwi_task = "" @content_key = Kiwi.content_key @section_type_label = { "image" => _("Packages for Image"), "bootstrap" => _("Bootstrap"), "xen" => _("Xen Specific Packages") } # map indexes of packages sets to their names # (package set is indexed in the sets list) @index2package_set = {} @package_set2index = {} end |
- (Object) InitImageConfiguration
Global init function for Kiwi image dialog - read saved settings and fill in defaults
1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1807 def InitImageConfiguration @kiwi_task = Kiwi.kiwi_task # path to definition of openSUSE live CD (used if kiwi-config-openSUSE is installed) kiwi_dir = "/usr/share/openSUSE-kiwi/livecd-x11" # read the information from the base product src_id = ProductCreator.checkProductDependency content = ProductCreator.ReadContentFile(src_id) @KiwiConfig = deep_copy(ProductCreator.Config) # busy popup Popup.ShowFeedback( _("Reading current image configuration..."), _("Please wait...") ) # path to current config directory default_dir = @kiwi_task == "iso" ? kiwi_dir : "" kiwi_configuration = Ops.get_string( @KiwiConfig, Ops.add("kiwi_configuration_", @kiwi_task), default_dir ) if kiwi_configuration == "" || !FileUtils.Exists(kiwi_configuration) # use local template if default dir does not exist (bug #289552) if !FileUtils.Exists(default_dir) default_dir = Ops.add( Directory.datadir, "/product-creator/kiwi_templates/" ) default_dir = Ops.add( default_dir, @kiwi_task == "xen" ? "xen" : "iso" ) end Builtins.y2warning( "directory %1 is not available, using %2", kiwi_configuration, default_dir ) kiwi_configuration = default_dir end if FileUtils.Exists(Ops.add(kiwi_configuration, "/root")) # read all entries from root_dir and save to list out2 = Convert.to_map( SCR.Execute( path(".target.bash_output"), Builtins.sformat( "ls -A1 -d %1/root/* 2>/dev/null", kiwi_configuration ) ) ) Ops.set( @KiwiConfig, "root_dir", Builtins.filter( Builtins.splitstring(Ops.get_string(out2, "stdout", ""), "\n") ) do |f| f != "" && f != Ops.add(kiwi_configuration, "/root/build-custom") end ) end if FileUtils.Exists(Ops.add(kiwi_configuration, "/config")) out2 = Convert.to_map( SCR.Execute( path(".target.bash_output"), Builtins.sformat( "ls -A1 -d %1/config/* 2>/dev/null", kiwi_configuration ) ) ) Ops.set( @KiwiConfig, "config_dir", Builtins.filter( Builtins.splitstring(Ops.get_string(out2, "stdout", ""), "\n") ) { |f| f != "" } ) end # existence of manifesto.xml means studio-generated configuration if FileUtils.Exists( Ops.add(kiwi_configuration, "/root/studio/manifesto.xml") ) Ops.set(@KiwiConfig, "root/build-custom", "") end Builtins.foreach(["images.sh", "config.sh", "root/build-custom"]) do |file| file_path = Ops.add(Ops.add(kiwi_configuration, "/"), file) if FileUtils.Exists(file_path) contents = Convert.to_string( SCR.Read(path(".target.string"), file_path) ) Ops.set(@KiwiConfig, file, contents) if contents != nil end end # take care of the rest in the input directory (#330052) import_files = [] out = Convert.to_map( SCR.Execute( path(".target.bash_output"), Builtins.sformat("ls -A1 -d %1/* 2>/dev/null", kiwi_configuration) ) ) Builtins.foreach( Builtins.splitstring(Ops.get_string(out, "stdout", ""), "\n") ) do |line| next if line == "" last = Builtins.substring( line, Ops.add(Builtins.findlastof(line, "/"), 1) ) if Builtins.contains( ["images.sh", "config.sh", "config.xml", "root", "config"], last ) next end import_files = Builtins.add(import_files, line) end Ops.set(@KiwiConfig, "import_files", import_files) read_config = Kiwi.ReadConfigXML(kiwi_configuration) if !Ops.get_boolean(@KiwiConfig, "_imported", false) # "type" had different meaning in ProductCreator::Config... if Builtins.haskey(@KiwiConfig, "type") @KiwiConfig = Builtins.remove(@KiwiConfig, "type") end @KiwiConfig = Convert.convert( Builtins.union(@KiwiConfig, read_config), :from => "map", :to => "map <string, any>" ) # do not read everything from the template, use the data defined in # Product Creator Builtins.y2milestone("product-creator based configuration...") Ops.set( @KiwiConfig, "sources", Ops.get_list(ProductCreator.Config, "sources", []) ) # find the set with 'image' packages index = 0 i = -1 Builtins.foreach(Ops.get_list(@KiwiConfig, "packages", [])) do |set| i = Ops.add(i, 1) if Ops.get_string(set, "type", "") == "image" index = i raise Break end end sw_contents = Ops.get_map(@KiwiConfig, ["packages", index], {}) Ops.set( sw_contents, "namedCollection", Builtins.maplist(Ops.get_list(ProductCreator.Config, "addons", [])) do |name2| { "name" => name2 } end ) Ops.set( sw_contents, "package", Builtins.maplist(Ops.get_list(ProductCreator.Config, "packages", [])) do |name2| { "name" => name2 } end ) Ops.set( sw_contents, "ignore", Builtins.maplist(Ops.get_list(ProductCreator.Config, "taboo", [])) do |name2| { "name" => name2 } end ) Ops.set(@KiwiConfig, ["packages", index], sw_contents) Ops.set( @KiwiConfig, "name", Ops.get_string(ProductCreator.Config, "name", "") ) else Builtins.y2milestone("imported configuration...") # ignore options already set earlier... Builtins.foreach(read_config) do |key, val| if !Builtins.contains( ["name", "sources", "version", "preferences"], key ) Ops.set(@KiwiConfig, key, val) end end pref = Ops.get_list(@KiwiConfig, "preferences", []) # new configuration doesn't get preferences at all... if pref == [] pref = Ops.get_list(read_config, "preferences", []) Ops.set(pref, [0, "version"], [{ @content_key => "1.0.0" }]) Ops.set(@KiwiConfig, "preferences", pref) # FIXME check if boot directories match current product (-> enable building # for product different from installed one) else # existing defaultdestination needs to be used as iso-dirctory as well # (correct iso-directory was replaced on import (bnc#499489) dest = get_preferences(@KiwiConfig, "defaultdestination", "") Ops.set(@KiwiConfig, "iso-directory", dest) if dest != "" end primary_included = false boot_dir = "" # set the primary building target according to kiwi_task Ops.set( @KiwiConfig, ["preferences", 0, "type"], Builtins.maplist(Ops.get_list(pref, [0, "type"], [])) do |typemap| type = Ops.get_string(typemap, "image", "") if Builtins.tolower(Ops.get_string(typemap, "primary", "false")) == "true" && type != @kiwi_task typemap = Builtins.remove(typemap, "primary") elsif type == @kiwi_task Ops.set(typemap, "primary", "true") primary_included = true end boot_dir = Ops.get_string(typemap, "boot", "") if boot_dir == "" deep_copy(typemap) end ) # add the new type, that was not previously defined in config.xml # read the default values for this type from the template if !primary_included if default_dir == "" default_dir = Ops.add( Directory.datadir, "/product-creator/kiwi_templates/" ) default_dir = Ops.add( default_dir, @kiwi_task == "xen" ? "xen" : "iso" ) end def_map = Kiwi.ReadConfigXML(default_dir) Builtins.foreach( Ops.get_list(def_map, ["preferences", 0, "type"], []) ) do |typemap| if Ops.get_string(typemap, "image", "") == @kiwi_task Ops.set( @KiwiConfig, ["preferences", 0, "type"], Builtins.add( Ops.get_list(@KiwiConfig, ["preferences", 0, "type"], []), typemap ) ) raise Break end end end # save the info about packages and patterns into ProductCreator::Config # ("sources" are already there...) sw_contents = Ops.get_map(@KiwiConfig, ["packages", 0], {}) Ops.set( ProductCreator.Config, "addons", Builtins.maplist(Ops.get_list(sw_contents, "namedCollection", [])) do |pat| Ops.get_string(pat, "name", "") end ) Ops.set( ProductCreator.Config, "packages", Builtins.maplist(Ops.get_list(sw_contents, "package", [])) do |pat| Ops.get_string(pat, "name", "") end ) Ops.set( ProductCreator.Config, "taboo", Builtins.maplist(Ops.get_list(sw_contents, "ignore", [])) do |pat| Ops.get_string(pat, "name", "") end ) end label2boot = { "openSUSE 11.0" => "suse-11.0", "openSUSE 11.1" => "suse-11.1", "SUSE Linux Enterprise Server 10" => "suse-SLES10", "SUSE Linux Enterprise Desktop 10" => "suse-SLED10", "SUSE Linux Enterprise Desktop 10 SP2" => "suse-SLED10-SP2", "SUSE Linux Enterprise Server 10 SP2" => "suse-SLES10-SP2", "SUSE Linux Enterprise Server 11" => "suse-SLES11", "SUSE Linux Enterprise Desktop 11" => "suse-SLED11" } contentlabel = String.CutBlanks(Ops.get(content, "LABEL", "")) boot_image = Ops.get_string(label2boot, contentlabel, "") # guess some default boot image value if @kiwi_task == "iso" && !Builtins.haskey(@KiwiConfig, "isoboot") && boot_image != "" Ops.set(@KiwiConfig, "isoboot", boot_image) elsif @kiwi_task == "vmx" if !Builtins.haskey(@KiwiConfig, "vmxboot") && boot_image != "" Ops.set(@KiwiConfig, "vmxboot", boot_image) end elsif @kiwi_task == "xen" if !Builtins.haskey(@KiwiConfig, "xenboot") Ops.set(@KiwiConfig, "xenboot", boot_image) end end name = Ops.get_string(@KiwiConfig, "name", "") Popup.ClearFeedback nil end |
- (Object) InitKeytableCombo(id)
initialize the list value of “keytable” combo box
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 916 def InitKeytableCombo(id) kb = Ops.get_string( @KiwiConfig, ["preferences", 0, id, 0, @content_key], "" ) items = [] kb_present = false Builtins.foreach(Keyboard.keymap2yast) do |name, yast| items = Builtins.add(items, Item(Id(name), name, kb == name)) kb_present = true if kb == name end items = Builtins.add(items, Item(Id(kb), kb, true)) if !kb_present UI.ChangeWidget(Id(id), :Items, items) nil end |
- (Object) InitLabel(id)
initialize the product label
816 817 818 819 820 821 822 823 824 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 816 def InitLabel(id) UI.ChangeWidget( Id("name"), :Value, Ops.get_string(@KiwiConfig, "name", "") ) nil end |
- (Object) InitLocaleCombo(id)
initialize the list value of “locale” combo box
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 886 def InitLocaleCombo(id) lang = Ops.get_string( @KiwiConfig, ["preferences", 0, id, 0, @content_key], "" ) items = [Item(Id("none"), "---", false)] if Kiwi.all_locales == {} out = Convert.to_map( SCR.Execute(path(".target.bash_output"), "/usr/bin/locale -a") ) Builtins.foreach( Builtins.splitstring(Ops.get_string(out, "stdout", ""), "\n") ) do |line| code = Ops.get(Builtins.splitstring(line, ".@"), 0, line) if code != "" && code != "C" && code != "POSIX" Ops.set(Kiwi.all_locales, code, 1) end end end Builtins.foreach(Kiwi.all_locales) do |code, i| items = Builtins.add(items, Item(Id(code), code, lang == code)) end UI.ChangeWidget(Id(id), :Items, items) nil end |
- (Object) InitPreferences(id)
initialize the string value of “preferences” related widget
968 969 970 971 972 973 974 975 976 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 968 def InitPreferences(id) UI.ChangeWidget( Id(id), :Value, Ops.get_string(@KiwiConfig, ["preferences", 0, id, 0, @content_key], "") ) nil end |
- (Object) InitRootDirTable(id)
initialize the table with root dir contents
1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1280 def InitRootDirTable(id) items = Builtins.maplist(Ops.get_list(@KiwiConfig, "root_dir", [])) do |file| Item(Id(file), file) end UI.ChangeWidget(Id("roottable"), :Items, items) UI.ChangeWidget( Id("root_dir_delete"), :Enabled, Ops.greater_than(Builtins.size(items), 0) ) nil end |
- (Object) InitSize(id)
initialize the values of “size”, “sizeunit” and “additive” widgets
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 747 def InitSize(id) size_map = get_current_size_map(@KiwiConfig, @kiwi_task) siz = 0 if Builtins.haskey(size_map, Kiwi.content_key) siz = Builtins.tointeger( Ops.get_string(size_map, Kiwi.content_key, "0") ) else siz = Builtins.tointeger(Kiwi.default_size) if Ops.get_string(size_map, "additive", "") == "" Ops.set(size_map, "additive", "true") end end UI.ChangeWidget(Id("size"), :Value, siz) UI.ChangeWidget( Id("additive"), :Value, Ops.get_string(size_map, "additive", "") == "true" ) UI.ChangeWidget(Id("sizeunit"), :Items, Builtins.maplist(["M", "G"]) do |u| Item(Id(u), Ops.add(u, "B"), Ops.get_string(size_map, "unit", "M") == u) end) nil end |
- (Object) InitSWDelete(id)
Initialize the widget with packages intended for deletion
268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 268 def InitSWDelete(id) to_delete = [] Builtins.foreach(Ops.get_list(@KiwiConfig, "packages", [])) do |pmap| type = Ops.get_string(pmap, "type", "") if type == "delete" to_delete = Builtins.maplist(Ops.get_list(pmap, "package", [])) do |pacmap| Ops.get_string(pacmap, "name", "") end end end UI.ChangeWidget(Id(id), :Value, Builtins.mergestring(to_delete, "\n")) nil end |
- (Object) InitSWIgnore(id)
Initialize the widget with ignored packages
227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 227 def InitSWIgnore(id) sw_selection = Ops.get_string(@KiwiConfig, "sw_selection", "image") ignore_key = sw_selection == "image" ? "ignore" : Ops.add(sw_selection, "_ignore") UI.ChangeWidget( Id(id), :Value, Builtins.mergestring(Ops.get_list(@KiwiConfig, ignore_key, []), "\n") ) nil end |
- (Object) InitSWRichText(id)
Initialize the contents of richtext with selected software
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 326 def InitSWRichText(id) package_set = Ops.get_integer(@KiwiConfig, "package_set", 0) rt = "" packages = Ops.get_list(@KiwiConfig, "packages", []) pat = "" pac = "" ign = "" if Ops.get(@index2package_set, package_set, "") == "bootinclude" package_set = Ops.get(@package_set2index, "image", 0) if Ops.greater_than( Builtins.size(Ops.get_list(packages, [package_set, "package"], [])), 0 ) # richtext header pac = Summary.AddHeader("", _("Packages")) end Builtins.foreach(Ops.get_list(packages, [package_set, "package"], [])) do |pacmap| if Ops.get_string(pacmap, "bootinclude", "") == "true" pac = Summary.AddListItem(pac, Ops.get_string(pacmap, "name", "")) end end UI.ChangeWidget(Id(id), :Value, Ops.add(Ops.add(pat, pac), ign)) return end if Ops.greater_than( Builtins.size( Ops.get_list(packages, [package_set, "namedCollection"], []) ), 0 ) # richtext header pat = Summary.AddHeader("", _("Patterns")) end Builtins.foreach( Ops.get_list(packages, [package_set, "namedCollection"], []) ) do |patmap| pat = Summary.AddListItem(pat, Ops.get_string(patmap, "name", "")) end if Ops.greater_than( Builtins.size(Ops.get_list(packages, [package_set, "package"], [])), 0 ) # richtext header pac = Summary.AddHeader("", _("Packages")) end Builtins.foreach(Ops.get_list(packages, [package_set, "package"], [])) do |pacmap| if Ops.get_string(pacmap, "bootinclude", "") != "true" pac = Summary.AddListItem(pac, Ops.get_string(pacmap, "name", "")) end end if Ops.greater_than( Builtins.size(Ops.get_list(packages, [package_set, "ignore"], [])), 0 ) ign = Summary.AddHeader( "", Builtins.deletechars(_("&Ignored Software"), "&") ) end Builtins.foreach(Ops.get_list(packages, [package_set, "ignore"], [])) do |pacmap| ign = Summary.AddListItem(ign, Ops.get_string(pacmap, "name", "")) end UI.ChangeWidget(Id(id), :Value, Ops.add(Ops.add(pat, pac), ign)) nil end |
- (Object) InitSWSelectionCombo(id)
initialize the combo box with package selection groups
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 603 def InitSWSelectionCombo(id) package_set = Ops.get_integer(@KiwiConfig, "package_set", 0) items = [] i = 0 Builtins.foreach(Ops.get_list(@KiwiConfig, "packages", [])) do |pmap| type = Ops.get_string(pmap, "type", "") # combo box label label = _("Packages for Image") if type == "delete" # combo box label label = _("Packages to Delete") i = Ops.add(i, 1) # index to list must be increased next # delete is handled by different widgets end Ops.set(@index2package_set, i, type) Ops.set(@package_set2index, type, i) if type == "bootstrap" # combo box label label = _("Bootstrap") elsif type == "xen" # combo box label label = _("Xen Specific Packages") elsif type == "testsuite" # combo box label label = _("Testing") elsif type != "image" label = type end if Ops.get_string(pmap, "profiles", "") != "" # combo box label, %1 is profile name label = Builtins.sformat( _("Image, Profile %1"), Ops.get_string(pmap, "profiles", "") ) end items = Builtins.add(items, Item(Id(i), label, package_set == i)) i = Ops.add(i, 1) end # combo box label items = Builtins.add( items, Item(Id(i), _("Include in Boot Image"), package_set == i) ) Ops.set(@index2package_set, i, "bootinclude") UI.ChangeWidget(Id(id), :Items, items) nil end |
- (Object) InitTimezoneCombo(id)
initialize the list value of “timezone” combo box
937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 937 def InitTimezoneCombo(id) tz = Ops.get_string( @KiwiConfig, ["preferences", 0, id, 0, @content_key], "" ) if Kiwi.all_timezones == [] out = Convert.to_map( SCR.Execute( path(".target.bash_output"), "grep -v '#' /usr/share/zoneinfo/zone.tab | cut -f 3 | sort", { "LANG" => "C" } ) ) Kiwi.all_timezones = Builtins.filter( Builtins.splitstring(Ops.get_string(out, "stdout", ""), "\n") ) { |t| t != "" } end items = Builtins.maplist(Kiwi.all_timezones) do |zone| Item(Id(zone), zone, tz == zone) end items = Builtins.prepend(items, Item(Id("none"), "---")) UI.ChangeWidget(Id(id), :Items, items) nil end |
- (Object) InitUsersTable(id)
initialize the table with users
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1016 def InitUsersTable(id) items = [] Builtins.foreach(Ops.get_list(@KiwiConfig, "users", [])) do |groupmap| group = Ops.get_string(groupmap, "group", "") gid = Ops.get_string(groupmap, "id", "") Builtins.foreach(Ops.get_list(groupmap, "user", [])) do |usermap| items = Builtins.add( items, Item( Id(Ops.get_string(usermap, "name", "")), Ops.get_string(usermap, "name", ""), Ops.get_string(usermap, "realname", ""), Ops.get_string(usermap, "id", ""), Ops.get_string(usermap, "home", ""), group, gid ) ) end end UI.ChangeWidget(Id("table"), :Items, items) UI.ChangeWidget( Id("edituser"), :Enabled, Ops.greater_than(Builtins.size(items), 0) ) UI.ChangeWidget( Id("deleteuser"), :Enabled, Ops.greater_than(Builtins.size(items), 0) ) nil end |
- (Object) InitVersion(id)
initialize the value of version
709 710 711 712 713 714 715 716 717 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 709 def InitVersion(id) UI.ChangeWidget( Id(id), :Value, get_preferences(@KiwiConfig, "version", "1.0.0") ) nil end |
- (Object) KiwiDialog
Main dialog for Kiwi image configuration
2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 2869 def KiwiDialog InitImageConfiguration() if CheckForAvailablePackages(true) != :selection CheckPackageDependencies() end = Ops.set( , "tab", CWMTab.CreateWidget( { "tab_order" => [ "config.xml", "description", "users", "scripts", "directories" ], "tabs" => tabs_descr, "widget_descr" => , "initial_tab" => "config.xml" } ) ) Wizard.SetContentsButtons( "", VBox(), "", Label.BackButton, Label.NextButton ) contents = VBox( Left(Label(Ops.get_string(@KiwiConfig, "name", ""))), "tab", VSpacing(0.3), "global" ) caption = { # dialog caption "iso" => _("Live CD Configuration"), # dialog caption "xen" => _("Xen Image Configuration"), # button label "vmx" => _("Virtual Disk Image") } = { # button label "iso" => _("&Create ISO"), # button label "xen" => _("&Create Xen Image"), # button label "vmx" => _("&Create Virtual Disk Image") } ret = CWM.ShowAndRun( { "widget_names" => ["global", "tab"], "widget_descr" => , "contents" => contents, # default dialog caption "caption" => Ops.get_locale( caption, @kiwi_task, _("Image Configuration") ), "back_button" => Label.BackButton, # "next_button" : next_button[kiwi_task]:Label::NextButton (), "next_button" => Label.FinishButton( ), "fallback_functions" => { :abort => fun_ref(ProductCreator.method(:ReallyAbort), "boolean ()") } } ) Builtins.y2milestone("Returning %1", ret) ret end |
- (Object) modifyBootIncludePackages(packages)
Popup for modifying the list of 'bootinclude' packages
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 454 def modifyBootIncludePackages(packages) packages = deep_copy(packages) UI.OpenDialog( Opt(:decorated), HBox( HSpacing(0.5), VSpacing(20), VBox( HSpacing(70), VSpacing(0.5), MultiLineEdit( Id(:bootinclude), _("Packages to be included in Boot Image"), Builtins.mergestring( Builtins.maplist( Convert.convert( packages, :from => "list", :to => "list <map>" ) ) { |p| Ops.get_string(p, "name", "") }, "\n" ) ), ButtonBox( PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton), PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton) ) ), HSpacing(0.5) ) ) ret = UI.UserInput value = Convert.to_string(UI.QueryWidget(Id(:bootinclude), :Value)) retlist = Builtins.maplist( Builtins.filter(Builtins.splitstring(value, "\n")) { |p| p != "" } ) { |name| { "name" => name, "bootinclude" => "true" } } UI.CloseDialog return nil if ret == :cancel deep_copy(retlist) end |
- (Object) modifyPackageSelection(sw_contents)
open package selector with given set of packages, return modified set or nil on cancel
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 400 def modifyPackageSelection(sw_contents) sw_contents = deep_copy(sw_contents) mbytes = Convert.to_integer(UI.QueryWidget(Id("size"), :Value)) if UI.QueryWidget(Id("sizeunit"), :Value) == "G" mbytes = Ops.multiply(mbytes, 1024) end ProductCreator.max_size_mb = mbytes # no size check for "additive" (bnc#512358) if UI.QueryWidget(Id("additive"), :Value) == true ProductCreator.max_size_mb = 999 * 1024 * 1024 end ret_map = runPackageSelector( "", Builtins.maplist(Ops.get_list(sw_contents, "namedCollection", [])) do |pat| Ops.get_string(pat, "name", "") end, Builtins.maplist(Ops.get_list(sw_contents, "package", [])) do |pat| Ops.get_string(pat, "name", "") end, Builtins.maplist(Ops.get_list(sw_contents, "ignore", [])) do |pat| Ops.get_string(pat, "name", "") end, :packages ) if Ops.get(ret_map, "ui") == :cancel || Ops.get(ret_map, "ui") == :failed return nil end Ops.set( sw_contents, "namedCollection", Builtins.maplist(Ops.get_list(ret_map, "addons", [])) do |name| { "name" => name } end ) Ops.set( sw_contents, "package", Builtins.maplist(Ops.get_list(ret_map, "packages", [])) do |name| { "name" => name } end ) Ops.set( sw_contents, "ignore", Builtins.maplist(Ops.get_list(ret_map, "taboo", [])) do |name| { "name" => name } end ) deep_copy(sw_contents) end |
- (Object) NotImplementedHandler(key, event)
generic popup
1457 1458 1459 1460 1461 1462 1463 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 1457 def NotImplementedHandler(key, event) event = deep_copy(event) if Ops.get(event, "ID") == key Popup.Message(_("Feature not implemented yet.")) end nil end |
- (Object) PrepareDialog
Prepare dialog: define kiwi data without product-creator
2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 2950 def PrepareDialog @kiwi_task = Kiwi.kiwi_task @kiwi_task = "iso" if @kiwi_task == "" _Config = deep_copy(ProductCreator.Config) kiwi_configuration = Ops.get_string( _Config, Ops.add("kiwi_configuration_", @kiwi_task), "" ) name = Ops.get_string(_Config, "name", "") out_dir = Ops.get_string(_Config, "iso-directory", "/tmp") repositories = deep_copy(Kiwi.current_repositories) new_configuration = _Config == {} append_name = false help = Ops.add( Ops.add( Ops.add( Ops.add( Ops.add( new_configuration ? # help text for kiwi UI preparation _( "<p>Enter the name of your image configuration. Base new configuration on template from the list or on the directory with the existing configuration.</p>" ) : "", # help text for kiwi UI preparation new_configuration ? Builtins.sformat( _( "<p>Place custom configuration templates under <tt>%1</tt> directory.</p>" ), Ops.get(Kiwi.templates_dirs, 0, "") ) : "" ), # help text for kiwi UI preparation, cont. _("<p>Choose the <b>Image Type</b> which should be created.</p>") ), # help text for kiwi UI preparation, cont. _("<p>Select <b>Output Directory</b> for the created image.</p>") ), # help text for kiwi UI preparation, cont. _( "<p>Modify the list of <b>Package Repositories</b> that will be used for creating the image. Use <b>Add From System</b> to add one of the current system repositories.</p>" ) ), # help text for kiwi UI preparation, cont. _("<p>Click <b>Next</b> to continue with the configuration.</p>") ) basic_type_items = [ # combo box item Item(Id("xen"), _("Xen Image"), @kiwi_task == "xen"), # combo box item Item(Id("vmx"), _("Virtual Disk Image"), @kiwi_task == "vmx") ] # build Live iso only for x86_64 and i386 (bnc#675101) if Arch.architecture == "x86_64" || ProductCreator.GetArch == "i386" basic_type_items = Builtins.prepend( basic_type_items, # combo box item Item(Id("iso"), _("Live ISO Image"), @kiwi_task == "iso") ) end task2label = { # combo box item "pxe" => _("Network Boot Image"), # combo box item "iso" => _("Live ISO Image"), # combo box item "xen" => _("Xen Image"), # combo box item "vmx" => _("Virtual Disk Image"), # combo box item "oem" => _("OEM Image") } type_items = deep_copy(basic_type_items) default_type_items = deep_copy(basic_type_items) supported_images = Kiwi.supported_boot_images if supported_images != "" && supported_images != "template" type_items = [] # will be read from template..., or: Builtins.foreach(Builtins.splitstring(supported_images, ",")) do |type| if Builtins.haskey(task2label, type) type_items = Builtins.add( type_items, Item( Id(type), Ops.get_string(task2label, type, type), type == @kiwi_task ) ) end end default_type_items = deep_copy(type_items) elsif supported_images == "template" && !new_configuration type_its = [] #solve `back here (=no import) Builtins.foreach(Ops.get_list(_Config, ["preferences", 0, "type"], [])) do |typemap| type = Ops.get_string(typemap, "image", "") type_its = Builtins.add( type_its, Item( Id(type), Ops.get_string(task2label, type, type), type == @kiwi_task ) ) end type_items = deep_copy(type_its) if type_its != [] end present_types = Builtins.maplist( Convert.convert(type_items, :from => "list", :to => "list <term>") ) { |it| Ops.get_string(it, [0, 0], "") } if !Builtins.contains(["iso", "xen", "vmx"], @kiwi_task) && !Builtins.contains(present_types, @kiwi_task) type_items = Builtins.add( type_items, Item( Id(@kiwi_task), Ops.get_string(task2label, @kiwi_task, @kiwi_task), true ) ) present_types = Builtins.add(present_types, @kiwi_task) end # on start, show the default YaST sources if Ops.get_list(_Config, "sources", []) != [] && repositories == {} Builtins.foreach(Ops.get_list(_Config, "sources", [])) do |src| Ops.set(repositories, src, { "url" => src }) end end system_repo_items = Builtins.maplist(Kiwi.initial_repositories) do |url, repo| Item(Id(url), url) end update_repo_table = lambda do UI.ChangeWidget( Id(:repositories), :Items, Builtins.maplist(repositories) { |url, repo| Item(Id(url), url) } ) UI.ChangeWidget( Id(:delete), :Enabled, Ops.greater_than(Builtins.size(repositories), 0) ) nil end # read the new configuration and update UI accordingly # (no need to read config if it is provided as argument) update_config = lambda do |dir, config| config = deep_copy(config) kiwi_configuration = dir _Config = config == {} ? Kiwi.ReadConfigXML(kiwi_configuration) : deep_copy(config) if Ops.get_string(_Config, ["description", 0, "type"], "") != "system" Builtins.y2warning( "%1 does not have 'system' image type, skipping", dir ) # error popup Popup.Error( _( "Selected directory does not contain valid description of system configuration." ) ) return false end # busy popup Popup.ShowFeedback(_("Importing repositories..."), _("Please wait...")) repositories = Kiwi.ImportImageRepositories(_Config, dir) Popup.ClearFeedback if !new_configuration name = Ops.get_string(_Config, "name", "") UI.ChangeWidget(Id(:config), :Value, name) else _Config = save_preferences(_Config, "version", "1.0.0") end if Ops.get_string(_Config, "iso-directory", "") != "" UI.ChangeWidget( Id(:out_dir), :Value, Ops.get_string(_Config, "iso-directory", "") ) end update_repo_table.call type_its = supported_images != "template" ? deep_copy(default_type_items) : [] @kiwi_task = "" Builtins.foreach(Ops.get_list(_Config, ["preferences", 0, "type"], [])) do |typemap| type = Ops.get_string(typemap, "image", "") if Builtins.tolower(Ops.get_string(typemap, "primary", "false")) == "true" || @kiwi_task == "" @kiwi_task = type end if supported_images == "" && !Builtins.contains(present_types, type) || supported_images == "template" type_its = Builtins.add( type_its, Item(Id(type), Ops.get_string(task2label, type, type)) ) present_types = Builtins.union(present_types, [type]) end end if @kiwi_task == "" @kiwi_task = "iso" Builtins.y2warning("no task found, setting to 'iso'") end UI.ChangeWidget(Id(:type), :Items, type_its) UI.ChangeWidget(Id(:type), :Value, @kiwi_task) true end template_items = Builtins.maplist(Kiwi.Templates) do |dir, template| Item( Id(dir), Builtins.sformat( # combo box item, %1 is name, %2 version _("%1, version %2"), Ops.get_string(template, "name", ""), get_preferences(template, "version", "") ) ) end arch_term = VBox() if Arch.architecture == "x86_64" arch_term = VBox( # checkbox label CheckBox( Id(:i386), Opt(:notify, :hstretch), _("&32bit Architecture Image"), Kiwi.image_architecture == "i386" ), VSpacing(0.2) ) end arch_term = Builtins.add( arch_term, # checkbox label CheckBox( Id(:i586), Opt(:hstretch), _("Target is i586 only"), Kiwi.target_i586 ) ) arch_term = Builtins.add(arch_term, VSpacing(0.2)) contents = VBox( new_configuration ? VBox( InputField( Id(:config), Opt(:hstretch), # text entry label _("&Kiwi Configuration"), name ), RadioButtonGroup( Id(:imp), HBox( HSpacing(), VBox( VSpacing(0.2), Left( RadioButton( Id("rb_new"), Opt(:notify), # radio button label _("Create from Scratch"), true ) ), template_items == [] ? VSpacing(0) : Left( RadioButton( Id("rb_template"), Opt(:notify), # radio button label _("Base on Template") ) ), template_items == [] ? VSpacing(0) : HBox( HSpacing(2.5), ComboBox( Id(:template), Opt(:notify, :hstretch), "", template_items ) ), Left( RadioButton( Id("rb_dir"), Opt(:notify), # radio button label _("Base on Existing Configuration") ) ), HBox( HSpacing(2.5), Label(Id(:import_dir), Opt(:outputField, :hstretch), ""), # push button label PushButton(Id(:import), _("&Choose...")) ) ) ) ) ) : Left(Label(Id(:config), name)), # combo box label ComboBox( Id(:type), Opt(:notify, :hstretch), _("I&mage Type"), type_items ), HBox( InputField( Id(:out_dir), Opt(:hstretch), # text entry label _("&Output Directory"), out_dir ), VBox(Label(""), PushButton(Id(:browse), Label.BrowseButton)) ), VSpacing(0.2), arch_term, Table( Id(:repositories), Opt(:notify), Header( # table header _("Package Repository") ) ), HBox( PushButton(Id(:add), Label.AddButton), # menu butto label MenuButton(Id(:addsystem), _("A&dd from System"), system_repo_items), PushButton(Id(:edit), Label.EditButton), PushButton(Id(:delete), Label.DeleteButton), HStretch() ) ) # dialog caption Wizard.SetContentsButtons( _("Image preparation"), contents, help, Label.BackButton, Label.NextButton ) Wizard.RestoreBackButton Wizard.RestoreAbortButton if new_configuration && kiwi_configuration != "" update_config.call(kiwi_configuration, {}) else update_repo_table.call end if new_configuration UI.SetFocus(Id(:config)) UI.ChangeWidget(Id(:template), :Enabled, false) if template_items != [] UI.ChangeWidget(Id(:import), :Enabled, false) UI.ChangeWidget(Id(:config), :ValidChars, Ops.add(String.CAlnum, ".-_")) end if Arch.architecture == "x86_64" UI.ChangeWidget(Id(:i586), :Enabled, Kiwi.image_architecture == "i386") end ret = nil while true ret = UI.UserInput if ret == :abort || ret == :cancel || ret == :back if ProductCreator.ReallyAbort break else next end elsif ret == "rb_dir" if template_items != [] UI.ChangeWidget(Id(:template), :Enabled, false) end UI.ChangeWidget(Id(:import), :Enabled, true) ret = :import if kiwi_configuration == "" elsif ret == "rb_template" UI.ChangeWidget(Id(:template), :Enabled, true) UI.ChangeWidget(Id(:import), :Enabled, false) ret = :template elsif ret == "rb_new" UI.ChangeWidget(Id(:template), :Enabled, false) UI.ChangeWidget(Id(:import), :Enabled, false) UI.ChangeWidget(Id(:type), :Items, default_type_items) end if ret == :i386 UI.ChangeWidget( Id(:i586), :Enabled, UI.QueryWidget(Id(:i386), :Value) ) end if ret == :import dir = UI.AskForExistingDirectory( kiwi_configuration == "" ? Kiwi.images_dir : kiwi_configuration, # popup for file selection dialog _("Directory to Import") ) if dir != nil && update_config.call(dir, {}) UI.ChangeWidget(Id(:import_dir), :Value, dir) end elsif ret == :template dir = Convert.to_string(UI.QueryWidget(Id(:template), :Value)) update_config.call(dir, Ops.get(Kiwi.Templates, dir, {})) elsif Ops.is_string?(ret) && ret != "rb_dir" && # system repository selected ret != "rb_new" system_repo = Ops.get( Kiwi.initial_repositories, Convert.to_string(ret), {} ) if !Builtins.haskey(repositories, Convert.to_string(ret)) Ops.set(repositories, Convert.to_string(ret), system_repo) end update_repo_table.call elsif ret == :add Wizard.CreateDialog url = "" type_ret = SourceDialogs.TypeDialog if type_ret == :next || type_ret == :finish if type_ret == :finish && SourceDialogs.GetURL == "slp://" required_package = "yast2-slp" installed_before = PackageSystem.Installed(required_package) if !installed_before if !PackageSystem.CheckAndInstallPackagesInteractive( [required_package] ) Report.Error( Builtins.sformat( # popup error message, %1 is the package name _( "Cannot search for SLP repositories\nwithout having %1 package installed.\n" ), required_package ) ) Builtins.y2warning("Not searching for SLP repositories") else SCR.RegisterAgent( path(".slp"), term(:ag_slp, term(:SlpAgent)) ) end end service = Convert.to_string(WFM.call("select_slp_source")) url = service if service != nil else url = SourceDialogs.GetURL if SourceDialogs.EditDialog == :next end end Wizard.CloseDialog if url != "" next if Builtins.haskey(repositories, url) parsed = URL.Parse(url) if Ops.get_string(parsed, "scheme", "") == "dir" url = Ops.get_string(parsed, "path", url) Builtins.y2milestone("un-escaping local directory path: %1", url) end plaindir = SourceDialogs.IsPlainDir Ops.set( repositories, url, { "url" => url, "plaindir" => plaindir, "name" => SourceDialogs.GetRepoName } ) update_repo_table.call end elsif ret == :edit || ret == :repositories url = Convert.to_string( UI.QueryWidget(Id(:repositories), :CurrentItem) ) selected_url = url plaindir = Ops.get_boolean(repositories, [url, "plaindir"], false) # change schema if the source type is plaindir # to show the right popup dialog if plaindir parsed2 = URL.Parse(url) url = URL.Build(parsed2) url = SourceDialogs.EditPopupType(url, true) else url = SourceDialogs.EditPopup(url) end next if url == "" || url == nil || url == selected_url # remove current url + add new one repositories = Builtins.remove(repositories, selected_url) parsed = URL.Parse(url) plaindir = SourceDialogs.IsPlainDir Ops.set( repositories, url, { "url" => url, "plaindir" => plaindir, "name" => SourceDialogs.GetRepoName } ) update_repo_table.call elsif ret == :delete selected = Convert.to_string( UI.QueryWidget(Id(:repositories), :CurrentItem) ) next if selected == nil repositories = Builtins.remove(repositories, selected) update_repo_table.call if Ops.greater_than(Builtins.size(repositories), 0) UI.SetFocus(Id(:repositories)) end elsif ret == :browse dir = UI.AskForExistingDirectory( "", # popup for file selection dialog _("Path to the Output Directory") ) UI.ChangeWidget(Id(:out_dir), :Value, dir) if dir != nil elsif ret == :next Builtins.y2internal( "package lock check returned %1", PackageLock.Check ) name = Convert.to_string(UI.QueryWidget(Id(:config), :Value)) if name == "" # error popup Report.Error(_("Enter the name of the configuration.")) UI.SetFocus(Id(:config)) next end if new_configuration && FileUtils.Exists(Ops.add(Ops.add(Kiwi.images_dir, "/"), name)) # error popup Popup.Error( Builtins.sformat( _( "Configuration with name \"%1\" already exists.\nChoose a different one." ), name ) ) UI.SetFocus(Id(:config)) next end out_dir = Convert.to_string(UI.QueryWidget(Id(:out_dir), :Value)) if out_dir == "" # error popup Popup.Error(_("Enter the path to the output directory.")) UI.SetFocus(Id(:out_dir)) next end if repositories == {} # error popup Popup.Error(_("Specify at least one package repository.")) UI.SetFocus(Id(:repositories)) next end @kiwi_task = Convert.to_string(UI.QueryWidget(Id(:type), :Value)) failed_repositories = [] new_repositories = {} ProductCreator.ResetArch if Arch.architecture == "x86_64" Kiwi.image_architecture = "x86_64" if UI.QueryWidget(Id(:i386), :Value) == true Kiwi.image_architecture = "i386" end # closing sources, so they are created again with correct arch (bnc#510971, bnc#794583) Pkg.SourceFinishAll Pkg.SourceStartManager(false) ProductCreator.SetPackageArch( Kiwi.image_architecture == "i386" ? "i686" : "x86_64" ) end Kiwi.target_i586 = Kiwi.image_architecture == "i386" && Convert.to_boolean(UI.QueryWidget(Id(:i586), :Value)) if Ops.greater_than(Builtins.size(repositories), 0) current_sources = {} # delete current repos, that won't be used in config Builtins.foreach(Pkg.SourceEditGet) do |source| srcid = Ops.get_integer(source, "SrcId", -1) data = Pkg.SourceGeneralData(srcid) url = Ops.get_string(data, "url", "") # there can be more sources with same url, leave there only one if Ops.get(current_sources, url, srcid) != srcid Builtins.y2milestone( "deleting extra source %1 for %2", Ops.get(current_sources, url, srcid), url ) Pkg.SourceDelete(Ops.get(current_sources, url, srcid)) end Ops.set(current_sources, url, srcid) end # map of new repo aliases aliases = {} # initialize new repos now new_repositories = Builtins.filter(repositories) do |url, repo| if Builtins.substring(url, 0, 1) == "/" url = Ops.add("dir://", url) end if Builtins.haskey(current_sources, url) current_sources = Builtins.remove(current_sources, url) next true end source_ret = -1 full_url = url if Ops.get_string(repo, "full_url", "") != "" && Ops.get_string(repo, "full_url", "") != url full_url = Ops.get_string(repo, "full_url", "") end _alias = Builtins.mergestring( Builtins.splitstring( Ops.get_string(repo, "name", full_url), " " ), "_" ) if Ops.greater_than(Ops.get(aliases, _alias, 0), 0) _alias = Builtins.sformat( "%1%2", _alias, Ops.get(aliases, _alias, 0) ) end Ops.set(aliases, _alias, Ops.add(Ops.get(aliases, _alias, 0), 1)) repo_map = { "name" => Ops.get_string(repo, "name", _alias), "alias" => _alias, "base_urls" => [full_url] } if Ops.get_boolean(repo, "plaindir", false) Ops.set(repo_map, "type", "Plaindir") end source_ret = Pkg.RepositoryAdd(repo_map) if source_ret == -1 failed_repositories = Builtins.add(failed_repositories, url) next false end true end Builtins.foreach(current_sources) do |url, srcid| Pkg.SourceDelete(srcid) end end if failed_repositories != [] # continue/cancel popup %1 is a \n separated list if !Popup.ContinueCancel( Builtins.sformat( _( "Failed to add these repositories:\n" + "\n" + "%1.\n" + "\n" + "Continue anyway?" ), Builtins.mergestring(failed_repositories, "\n") ) ) next else repositories = deep_copy(new_repositories) end end to_install = "" if Builtins.contains(["iso", "xen", "vmx"], @kiwi_task) bootdir = get_bootdir(_Config, @kiwi_task) if bootdir == "" || !FileUtils.Exists(Ops.add("/usr/share/kiwi/image/", bootdir)) && !FileUtils.Exists(bootdir) to_install = Builtins.sformat("kiwi-desc-%1boot", @kiwi_task) end if to_install != "" && !Package.Install(to_install) Popup.Error(Message.FailedToInstallPackages) next end end break end end boot = get_bootdir(_Config, @kiwi_task) if boot != "" && Builtins.issubstring(boot, "/") prefix = @kiwi_task == "pxe" ? "net" : @kiwi_task Ops.set( _Config, Ops.add(prefix, "boot"), Builtins.substring(boot, Ops.add(Builtins.search(boot, "/"), 1)) ) #FIXME this should not be needed... end if ret == :next if Ops.greater_than(Builtins.size(repositories), 0) ProductCreator.enable_sources = false Pkg.SourceLoad end Ops.set( _Config, Ops.add("kiwi_configuration_", @kiwi_task), kiwi_configuration ) Ops.set(_Config, "_imported", true) Ops.set( _Config, "iso-directory", Ops.add(out_dir, new_configuration ? Ops.add("/", name) : "") ) _Config = save_preferences( _Config, "defaultdestination", Ops.get_string(_Config, "iso-directory", "") ) Ops.set(_Config, "name", name) Ops.set(_Config, "new_configuration", new_configuration) Ops.set(_Config, "sources", Builtins.maplist(repositories) do |url, repo| url end) ProductCreator.Config = deep_copy(_Config) Kiwi.current_repositories = deep_copy(repositories) Kiwi.kiwi_task = @kiwi_task end Builtins.y2milestone("Returning %1", ret) Convert.to_symbol(ret) end |
- (Object) StoreBootCombo(key, event)
store the value of current boot image
690 691 692 693 694 695 696 697 698 699 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 690 def StoreBootCombo(key, event) event = deep_copy(event) Ops.set( @KiwiConfig, key, Convert.to_string(UI.QueryWidget(Id(key), :Value)) ) nil end |
- (Object) StoreCompressionCombo(key, event)
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 139 def StoreCompressionCombo(key, event) event = deep_copy(event) selected = Convert.to_string(UI.QueryWidget(Id(key), :Value)) Ops.set( @KiwiConfig, ["preferences", 0, "type"], Builtins.maplist( Ops.get_list(@KiwiConfig, ["preferences", 0, "type"], []) ) do |typemap| if Ops.get_string(typemap, "image", "") == @kiwi_task if selected == "none" if Builtins.haskey(typemap, "flags") typemap = Builtins.remove(typemap, "flags") end else Ops.set(typemap, "flags", selected) end end deep_copy(typemap) end ) nil end |
- (Object) StoreDescription(key, event)
store the string value of “description” related given widget
866 867 868 869 870 871 872 873 874 875 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 866 def StoreDescription(key, event) event = deep_copy(event) Ops.set( @KiwiConfig, ["description", 0, key], [{ @content_key => UI.QueryWidget(Id(key), :Value) }] ) nil end |
- (Object) StoreDiskPassword(key, event)
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 186 def StoreDiskPassword(key, event) event = deep_copy(event) disk_password = Convert.to_string(UI.QueryWidget(Id(key), :Value)) disk_password = "" if UI.QueryWidget(Id("encrypt_disk"), :Value) == false Ops.set( @KiwiConfig, ["preferences", 0, "type"], Builtins.maplist( Ops.get_list(@KiwiConfig, ["preferences", 0, "type"], []) ) do |typemap| if Ops.get_string(typemap, "image", "") == @kiwi_task if disk_password == "" if Builtins.haskey(typemap, "luks") typemap = Builtins.remove(typemap, "luks") end else Ops.set(typemap, "luks", disk_password) end end deep_copy(typemap) end ) nil end |
- (Object) StoreGeneric(key, event)
store the string value of given widget
839 840 841 842 843 844 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 839 def StoreGeneric(key, event) event = deep_copy(event) Ops.set(@KiwiConfig, key, UI.QueryWidget(Id(key), :Value)) nil end |
- (Object) StorePreferences(key, event)
store the string value of “preferences” related given widget
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 979 def StorePreferences(key, event) event = deep_copy(event) val = Convert.to_string(UI.QueryWidget(Id(key), :Value)) # split .UTF-8 endings from locale (bnc#675101) if key == "locale" split = Builtins.splitstring(val, ".") val = Ops.get(split, 0, val) UI.ChangeWidget(Id(key), :Value, val) end if (val == "" || val == "none") && Builtins.haskey(Ops.get_map(@KiwiConfig, ["preferences", 0], {}), key) Ops.set( @KiwiConfig, ["preferences", 0], Builtins.remove(Ops.get_map(@KiwiConfig, ["preferences", 0], {}), key) ) elsif val != "" && val != "none" Ops.set( @KiwiConfig, ["preferences", 0, key], [{ @content_key => UI.QueryWidget(Id(key), :Value) }] ) end nil end |
- (Object) StoreSize(key, event)
store the values of “size”, “sizeunit” and “additive” widgets
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 774 def StoreSize(key, event) event = deep_copy(event) Ops.set( @KiwiConfig, ["preferences", 0, "type"], Builtins.maplist( Ops.get_list(@KiwiConfig, ["preferences", 0, "type"], []) ) do |typemap| if Ops.get_string(typemap, "image", "") == @kiwi_task Ops.set( typemap, "size", [ { @content_key => Builtins.sformat( "%1", UI.QueryWidget(Id(key), :Value) ), "unit" => UI.QueryWidget(Id("sizeunit"), :Value), "additive" => Convert.to_boolean( UI.QueryWidget(Id("additive"), :Value) ) ? "true" : "false" } ] ) end deep_copy(typemap) end ) nil end |
- (Object) StoreSWDelete(key, event)
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 283 def StoreSWDelete(key, event) event = deep_copy(event) to_delete = Builtins.filter( Builtins.splitstring( Convert.to_string(UI.QueryWidget(Id(key), :Value)), "\n" ) ) { |p| p != "" } index = 0 del_index = -1 Builtins.foreach(Ops.get_list(@KiwiConfig, "packages", [])) do |pmap| if Ops.get_string(pmap, "type", "") == "delete" del_index = index raise Break end index = Ops.add(index, 1) end sw_contents = Ops.get_map(@KiwiConfig, ["packages", del_index], {}) if del_index == -1 sw_contents = { "type" => "delete" } del_index = Builtins.size(Ops.get_list(@KiwiConfig, "packages", [])) Ops.set( @KiwiConfig, "packages", Builtins.add(Ops.get_list(@KiwiConfig, "packages", []), {}) ) end Ops.set(sw_contents, "package", Builtins.maplist(to_delete) do |name| { "name" => name } end) Ops.set(@KiwiConfig, ["packages", del_index], sw_contents) nil end |
- (Object) StoreSWIgnore(key, event)
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 241 def StoreSWIgnore(key, event) event = deep_copy(event) sw_selection = Ops.get_string(@KiwiConfig, "sw_selection", "image") ignore_key = sw_selection == "image" ? "ignore" : Ops.add(sw_selection, "_ignore") Ops.set( @KiwiConfig, ignore_key, Builtins.filter( Builtins.splitstring( Convert.to_string(UI.QueryWidget(Id(key), :Value)), "\n" ) ) { |p| p != "" } ) nil end |
- (Object) StoreSWSelectionCombo(key, event)
652 653 654 655 656 657 658 659 660 661 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 652 def StoreSWSelectionCombo(key, event) event = deep_copy(event) Ops.set( @KiwiConfig, "package_set", Convert.to_integer(UI.QueryWidget(Id(key), :Value)) ) nil end |
- (Object) StoreVersion(key, event)
store the value of current version
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 720 def StoreVersion(key, event) event = deep_copy(event) Ops.set( @KiwiConfig, ["preferences", 0, "version"], [ { @content_key => Builtins.sformat( "%1", UI.QueryWidget(Id(key), :Value) ) } ] ) nil end |
- (Object) tabs_descr
return map with description of tabs it is a function, to be able to adapt to actual state)
2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 |
# File '../../src/include/product-creator/kiwi_dialogs.rb', line 2134 def tabs_descr show_compression = true # compression not allowed in most cases (bnc#510833) Builtins.foreach( Ops.get_list(@KiwiConfig, ["preferences", 0, "type"], []) ) do |typemap| if Ops.get_string(typemap, "image", "") == @kiwi_task if Ops.get_string(typemap, "filesystem", "") == "ext3" show_compression = false end end end # if root/build-custom file is present, offer its editing instead of # config.sh & images.sh (fate#310978) show_buildcustom = Builtins.haskey(@KiwiConfig, "root/build-custom") ret = { "config.xml" => { # tab header "header" => _("Image Configuration"), "contents" => HBox( HSpacing(1), VBox( VSpacing(0.2), HBox( HWeight( 2, HBox( "version", "size", "sizeunit", VBox(Label(""), "additive") ) ), show_compression ? HWeight(1, "compression") : HBox() ), HBox(VBox(Label(""), "encrypt_disk"), "disk_password"), HBox( HWeight( 2, VBox( "sw_selection", Left(Label(_("Installed Software"))), "rt_sw", Right("configure_sw") ) ), HWeight(1, "delete_sw") ), VSpacing(0.2) ), HSpacing(1) ), "widget_names" => [ "version", "size", "sizeunit", "additive", "encrypt_disk", "disk_password", "sw_selection", "rt_sw", "configure_sw", "delete_sw" ] }, "description" => { # tab header "header" => _("Description"), "contents" => HBox( HSpacing(1), VBox( VSpacing(0.2), "author", VSpacing(0.2), "contact", VSpacing(0.2), "specification", VSpacing(0.6), # frame label Frame( _("Locale settings"), HBox("locale", "keytable", "timezone") ), VStretch() ), HSpacing(1) ), "widget_names" => [ "author", "contact", "specification", "locale", "keytable", "timezone" ] }, "users" => { # tab header "header" => _("Users"), "contents" => HBox( HSpacing(1), VBox( "general_users", VSpacing(0.2), "userstable", VSpacing(0.2), HBox("adduser", "edituser", "deleteuser", HStretch()), VSpacing(0.2) ), HSpacing(1) ), "widget_names" => [ "general_users", "group", "userstable", "adduser", "edituser", "deleteuser" ] }, "scripts" => { # tab header "header" => _("Scripts"), "contents" => HBox( HSpacing(1), VBox( "general_scripts", VSpacing(0.2), show_buildcustom ? VBox( VWeight( 3, HBox( "root/build-custom", Bottom("import_root/build-custom") ) ), Left( # informative label Label( _( "Editing of following files is disabled for configurations imported from Studio." ) ) ), VWeight(1, "config.sh"), VWeight(1, "images.sh") ) : VBox( HBox("config.sh", Bottom("import_config.sh")), HBox("images.sh", Bottom("import_images.sh")) ), VSpacing(0.2) ), HSpacing(1) ), "widget_names" => [ "general_scripts", "config.sh", "import_config.sh", "images.sh", "import_images.sh", "root/build-custom", "import_root/build-custom" ] }, "directories" => { # tab header "header" => _("Directories"), "contents" => HBox( HSpacing(1), VBox( "general_directories", VSpacing(0.2), "root_dir_table", VSpacing(0.2), HBox("root_dir_add", Left("root_dir_delete")), VSpacing(0.2), "config_dir_table", VSpacing(0.2), HBox("config_dir_add", Left("config_dir_delete")), VSpacing(0.2), VSpacing(0.2) ), HSpacing(1) ), "widget_names" => [ "general_directories", "root_dir_table", "root_dir_add", "root_dir_delete", "config_dir_table", "config_dir_add", "config_dir_delete" ] } } if show_compression Ops.set( ret, ["config.xml", "widget_names"], Builtins.add( Ops.get_list(ret, ["config.xml", "widget_names"], []), "compression" ) ) end deep_copy(ret) end |