Class: Yast::BootloaderClient

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

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) BootloaderDeleteHandler(options)

Delete specified option

Parameters:

  • options (Hash)

    a list of parameters passed as args

Returns:

  • (Boolean)

    true on success



161
162
163
164
# File 'src/clients/bootloader.rb', line 161

def BootloaderDeleteHandler(options)
  option = options["option"]
  BootloaderModifySection(option, nil)
end

- (Boolean) BootloaderModify(key, value)

Modify the boot loader global option

Parameters:

  • key (String)

    string the key to modify

  • value (String)

    string the value to set

Returns:

  • (Boolean)

    true on success



139
140
141
142
# File 'src/clients/bootloader.rb', line 139

def BootloaderModify(key, value)
  BootCommon.globals[key] = value
  true
end

- (Boolean) BootloaderPrintHandler(options)

Print the value of specified option

Parameters:

  • options (Hash)

    a list of parameters passed as args

Returns:

  • (Boolean)

    true on success



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'src/clients/bootloader.rb', line 169

def BootloaderPrintHandler(options)
  options = deep_copy(options)
  option = options["option"]
  if option.nil?
    # command line error report
    CommandLine.Print(_("Option was not specified."))
    return false
  end
  value = BootCommon.globals[option]
  if value
    # command line, %1 is the value of bootloader option
    CommandLine.Print(_("Value: %s") % value)
  else
    # command line error report
    CommandLine.Print(_("Specified option does not exist."))
  end
  false
end

- (Boolean) BootloaderSetHandler(options)

Set specified option in global options

Parameters:

  • options (Hash)

    a list of parameters passed as args

Returns:

  • (Boolean)

    true on success



147
148
149
150
151
152
153
154
155
156
# File 'src/clients/bootloader.rb', line 147

def BootloaderSetHandler(options)
  option = options["option"]
  value = options["value"]
  if value.nil?
    # command line error report
    CommandLine.Print(_("Value was not specified."))
    return false
  end
  BootloaderModify(option, value.to_s)
end

- (Boolean) BootloaderSummaryHandler(_options)

Print summary of basic options

Parameters:

  • options (Hash)

    a list of parameters passed as args

Returns:

  • (Boolean)

    false



126
127
128
129
130
131
132
133
# File 'src/clients/bootloader.rb', line 126

def BootloaderSummaryHandler(_options)
  CommandLine.Print(
    RichText.Rich2Plain(
      Ops.add("<br>", Builtins.mergestring(Bootloader.Summary, "<br>"))
    )
  )
  false # do not call Write...
end

- (Boolean) GuiHandler

CommandLine handler for running GUI

Returns:

  • (Boolean)

    true if settings were saved



116
117
118
119
120
121
# File 'src/clients/bootloader.rb', line 116

def GuiHandler
  ret = BootloaderSequence()

  return false if ret == :abort || ret == :back || ret == :nil
  true
end

- (Object) main



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
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
# File 'src/clients/bootloader.rb', line 19

def main
  Yast.import "UI"
  textdomain "bootloader"

  Yast.import "BootCommon"
  Yast.import "Bootloader"
  Yast.import "CommandLine"
  Yast.import "Mode"
  Yast.import "RichText"

  Yast.include self, "bootloader/routines/wizards.rb"

  # the command line description map
  cmdline = {
    "id"         => "bootloader",
    # command line help text for Bootloader module
    "help"       => _(
      "Boot loader configuration module"
    ),
    "guihandler" => fun_ref(method(:GuiHandler), "boolean ()"),
    "initialize" => fun_ref(Bootloader.method(:Read), "boolean ()"),
    "finish"     => fun_ref(Bootloader.method(:Write), "boolean ()"),
    "actions"    => {
      "summary" => {
        "handler" => fun_ref(
          method(:BootloaderSummaryHandler),
          "boolean (map)"
        ),
        # command line help text for summary action
        "help"    => _(
          "Configuration summary of boot loader"
        )
      },
      "delete"  => {
        "handler" => fun_ref(
          method(:BootloaderDeleteHandler),
          "boolean (map)"
        ),
        # command line help text for delete action
        "help"    => _(
          "Delete a global option"
        )
      },
      "set"     => {
        "handler" => fun_ref(method(:BootloaderSetHandler), "boolean (map)"),
        # command line help text for set action
        "help"    => _(
          "Set a global option"
        )
      },
      "print"   => {
        "handler" => fun_ref(
          method(:BootloaderPrintHandler),
          "boolean (map)"
        ),
        # command line help text for print action
        "help"    => _(
          "Print value of specified option"
        )
      }
    },
    "options"    => {
      "option" => {
        # command line help text for an option
        "help" => _(
          "The key of the option"
        ),
        "type" => "string"
      },
      "value"  => {
        # command line help text for an option
        "help" => _(
          "The value of the option"
        ),
        "type" => "string"
      }
    },
    "mappings"   => {
      "summary" => [],
      "delete"  => ["option"],
      "set"     => ["option", "value"],
      "print"   => ["option"]
    }
  }

  Builtins.y2milestone("Starting bootloader configuration module")
  ret = CommandLine.Run(cmdline)

  Builtins.y2milestone("Finishing bootloader configuration module")
  ret
end