Class: Yast::InstAddOnSoftwareClient

Inherits:
Client
  • Object
show all
Defined in:
src/clients/inst_add-on_software.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) main



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
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
110
111
# File 'src/clients/inst_add-on_software.rb', line 49

def main
  Yast.import "Pkg"
  Yast.import "Kernel"
  Yast.import "PackagesUI"
  Yast.import "GetInstArgs"
  Yast.import "ProductControl"
  Yast.import "ProductFeatures"
  Yast.import "Installation"

  return :auto if GetInstArgs.going_back

  @argmap = GetInstArgs.argmap
  Builtins.y2milestone("Client called with args: %1", @argmap)

  # Mapping of modes
  # module->arguments->sw_mode : UI_mode
  @modes = {
    "patterns"     => :patternSelector,
    "search"       => :searchMode,
    "summary"      => :summaryMode,
    "repositories" => :repoMode
  }

  # For sure
  Pkg.TargetInit(Installation.destdir, false)
  Pkg.SourceStartManager(true)

  @pcg_mode = Ops.get_string(@argmap, "sw_mode", "patterns")
  @run_in_mode = Ops.get(@modes, @pcg_mode, :summaryMode)
  Builtins.y2milestone(
    "Running package selector in mode %1/%2",
    @pcg_mode,
    @run_in_mode
  )

  # Call the package selector
  # Since yast2 >= 2.17.58
  @ret = PackagesUI.RunPackageSelector({ "mode" => @run_in_mode })
  Builtins.y2milestone("RunPackageSelector returned %1", @ret)

  @dialog_ret = :next

  @dialog_ret = :abort if @ret == :cancel

  if @ret == :accept || @ret == :ok
    # Add-on requires packages to be installed right now
    if Ops.get_boolean(@argmap, "skip_installation", false) != true
      Builtins.y2milestone("Selected resolvables will be installed now")

      if WFM.CallFunction(
          "inst_rpmcopy",
          [GetInstArgs.Buttons(false, false)]
        ) == :abort
        @dialog_ret = :abort
      else
        Kernel.InformAboutKernelChange
        Builtins.y2milestone("Done")
      end
    end
  end

  @dialog_ret
end