Class: Bootloader::Sysconfig
- Inherits:
-
Object
- Object
- Bootloader::Sysconfig
- Includes:
- Yast::Logger
- Defined in:
- src/lib/bootloader/sysconfig.rb
Overview
Represents sysconfig file for bootloader usually located in /etc/sysconfig/bootloader
Constant Summary
- AGENT_PATH =
Yast::Path.new(".sysconfig.bootloader")
- ATTR_VALUE_MAPPING =
{ bootloader: "LOADER_TYPE", secure_boot: "SECURE_BOOT" }
- PROPOSED_COMMENTS =
{ bootloader: "\n" \ "## Path:\tSystem/Bootloader\n" \ "## Description:\tBootloader configuration\n" \ "## Type:\tlist(grub,grub2,grub2-efi,none)\n" \ "## Default:\tgrub2\n" \ "#\n" \ "# Type of bootloader in use.\n" \ "# For making the change effect run bootloader configuration tool\n" \ "# and configure newly selected bootloader\n" \ "#\n" \ "#\n", secure_boot: "\n" \ "## Path:\tSystem/Bootloader\n" \ "## Description:\tBootloader configuration\n" \ "## Type:\tyesno\n" \ "## Default:\t\"no\"\n" \ "#\n" \ "# Enable UEFI Secure Boot support\n" \ "# This setting is only relevant to UEFI which supports UEFI. It won't\n" \ "# take effect on any other firmware type.\n" \ "#\n" \ "#\n" }
Instance Attribute Summary (collapse)
-
- (Object) bootloader
specifies bootloader in sysconfig.
-
- (Object) secure_boot
boolean attribute if secure boot should be used.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Sysconfig) initialize(bootloader: nil, secure_boot: false)
constructor
A new instance of Sysconfig.
-
- (Object) pre_write
Specialized write before rpm install, that do not have switched SCR and work on blank system.
- - (Object) write
Constructor Details
- (Sysconfig) initialize(bootloader: nil, secure_boot: false)
Returns a new instance of Sysconfig
18 19 20 21 22 |
# File 'src/lib/bootloader/sysconfig.rb', line 18 def initialize(bootloader: nil, secure_boot: false) @sys_agent = AGENT_PATH @bootloader = bootloader @secure_boot = secure_boot end |
Instance Attribute Details
- (Object) bootloader
specifies bootloader in sysconfig
14 15 16 |
# File 'src/lib/bootloader/sysconfig.rb', line 14 def bootloader @bootloader end |
- (Object) secure_boot
boolean attribute if secure boot should be used
16 17 18 |
# File 'src/lib/bootloader/sysconfig.rb', line 16 def secure_boot @secure_boot end |
Class Method Details
+ (Object) from_system
24 25 26 27 28 29 30 |
# File 'src/lib/bootloader/sysconfig.rb', line 24 def self.from_system bootloader = Yast::SCR.Read(AGENT_PATH + "LOADER_TYPE") # propose secure boot always to true (bnc#872054), otherwise respect user choice secure_boot = Yast::SCR.Read(AGENT_PATH + "SECURE_BOOT") != "no" new(bootloader: bootloader, secure_boot: secure_boot) end |
Instance Method Details
- (Object) pre_write
Specialized write before rpm install, that do not have switched SCR and work on blank system
34 35 36 37 38 39 |
# File 'src/lib/bootloader/sysconfig.rb', line 34 def pre_write ensure_file_exists_in_target temporary_target_agent do write end end |
- (Object) write
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'src/lib/bootloader/sysconfig.rb', line 67 def write log.info "Saving /etc/sysconfig/bootloader for #{bootloader}" write_option(:bootloader, bootloader) sb = secure_boot ? "yes" : "no" write_option(:secure_boot, sb) # flush write Yast::SCR.Write(sys_agent, nil) nil end |