Sha256: fda903895cd2ce7abcd39a64809dcd47abab57343e16239f0c8caf437bde375e
Contents?: true
Size: 1.71 KB
Versions: 1
Compression:
Stored size: 1.71 KB
Contents
require 'fileutils' module Getch module FileSystem module Zfs module Encrypt class Mount < Getch::FileSystem::Zfs::Encrypt::Device def initialize super @root_dir = MOUNTPOINT @boot_dir = "#{@root_dir}/boot" @boot_efi_dir = "#{@root_dir}/boot/efi" @state = Getch::States.new() @log = Getch::Log.new end 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 -N -R #{MOUNTPOINT} #{@boot_pool_name}") if @dev_boot exec("zfs load-key -a") mount_swap mount_root mount_boot mount_boot_efi exec("zfs mount -a") @state.mount end private def mount_swap if Helpers::grep?('/proc/swaps', /^\/dev/) exec("swapoff #{@dev_swap}") end exec("swapon #{@dev_swap}") end def mount_root Helpers::mkdir(@root_dir) exec("zfs mount #{@pool_name}/ROOT/gentoo") end def mount_boot_efi return if ! @dev_boot_efi Helpers::mkdir(@boot_efi_dir) exec("mount #{@dev_boot_efi} #{@boot_efi_dir}") end def mount_boot return if ! @dev_boot Helpers::mkdir(@boot_dir) exec("zfs mount #{@boot_pool_name}/BOOT/gentoo") end def exec(cmd) @log.info("==> #{cmd}") Helpers::sys(cmd) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
getch-0.1.0 | lib/getch/filesystem/zfs/encrypt/mount.rb |