Sha256: 02d16339744a14a531cc0bb62dc1a02b96d54aca76fea4b24b8fd7f380ab7649

Contents?: true

Size: 846 Bytes

Versions: 4

Compression:

Stored size: 846 Bytes

Contents

module Fstab
  # Hybrid for Lvm + Encryption
  class Hybrid < Encrypt
    def initialize(devs, options)
      super
      @vg = options[:vg_name] ||= 'vg0'
      @luks = options[:luks_name]
    end

    # The swap UUID based on the lvm volume /dev/vg/swap
    def write_swap
      # The both use /etc/crypttab
      if Helpers.runit? or Helpers.systemd?
        echo_a @conf, "/dev/mapper/swap-#{@luks} none swap sw 0 0"
      else
        dm = Getch::Helpers.get_dm "#{@vg}-swap"
        uuid = Getch::Helpers.uuid dm
        line = "UUID=#{uuid} none swap sw 0 0"
        echo_a @conf, line
      end
    end

    def write_root
      line = "/dev/#{@vg}/root / #{@fs} rw,relatime 0 1"
      echo_a @conf, line
    end

    def write_home
      line = "/dev/#{@vg}/home /home #{@fs} rw,relatime 0 2"
      echo_a @conf, line
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
getch-0.3.5 lib/fstab/hybrid.rb
getch-0.3.4 lib/fstab/hybrid.rb
getch-0.3.3 lib/fstab/hybrid.rb
getch-0.3.0 lib/fstab/hybrid.rb