Class: Sgpg::Cryptsetup

Inherits:
Object
  • Object
show all
Defined in:
lib/sgpg/cryptsetup.rb

Overview

Control program cryptsetup

Defined Under Namespace

Classes: InvalidDisk

Instance Method Summary collapse

Constructor Details

#initialize(disk) ⇒ Cryptsetup

Returns a new instance of Cryptsetup.



10
11
12
13
14
15
# File 'lib/sgpg/cryptsetup.rb', line 10

def initialize(disk)
  raise "No disk #{disk} specified..." unless disk

  @disk = disk
  @mapname = 'sgpg'
end

Instance Method Details

#closeObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/sgpg/cryptsetup.rb', line 31

def close
  case Helper.auth?
  when :root
    close_with
  when :doas
    close_with 'doas'
  when :sudo
    close_with 'sudo'
  end
end

#openObject

Tails Linux make persistent volume on second partition ‘disk_name’2



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/sgpg/cryptsetup.rb', line 18

def open
  check_disk

  case Helper.auth?
  when :root
    open_with
  when :doas
    open_with 'doas'
  when :sudo
    open_with 'sudo'
  end
end