Class: Fstab::Hybrid

Inherits:
Encrypt show all
Defined in:
lib/fstab/hybrid.rb

Overview

Hybrid for Lvm + Encryption

Instance Method Summary collapse

Methods inherited from Encrypt

#write_boot

Methods inherited from Root

#generate

Methods included from NiTo

cp, echo, echo_a, grep?, mkdir, mount, mount?, rm, search_proc_swaps, sed, sh, swapoff, swapoff_dm, touch, umount

Constructor Details

#initialize(devs, options) ⇒ Hybrid

Returns a new instance of Hybrid.



5
6
7
8
9
# File 'lib/fstab/hybrid.rb', line 5

def initialize(devs, options)
  super
  @vg = options[:vg_name] ||= 'vg0'
  @luks = options[:luks_name]
end

Instance Method Details

#write_homeObject



29
30
31
32
# File 'lib/fstab/hybrid.rb', line 29

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

#write_rootObject



24
25
26
27
# File 'lib/fstab/hybrid.rb', line 24

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

#write_swapObject

The swap UUID based on the lvm volume /dev/vg/swap



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fstab/hybrid.rb', line 12

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