Sha256: c41ab530285c7bd3cee5e54dcec0e42870045195b49299b7bfa20c101856ea42

Contents?: true

Size: 860 Bytes

Versions: 5

Compression:

Stored size: 860 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 Getch::Helpers.runit? || Getch::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

5 entries across 5 versions & 1 rubygems

Version Path
getch-0.11.0 lib/fstab/hybrid.rb
getch-0.7.3 lib/fstab/hybrid.rb
getch-0.7.0 lib/fstab/hybrid.rb
getch-0.5.0 lib/fstab/hybrid.rb
getch-0.3.6 lib/fstab/hybrid.rb