Sha256: 515b427059a618492f890f1897c57600dabde51dc6be568a9654a979a515cb4e

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 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 --esp-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 --esp-path=#{@esp} install")
        NiTo.mount boot, "#{OPTIONS[:mountpoint]}/boot"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
getch-0.5.0 lib/getch/gentoo/bootloader.rb
getch-0.3.6 lib/getch/gentoo/bootloader.rb