class Getch::FileSystem::Zfs::Void

Attributes

boot_disk[R]

Public Class Methods

new() click to toggle source
Calls superclass method Getch::FileSystem::Zfs::Device::new
# File lib/getch/filesystem/zfs/void.rb, line 10
def initialize
  super
  hostid
  zfs_zed # mountpoint for zfs
end

Public Instance Methods

config_dracut() click to toggle source
# File lib/getch/filesystem/zfs/void.rb, line 30
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 \"",
    ""
  ]
  File.write(conf, content.join("\n"), mode: 'w', chmod: 0644)
end
config_grub() click to toggle source
# File lib/getch/filesystem/zfs/void.rb, line 45
def config_grub
  grub_cmdline("root=zfs:#{@pool_name}/ROOT/#{@n}", "zfs_force=1")
end
finish() click to toggle source
# File lib/getch/filesystem/zfs/void.rb, line 49
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/void.rb, line 21
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
  line_fstab(@dev_swap, "swap swap rw,noatime,discard 0 0") if @dev_swap
  #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/void.rb, line 41
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/void.rb, line 75
def hostid
  command "zgenhostid $(hostid)"
end
zed_update_path() click to toggle source
# File lib/getch/filesystem/zfs/void.rb, line 67
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/void.rb, line 57
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