class Getch::FileSystem::Zfs::Encrypt::Void
Attributes
boot_disk[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
Getch::FileSystem::Zfs::Encrypt::Device::new
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 11 def initialize super hostid zfs_zed # mountpoint for zfs end
Public Instance Methods
config_dracut()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 31 def config_dracut conf = "#{MOUNTPOINT}/etc/dracut.conf.d/zfs.conf" # dracut: value+= should be surrounding by white space content = [ "hostonly=\"yes\"", "omit_dracutmodules+=\" btrfs lvm \"", "install_items+=\" /etc/crypttab \"", "" ] File.write(conf, content.join("\n"), mode: 'w', chmod: 0644) end
config_grub()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 47 def config_grub grub_cmdline("root=zfs:#{@pool_name}/ROOT/#{@n}", "zfs_force=1") end
crypttab()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 57 def crypttab line_crypttab("cryptswap", @dev_swap, "/dev/urandom", "swap,discard,cipher=aes-xts-plain64:sha256,size=512") end
finish()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 51 def finish zed_update_path puts "+ Enter in your system: chroot /mnt /bin/bash" puts "+ Reboot with: shutdown -r now" end
fstab()
click to toggle source
Fstab contain: > /efi noauto > swap > /boot zfs-legacy > /tmp
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 22 def fstab conf = "#{MOUNTPOINT}/etc/fstab" File.write(conf, "\n", mode: 'w', chmod: 0644) line_fstab(@dev_esp, "/efi vfat noauto,rw,relatime 0 0") if @dev_esp add_line(conf, "/dev/mapper/cryptswap none swap sw 0 0") add_line(conf, "##{@boot_pool_name}/BOOT/#{@n} /boot zfs defaults 0 0") if @dev_boot add_line(conf, "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0") end
kernel_cmdline_dracut()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 43 def kernel_cmdline_dracut #command "zfs set mountpoint=legacy #{@boot_pool_name}/BOOT/#{@n}" end
Private Instance Methods
hostid()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 89 def hostid command "zgenhostid $(hostid)" end
line_crypttab(mapname, dev, point, rest)
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 63 def line_crypttab(mapname, dev, point, rest) conf = "#{MOUNTPOINT}/etc/crypttab" device = s_uuid(dev) raise "No partuuid for #{dev} #{device}" if !device raise "Bad partuuid for #{dev} #{device}" if device.kind_of? Array add_line(conf, "#{mapname} PARTUUID=#{device} #{point} #{rest}") end
zed_update_path()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 81 def zed_update_path Dir.glob("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/*").each { |f| if !system("sed", "-Ei", "s|#{MOUNTPOINT}/?|/|", f) raise "System exec sed" end } end
zfs_zed()
click to toggle source
# File lib/getch/filesystem/zfs/encrypt/void.rb, line 71 def zfs_zed service_dir = "/etc/runit/runsvdir/default/" Helpers::mkdir("#{MOUNTPOINT}/etc/zfs/zfs-list.cache") Helpers::touch("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/#{@boot_pool_name}") if @dev_boot Helpers::touch("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/#{@pool_name}") fork { command "/etc/sv/zed/run" } command "ln -fs /etc/sv/zed #{service_dir}" end