class Getch::FileSystem::Zfs::Encrypt::Mount

Public Class Methods

new() click to toggle source
# File lib/getch/filesystem/zfs/encrypt/mount.rb, line 6
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/encrypt/mount.rb, line 13
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
  exec("zfs load-key -a")
  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/encrypt/mount.rb, line 39
def exec(cmd)
  @log.info("==> #{cmd}")
  Helpers::sys(cmd)
end
mount_boot() click to toggle source
# File lib/getch/filesystem/zfs/encrypt/mount.rb, line 34
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/encrypt/mount.rb, line 29
def mount_root
  Helpers::mkdir(MOUNTPOINT)
  exec("zfs mount #{@pool_name}/ROOT/#{@n}")
end