Class: Fstab::Zfs

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

Instance Method Summary collapse

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) ⇒ Zfs

Returns a new instance of Zfs.



3
4
5
6
# File 'lib/fstab/zfs.rb', line 3

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

Instance Method Details

#generateObject



8
9
10
11
12
13
# File 'lib/fstab/zfs.rb', line 8

def generate
  @log.info 'Generating fstab...'
  write_efi
  write_swap
  @log.result_ok
end

#write_swapObject



15
16
17
18
19
20
21
# File 'lib/fstab/zfs.rb', line 15

def write_swap
  uuid = gen_uuid @swap
  @encrypt ?
    line = "/dev/mapper/swap-luks none swap sw 0 0" :
    line = "UUID=#{uuid} swap swap rw,noatime,discard 0 0"
  echo_a @conf, line
end