Sha256: ac6ea5f454e6b980ffec87c1043ef693533a2c9fe7cd356833643ff536840fcc

Contents?: true

Size: 988 Bytes

Versions: 3

Compression:

Stored size: 988 Bytes

Contents

# frozen_string_literal: true

module Fstab
  # configure fstab for encrypt
  class Encrypt < Root
    def initialize(devs, options)
      super
      @luks = options[:luks_name]
    end

    def write_boot
      @boot || return

      dm = Getch::Helpers.get_dm "boot-#{@luks}"
      uuid = gen_uuid dm
      line = "UUID=#{uuid} /boot #{@fs} defaults,nosuid,noexec,nodev 0 2"
      echo_a @conf, line
    end

    def write_swap
      @swap || return

      line = "/dev/mapper/swap-#{@luks} none swap rw,noatime,discard 0 0"
      echo_a @conf, line
    end

    def write_root
      @root || return

      dm = Getch::Helpers.get_dm "root-#{@luks}"
      uuid = gen_uuid dm
      line = "UUID=#{uuid} / #{@fs} defaults 1 1"
      echo_a @conf, line
    end

    def write_home
      @home || return

      dm = Getch::Helpers.get_dm "home-#{@luks}"
      uuid = gen_uuid dm
      line = "UUID=#{uuid} /home #{@fs} defaults,nosuid,nodev 0 2"
      echo_a @conf, line
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
getch-0.11.0 lib/fstab/encrypt.rb
getch-0.7.3 lib/fstab/encrypt.rb
getch-0.7.0 lib/fstab/encrypt.rb