Class: Yast::InstPrepareImageClient

Inherits:
Client
  • Object
show all
Defined in:
src/lib/installation/clients/inst_prepare_image.rb

Instance Method Summary collapse

Instance Method Details

#mainObject



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
79
80
81
82
83
# File 'src/lib/installation/clients/inst_prepare_image.rb', line 31

def main
  Yast.import "Pkg"
  Yast.import "Packages"
  Yast.import "ImageInstallation"
  Yast.import "GetInstArgs"
  Yast.import "Wizard"
  Yast.import "Installation"

  textdomain "installation"

  return :back if GetInstArgs.going_back

  Builtins.y2milestone("Preparing image for package selector")

  # set repo to get images from
  ImageInstallation.SetRepo(Ops.get(Packages.theSources, 0, 0))

  @all_patterns = Pkg.ResolvableProperties("", :pattern, "")

  @patterns_to_install = Builtins.maplist(@all_patterns) do |one_patern|
    if Ops.get_symbol(one_patern, "status", :unknown) == :selected ||
        Ops.get_symbol(one_patern, "status", :unknown) == :installed
      next Ops.get_string(one_patern, "name", "")
    else
      next ""
    end
  end

  @patterns_to_install = Builtins.filter(@patterns_to_install) do |one_pattern|
    one_pattern != "" && !one_pattern.nil?
  end

  if @patterns_to_install == ImageInstallation.last_patterns_selected
    Builtins.y2milestone("List of selected patterns hasn't changed...")
    return :auto
  end
  ImageInstallation.last_patterns_selected = deep_copy(@patterns_to_install)

  # list images for currently selected patterns
  Builtins.y2milestone(
    "Currently selected patterns: %1",
    @patterns_to_install
  )

  # avoid useles calls
  if Ops.greater_than(Builtins.size(@patterns_to_install), 0)
    ImageInstallation.FindImageSet(@patterns_to_install)
  end

  Builtins.y2milestone("Images for installation ready")

  :auto
end