Sha256: 8f75a59a1c10e4d532dfba1c8c1ac9d9681ab466f44892d6a74f40b6f5c90b22

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# lib/use_flag.rb

module Getch::Gentoo
  class UseFlag
    def initialize
      @efi = Helpers::efi?
    end

    def apply
      systemd
      kmod
      grub
      zfs
      lvm
      cryptsetup
    end

    private

    def systemd
      flags = []
      use = Getch::Gentoo::Use.new('sys-apps/systemd')
      flags << 'dns-over-tls'
      flags << 'gnuefi' if @efi
      use.add(flags)
    end

    def kmod
      use = Getch::Gentoo::Use.new('sys-apps/kmod')
      use.add('zstd', 'lzma')
    end

    def grub
      return if @efi
      flags = []
      use = Getch::Gentoo::Use.new('sys-boot/grub')
      flags << '-grub_platforms_efi-64'
      flags << 'libzfs' if Getch::OPTIONS[:fs] == 'zfs'
      flags << 'device-mapper' if Getch::OPTIONS[:fs] == 'lvm'
      use.add(flags)
    end

    def zfs
      return unless Getch::OPTIONS[:fs] == 'zfs'
      use = Getch::Gentoo::Use.new('sys-fs/zfs-kmod')
      use.add('rootfs')
      use = Getch::Gentoo::Use.new('sys-fs/zfs')
      use.add('rootfs')
    end

    def lvm
      return unless Getch::OPTIONS[:fs] == 'lvm'
      use = Getch::Gentoo::Use.new
      use.add_global('lvm', 'device-mapper')
    end

    def cryptsetup
      return unless Getch::OPTIONS[:encrypt]
      use = Getch::Gentoo::Use.new
      use.add_global('cryptsetup')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
getch-0.1.6 lib/getch/gentoo/use_flag.rb