Module: Yast::KdumpComplexInclude

Defined in:
../../src/include/kdump/complex.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) initialize_kdump_complex(include_target)



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File '../../src/include/kdump/complex.rb', line 30

def initialize_kdump_complex(include_target)
  Yast.import "UI"

  textdomain "kdump"

  Yast.import "Label"
  Yast.import "Popup"
  Yast.import "Wizard"
  Yast.import "Confirm"
  Yast.import "Kdump"
  Yast.import "Package"
  Yast.import "Arch"
  Yast.import "CommandLine"
  Yast.import "Mode"
  Yast.import "Message"
  Yast.import "PackageSystem"

  Yast.include include_target, "kdump/helps.rb"
end

- (Object) Modified

Return a modification status

Returns:

  • true if data was modified



52
53
54
# File '../../src/include/kdump/complex.rb', line 52

def Modified
  Kdump.GetModified
end

- (Object) PollAbort



60
61
62
# File '../../src/include/kdump/complex.rb', line 60

def PollAbort
  UI.PollInput == :abort
end

- (Object) ReadDialog

Read settings dialog

Returns:

  • abort if aborted andnext otherwise



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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File '../../src/include/kdump/complex.rb', line 66

def ReadDialog
  kexec_installed = false
  kdump_installed = false
  kexec_available = false
  kdump_available = false
  package_list = []

  Wizard.RestoreHelp(Ops.get_string(@HELPS, "read", ""))
  # Kdump::AbortFunction = PollAbort;
  return :abort if !Confirm.MustBeRoot

  # checking of installation packages
  kexec_installed = true if Package.Installed("kexec-tools")

  kdump = ""

  # only ppc64 includes package kernel-kdump
  # others include kdump and kexec-tools depend on it

  if Arch.ppc64
    kdump = "kernel-kdump"
  else
    kdump = "kdump"
  end

  kdump_installed = true if Package.Installed(kdump)

  #checking if packages are available
  if !kexec_installed || !kdump_installed
    kexec_available = Package.Available("kexec-tools") if !kexec_installed

    kdump_available = Package.Available(kdump) if !kdump_installed

    if !kexec_installed && !kexec_available
      if !Mode.commandline
        Popup.Error(_("Package for kexec-tools is not available."))
      else
        CommandLine.Error(_("Package for kexec-tools is not available."))
      end
      Builtins.y2error(
        "[kdump] (ReadDialog ()) Packages for kexec-tools is not available."
      )
      return :abort
    end

    if !kdump_installed && !kdump_available
      if !Mode.commandline
        Popup.Error(_("Package for kdump is not available."))
      else
        CommandLine.Error(_("Package for kdump is not available."))
      end
      Builtins.y2error(
        "[kdump] (ReadDialog ()) Packages for %1 is not available.",
        kdump
      )
      return :abort
    end

    #add packages for installation
    if !kexec_installed
      package_list = Builtins.add(package_list, "kexec-tools")
    end

    package_list = Builtins.add(package_list, kdump) if !kdump_installed

    #install packages
    if !PackageSystem.CheckAndInstallPackages(package_list)
      if !Mode.commandline
        Popup.Error(Message.CannotContinueWithoutPackagesInstalled)
      else
        CommandLine.Error(Message.CannotContinueWithoutPackagesInstalled)
      end
      Builtins.y2error(
        "[kdump] Installation of package list %1 failed or aborted",
        package_list
      )
      return :abort
    end
  end



  ret = Kdump.Read
  ret ? :next : :abort
end

- (Object) ReallyAbort



56
57
58
# File '../../src/include/kdump/complex.rb', line 56

def ReallyAbort
  !Kdump.GetModified || Popup.ReallyAbort(true)
end

- (Object) WriteDialog

Write settings dialog

Returns:

  • abort if aborted andnext otherwise



154
155
156
157
158
159
# File '../../src/include/kdump/complex.rb', line 154

def WriteDialog
  Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", ""))
  # Kdump::AbortFunction = PollAbort;
  ret = Kdump.Write
  ret ? :next : :abort
end