Class: Bootloader::Stage1Proposal
- Inherits:
-
Object
- Object
- Bootloader::Stage1Proposal
- Includes:
- Yast::Logger
- Defined in:
- src/lib/bootloader/stage1_proposal.rb
Overview
Represents object that can set passed stage1 to proposed values. It is highly coupled with Stage1 class and it is recommended to use Stage1#proposal instead of direct usage of this class.
Defined Under Namespace
Constant Summary
- AVAILABLE_PROPOSALS =
rubocop:disable Style/MutableConstant default_proc conflict
{ # rubocop:disable Style/MutableConstant default_proc conflict "i386" => X64, "x86_64" => X64, "s390_32" => S390, "s390_64" => S390, "ppc" => PPC, "ppc64" => PPC }
Instance Attribute Summary (collapse)
-
- (Object) stage1
readonly
protected
Returns the value of attribute stage1.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Object) assign_bootloader_device(selected_location)
protected
Set “boot_*” flags in the globals map according to the boot device selected with parameter selected_location.
-
- (Stage1Proposal) initialize(stage1)
constructor
protected
A new instance of Stage1Proposal.
Constructor Details
- (Stage1Proposal) initialize(stage1) (protected)
Returns a new instance of Stage1Proposal
30 31 32 |
# File 'src/lib/bootloader/stage1_proposal.rb', line 30 def initialize(stage1) @stage1 = stage1 end |
Instance Attribute Details
- (Object) stage1 (readonly, protected)
Returns the value of attribute stage1
28 29 30 |
# File 'src/lib/bootloader/stage1_proposal.rb', line 28 def stage1 @stage1 end |
Class Method Details
+ (Object) propose(stage1)
17 18 19 20 21 22 23 24 |
# File 'src/lib/bootloader/stage1_proposal.rb', line 17 def self.propose(stage1) arch = Yast::Arch.architecture proposal = AVAILABLE_PROPOSALS[arch] proposal.new(stage1).propose log.info "proposed stage1 configuration #{stage1.inspect}" end |
Instance Method Details
- (Object) assign_bootloader_device(selected_location) (protected)
Set “boot_*” flags in the globals map according to the boot device selected with parameter selected_location. Only a single boot device can be selected with this function. The function cannot be used to set a custom boot device. It will always be deleted.
FIXME: `mbr_md is probably unneeded; AFA we can see, this decision is automatic anyway and perl-Bootloader should be able to make it without help from the user or the proposal.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'src/lib/bootloader/stage1_proposal.rb', line 46 def assign_bootloader_device(selected_location) log.info "assign bootloader device '#{selected_location.inspect}'" # first, default to all off: stage1.clear_devices case selected_location when :root then stage1.add_udev_device(Yast::BootStorage.RootPartitionDevice) when :boot then stage1.add_udev_device(Yast::BootStorage.BootPartitionDevice) when :extended then stage1.add_udev_device(extended_partition) when :mbr then stage1.add_udev_device(Yast::BootStorage.mbr_disk) when :none then log.info "Resetting bootloader device" when Array if selected_location.first != :custom raise "Unknown value to select bootloader device #{selected_location.inspect}" end stage1.model.add_device(selected_location[1]) # add directly proposed value without changes else raise "Unknown value to select bootloader device #{selected_location.inspect}" end end |