Sha256: b1fd85e4ffc8df3a2c6ed4765e6672287f4f06f68eaba886ae8337f10fd0f539

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

module Getch
  module Gentoo
    class Bootloader
      def initialize
        @esp = '/efi'
        @boot = DEVS[:boot] ||= nil
        @encrypt = OPTIONS[:encrypt] ||= false
      end

      # Dracut is used by sys-kernel/gentoo-kernel
      def dependencies
        Install.new('app-shells/dash')
        if Helpers.systemd? and Helpers.efi?
          Log.new.info "Systemd-boot alrealy installed...\n"
        else
          ChrootOutput.new('emerge --update --newuse sys-boot/grub')
        end
      end

      def install
        Helpers.grub? ?
          Config::Grub.new :
          bootctl

        #ChrootOutput.new('emerge --config sys-kernel/gentoo-kernel')
        ChrootOutput.new('emerge --config sys-kernel/gentoo-kernel-bin')
      end

      def bootctl
        @boot ?
          with_boot :
          Chroot.new("bootctl --path #{@esp} install")
      end

      # We need to umount the encrypted /boot first
      # https://github.com/systemd/systemd/issues/16151
      def with_boot
        boot = @encrypt ? '/dev/mapper/boot-luks' : "/dev/#{DEVS[:boot]}"
        NiTo.umount "#{OPTIONS[:mountpoint]}/boot"
        Chroot.new("bootctl --path #{@esp} install")
        NiTo.mount boot, "#{OPTIONS[:mountpoint]}/boot"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
getch-0.3.5 lib/getch/gentoo/bootloader.rb
getch-0.3.4 lib/getch/gentoo/bootloader.rb
getch-0.3.3 lib/getch/gentoo/bootloader.rb
getch-0.3.0 lib/getch/gentoo/bootloader.rb