Class: Yast::InstCustomPackagesClient

Inherits:
Client
  • Object
show all
Defined in:
src/clients/inst_custom_packages.rb

Overview

Client for 3rd prodcuts/addon products package installations

Instance Method Summary collapse

Instance Method Details

#mainObject


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
# File 'src/clients/inst_custom_packages.rb', line 5

def main
  Yast.import "UI"
  Yast.import "Pkg"
  textdomain "packager"
  Yast.import "ProductFeatures"
  Yast.import "SourceManager"
  Yast.import "Directory"
  Yast.import "Popup"
  Yast.import "SlideShow"
  Yast.import "PackageSlideShow"
  Yast.import "Kernel"
  Yast.import "Installation"
  Yast.import "GetInstArgs"
  Yast.import "Mode"
  Yast.import "PackagesUI"

  @packages = Convert.convert(
    ProductFeatures.GetFeature("software", "packages"),
    from: "any",
    to:   "list <string>"
  )
  if !probeSource(Ops.add("dir://", Directory.custom_workflow_dir))
    # error popup
    Popup.Error(_("Could not read package information."))
    return :abort
  end

  if Ops.greater_than(Builtins.size(@packages), 0)
    Builtins.y2milestone("installing packages: %1", @packages)
    Builtins.foreach(@packages) do |pkg|
      Pkg.DoProvide([pkg]) if !Pkg.PkgInstall(pkg)
    end
    @solve = Pkg.PkgSolve(false)
    Builtins.y2error("Error solving package dependencies") if !@solve
  end
  @result = PackagesUI.RunPackageSelector("mode" => :summaryMode)
  Builtins.y2milestone("Package selector returned: %1", @result)
  @result = :next if @result == :accept

  if @result == :next # packages selected ?
    @anyToDelete = Pkg.IsAnyResolvable(:package, :to_remove)
    SlideShow.SetLanguage(UI.GetLanguage(true))
    PackageSlideShow.InitPkgData(false)
    SlideShow.OpenDialog

    Yast.import "PackageInstallation"
    @oldvmlinuzsize = Convert.to_integer(
      SCR.Read(path(".target.size"), "/boot/vmlinuz")
    )
    @commit_result = PackageInstallation.CommitPackages(0, 0) # Y: commit them !
    @newvmlinuzsize = Convert.to_integer(
      SCR.Read(path(".target.size"), "/boot/vmlinuz")
    )

    SlideShow.CloseDialog

    if Installation.destdir == "/" &&
        (Ops.greater_than(Ops.get_integer(@commit_result, 0, 0), 0) || @anyToDelete)
      # prepare "you must boot" popup
      Kernel.SetInformAboutKernelChange(@oldvmlinuzsize != @newvmlinuzsize)
      Kernel.InformAboutKernelChange
    end
  end

  if Builtins.size(SourceManager.newSources) == 1
    Pkg.SourceChangeUrl(Ops.get(SourceManager.newSources, 0, -1), "cd:///")
  end

  :next
end

#probeSource(url) ⇒ Object


76
77
78
79
80
81
82
83
84
85
# File 'src/clients/inst_custom_packages.rb', line 76

def probeSource(url)
  ret = SourceManager.createSource(url)
  if ret != :ok
    Builtins.y2error("no repositories available on media")
    return false
  else
    SourceManager.CommitSources
    return true
  end
end