lib/cryptsetup.rb in getch-0.3.6 vs lib/cryptsetup.rb in getch-0.5.0

- old
+ new

@@ -1,7 +1,8 @@ require 'luks' +# Used to interact with dmcrypt class CryptSetup def initialize(devs, options) @boot = devs[:boot] @root = devs[:root] @home = devs[:home] @@ -80,11 +81,11 @@ luks = Luks::Home.new(@home, @options) luks.external_key end def config_boot - return if not @boot or @options[:fs] == 'zfs' + return if !@boot || @options[:fs] == 'zfs' Luks::Boot.new(@boot, @options).write_config end def config_root @@ -98,16 +99,17 @@ Luks::Home.new(@home, @options).write_config end def config_swap - uuid = @options[:lvm] ? '' : Getch::Helpers.uuid(@swap) + id = @options[:lvm] ? '' : Getch::Helpers.id(@swap) line = "swap-#{@luks}" - @options[:lvm] ? - line << " /dev/#{@vg}/swap" : - line << " UUID=#{uuid}" - - line << " /dev/urandom swap,discard,cipher=aes-xts-plain64:sha256,size=512" + line << if @options[:lvm] + " /dev/#{@vg}/swap" + else + " /dev/disk/by-id/#{id}" + end + line << ' /dev/urandom swap,discard,cipher=aes-xts-plain64:sha256,size=512' NiTo.echo_a "#{@mountpoint}/etc/crypttab", line end private