class Getch::FileSystem::Zfs::Mount

Public Class Methods

new() click to toggle source
Calls superclass method Getch::FileSystem::Zfs::Device::new
# File lib/getch/filesystem/zfs/mount.rb, line 5
def initialize
  super
  @mount = Getch::FileSystem::Mount.new
  @state = Getch::States.new
  @log = Getch::Log.new
end

Public Instance Methods

run() click to toggle source
# File lib/getch/filesystem/zfs/mount.rb, line 12
def run
  return if STATES[:mount]
  exec("zpool export -a")
  exec("rm -rf #{MOUNTPOINT}/*")
  exec("zpool import -N -R #{MOUNTPOINT} #{@pool_name}")
  exec("zpool import -f -N -R #{MOUNTPOINT} #{@boot_pool_name}") if @dev_boot
  @mount.swap(@dev_swap)
  mount_root
  mount_boot
  @mount.esp(@dev_esp)
  exec("zfs mount -a")
  @state.mount
end

Private Instance Methods

exec(cmd) click to toggle source
# File lib/getch/filesystem/zfs/mount.rb, line 38
def exec(cmd)
  @log.info("==> #{cmd}")
  Helpers::sys(cmd)
end
mount_boot() click to toggle source
# File lib/getch/filesystem/zfs/mount.rb, line 33
def mount_boot
  return if ! @dev_boot
  exec("zfs mount #{@boot_pool_name}/BOOT/#{@n}")
end
mount_root() click to toggle source
# File lib/getch/filesystem/zfs/mount.rb, line 28
def mount_root
  Helpers::mkdir(MOUNTPOINT)
  exec("zfs mount #{@pool_name}/ROOT/#{@n}")
end