Skip to content

Commit

Permalink
Merge pull request #306 from yast/jreidinger_config_files_proto
Browse files Browse the repository at this point in the history
do not use requirement that do not work with send
  • Loading branch information
jreidinger committed Apr 4, 2016
2 parents 37e61c4 + 402a17f commit 1ee7f08
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions src/lib/bootloader/grub2base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,12 @@
Yast.import "Storage"
Yast.import "StorageDevices"

# Refinement for suse specific attributes in GRUB2 default file
module GrubDefaultRefinement
refine ::CFA::Grub2::Default do
def suse_btrfs
generic_get("SUSE_BTRFS_SNAPSHOT_BOOTING")
end

def suse_btrfs=(value)
generic_set("SUSE_BTRFS_SNAPSHOT_BOOTING", value)
end
end
end

module Bootloader
# Common base for GRUB2 specialized classes
class Grub2Base < BootloaderBase
include Yast::Logger
include Yast::I18n

using GrubDefaultRefinement

# @!attribute password
# @return [::Bootloader::GRUB2Pwd] stored password configuration object
attr_reader :password
Expand Down Expand Up @@ -119,7 +104,8 @@ def propose
grub_default.recovery_entry.disable unless grub_default.recovery_entry.defined?
grub_default.distributor ||= ""
grub_default.default = "saved"
grub_default.suse_btrfs = "true" # always propose true as grub2 itself detect if btrfs used
# always propose true as grub2 itself detect if btrfs used
grub_default.generic_set("SUSE_BTRFS_SNAPSHOT_BOOTING", "true")

propose_serial

Expand Down Expand Up @@ -185,10 +171,14 @@ def merge_grub_default(other)
def merge_attributes(default, other)
# string attributes
[:serial_console, :terminal, :timeout, :hidden_timeout, :distributor,
:gfxmode, :theme, :suse_btrfs].each do |attr|
:gfxmode, :theme].each do |attr|
default.send((attr.to_s + "="), other.send(attr)) if other.send(attr)
end

# suse btrfs is suse specific so it is not in CFA
val = other.generic_get("SUSE_BTRFS_SNAPSHOT_BOOTING")
grub_default.generic_set("SUSE_BTRFS_SNAPSHOT_BOOTING", val) if val

# boolean attributes, instance of {CFA::Boolean}
[:os_prober, :cryptodisk].each do |attr|
default.send(attr).value = other.send(attr).enabled? if other.send(attr).defined?
Expand Down

0 comments on commit 1ee7f08

Please sign in to comment.