Class: Bootloader::KernelAppendWidget

Inherits:
CWM::InputField
  • Object
show all
Defined in:
src/lib/bootloader/generic_widgets.rb

Overview

represents kernel command line

Instance Method Summary collapse

Constructor Details

#initializeKernelAppendWidget

Returns a new instance of KernelAppendWidget.



176
177
178
179
180
# File 'src/lib/bootloader/generic_widgets.rb', line 176

def initialize
  textdomain "bootloader"

  super
end

Instance Method Details

#helpObject



186
187
188
189
190
191
# File 'src/lib/bootloader/generic_widgets.rb', line 186

def help
  _(
    "<p><b>Optional Kernel Command Line Parameter</b> lets you define " \
    "additional parameters to pass to the kernel.</p>"
  )
end

#initObject



193
194
195
196
197
198
199
200
201
202
203
# File 'src/lib/bootloader/generic_widgets.rb', line 193

def init
  current_bl = ::Bootloader::BootloaderFactory.current
  case current_bl
  when ::Bootloader::SystemdBoot
    self.value = current_bl.kernel_params.serialize.gsub(/mitigations=\S+/, "")
  when ::Bootloader::Grub2Base
    self.value = current_bl.grub_default.kernel_params.serialize.gsub(/mitigations=\S+/, "")
  else
    disable
  end
end

#labelObject



182
183
184
# File 'src/lib/bootloader/generic_widgets.rb', line 182

def label
  _("O&ptional Kernel Command Line Parameter")
end

#storeObject



205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'src/lib/bootloader/generic_widgets.rb', line 205

def store
  return unless enabled?

  current_bl = ::Bootloader::BootloaderFactory.current
  case current_bl
  when ::Bootloader::SystemdBoot
    current_bl.kernel_params.replace(value)
  when ::Bootloader::Grub2Base
    current_bl.grub_default.kernel_params.replace(value)
  else
    log.error("Bootloader type #{current_bl} not found.")
  end
end