class Getch::FileSystem::Zfs::Config
Public Class Methods
new()
click to toggle source
Calls superclass method
Getch::FileSystem::Device::new
# File lib/getch/filesystem/zfs/config.rb, line 5 def initialize super gen_uuid @root_dir = MOUNTPOINT @init = '/usr/lib/systemd/systemd' end
Public Instance Methods
fstab()
click to toggle source
# File lib/getch/filesystem/zfs/config.rb, line 12 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/config.rb, line 32 def grub return if Helpers::efi? file = "#{@root_dir}/etc/default/grub" cmdline = [ "GRUB_CMDLINE_LINUX=\"resume=UUID=#{@uuid_swap} root=ZFS=#{@pool_name}/ROOT/#{@n} init=#{@init} dozfs\"" ] File.write("#{file}", cmdline.join("\n"), mode: 'a') end
systemd_boot()
click to toggle source
# File lib/getch/filesystem/zfs/config.rb, line 18 def systemd_boot return if ! Helpers::efi? esp = '/efi' dir = "#{@root_dir}/#{esp}/loader/entries/" datas_gentoo = [ 'title Gentoo Linux', 'linux /vmlinuz', 'initrd /initramfs', "options resume=UUID=#{@uuid_swap} root=ZFS=#{@pool_name}/ROOT/#{@n} init=#{@init} dozfs" ] File.write("#{dir}/gentoo.conf", datas_gentoo.join("\n")) end
Private Instance Methods
data_fstab()
click to toggle source
# File lib/getch/filesystem/zfs/config.rb, line 48 def data_fstab efi = @dev_esp ? "UUID=#{@uuid_esp} /efi vfat noauto,noatime 1 2" : '' swap = @dev_swap ? "UUID=#{@uuid_swap} none swap discard 0 0" : '' [ efi, swap ] end
gen_uuid()
click to toggle source
# File lib/getch/filesystem/zfs/config.rb, line 43 def gen_uuid @uuid_swap = `lsblk -o "UUID" #{@dev_swap} | tail -1`.chomp() @uuid_esp = `lsblk -o "UUID" #{@dev_esp} | tail -1`.chomp() if @dev_esp end