Class: Fstab::Encrypt

Inherits:
Root
  • Object
show all
Defined in:
lib/fstab/encrypt.rb

Overview

configure fstab for encrypt

Direct Known Subclasses

Hybrid

Instance Method Summary collapse

Methods inherited from Root

#generate

Methods included from NiTo

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

Constructor Details

#initialize(devs, options) ⇒ Encrypt

Returns a new instance of Encrypt.



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

def initialize(devs, options)
  super
  @luks = options[:luks_name]
end

Instance Method Details

#write_bootObject



11
12
13
14
15
16
17
18
# File 'lib/fstab/encrypt.rb', line 11

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

#write_homeObject



36
37
38
39
40
41
42
43
# File 'lib/fstab/encrypt.rb', line 36

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

#write_rootObject



27
28
29
30
31
32
33
34
# File 'lib/fstab/encrypt.rb', line 27

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

#write_swapObject



20
21
22
23
24
25
# File 'lib/fstab/encrypt.rb', line 20

def write_swap
  @swap || return

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