Class: Bootloader::TrustedBootWidget

Inherits:
CWM::CheckBox
  • Object
show all
Includes:
Grub2Widget
Defined in:
src/lib/bootloader/grub2_widgets.rb

Overview

Represents switcher for Trusted Boot

Instance Method Summary (collapse)

Methods included from Grub2Widget

#grub2, #grub_default, #password, #sections, #stage1

Constructor Details

- (TrustedBootWidget) initialize

Returns a new instance of TrustedBootWidget



289
290
291
# File 'src/lib/bootloader/grub2_widgets.rb', line 289

def initialize
  textdomain "bootloader"
end

Instance Method Details

- (Object) help



297
298
299
300
301
302
303
304
305
306
# File 'src/lib/bootloader/grub2_widgets.rb', line 297

def help
  # TRANSLATORS: TrustedGRUB2 is a name, don't translate it
  _("<p><b>Trusted Boot</b> will install TrustedGRUB2\n" \
    "instead of regular GRUB2.</p>\n" \
    "<p>It means measuring the integrity of the boot process,\n" \
    "with the help from the hardware (a TPM, Trusted Platform Module,\n" \
    "chip).</p>\n" \
    "<p>First you need to make sure Trusted Boot is enabled in the BIOS\n" \
    "setup (the setting may be named Security Chip, for example).</p>\n")
end

- (Object) init



308
309
310
# File 'src/lib/bootloader/grub2_widgets.rb', line 308

def init
  self.value = grub2.trusted_boot
end

- (Object) label



293
294
295
# File 'src/lib/bootloader/grub2_widgets.rb', line 293

def label
  _("Enable &Trusted Boot Support")
end

- (Object) store



312
313
314
# File 'src/lib/bootloader/grub2_widgets.rb', line 312

def store
  grub2.trusted_boot = value
end

- (Object) validate



316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'src/lib/bootloader/grub2_widgets.rb', line 316

def validate
  return true if Yast::Mode.config || !value
  tpm_files = Dir.glob("/sys/**/pcrs")
  if !tpm_files.empty?
    # check for file size does not work, since FS reports it 4096
    # even if the file is in fact empty and a single byte cannot
    # be read, therefore testing real reading (details: bsc#994556)
    return true unless File.read(tpm_files[0], 1).nil?
  end
  Yast::Popup.ContinueCancel(_("Trusted Platform Module not found.\n" \
                               "Make sure it is enabled in BIOS.\n" \
                               "The system will not boot otherwise."))
end