Sha256: 020a2dc5508ec718cc88917157a9ae60ee42e20ec027cc60b4e0568a5bc78ccd
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
require 'fileutils' module Getch module FileSystem class Mount def initialize @root_dir = MOUNTPOINT @boot_dir = "#{@root_dir}/boot" @boot_efi_dir = "#{@root_dir}/efi" @home_dir = "#{@root_dir}/home" @state = Getch::States.new() @log = Getch::Log.new end def swap(dev) return if ! dev if Helpers::grep?('/proc/swaps', /^\/dev/) exec("swapoff #{dev}") end exec("swapon #{dev}") end def root(dev) return if ! dev Helpers::mkdir(@root_dir) exec("mount #{dev} #{@root_dir}") end def esp(dev) return if ! dev Helpers::mkdir(@boot_efi_dir) exec("mount #{dev} #{@boot_efi_dir}") end def boot(dev) return if ! dev Helpers::mkdir(@boot_dir) exec("mount #{dev} #{@boot_dir}") end def home(dev) return if ! dev Helpers::mkdir(@home_dir) exec("mount #{dev} #{@home_dir}") end private def exec(cmd) @log.info("==> #{cmd}") Helpers::sys(cmd) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems