Class: Fstab::Zfs

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

Overview

Generating fstab for zfs filesystem

Instance Method Summary collapse

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

Returns a new instance of Zfs.



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

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

Instance Method Details

#generateObject



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

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

#write_swapObject



18
19
20
21
22
23
24
25
26
# File 'lib/fstab/zfs.rb', line 18

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