class Getch::FileSystem::Zfs::Encrypt::Config
Public Class Methods
new()
click to toggle source
Calls superclass method
Getch::FileSystem::Zfs::Device::new
# File lib/getch/filesystem/zfs/encrypt/config.rb, line 6 def initialize super gen_uuid @root_dir = MOUNTPOINT @init = '/usr/lib/systemd/systemd' crypttab end
Public Instance Methods
crypttab()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/config.rb, line 33 def crypttab datas = [ "cryptswap PARTUUID=#{@partuuid_swap} /dev/urandom swap,discard,cipher=aes-xts-plain64:sha256,size=512" ] File.write("#{@root_dir}/etc/crypttab", datas.join("\n")) end
fstab()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/config.rb, line 14 def fstab file = "#{@root_dir}/etc/fstab" datas = data_fstab File.write(file, datas.join("\n")) end
grub()
click to toggle source
See wiki.gentoo.org/wiki/ZFS#ZFS_root
# File lib/getch/filesystem/zfs/encrypt/config.rb, line 41 def grub return if @efi file = "#{@root_dir}/etc/default/grub" cmdline = [ "GRUB_CMDLINE_LINUX=\"root=ZFS=#{@pool_name}/ROOT/#{@n} init=#{@init} dozfs keymap=#{Getch::OPTIONS[:keymap]}\"" ] File.write("#{file}", cmdline.join("\n"), mode: 'a') end
systemd_boot()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/config.rb, line 20 def systemd_boot return if ! @efi esp = '/efi' dir = "#{@root_dir}/#{esp}/loader/entries/" datas_gentoo = [ 'title Gentoo Linux', 'linux /vmlinuz', 'initrd /initramfs', "options root=ZFS=#{@pool_name}/ROOT/#{@n} init=#{@init} dozfs keymap=#{Getch::OPTIONS[:keymap]}" ] File.write("#{dir}/gentoo.conf", datas_gentoo.join("\n")) end
Private Instance Methods
data_fstab()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/config.rb, line 57 def data_fstab boot_efi = @dev_esp ? "UUID=#{@uuid_esp} /efi vfat noauto,noatime 1 2" : '' swap = @dev_swap ? "/dev/mapper/cryptswap none swap sw 0 0" : '' [ boot_efi, swap ] end
gen_uuid()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/config.rb, line 52 def gen_uuid @partuuid_swap = Helpers::partuuid(@dev_swap) @uuid_esp = `lsblk -o "UUID" #{@dev_esp} | tail -1`.chomp() if @dev_esp end