class Getch::FileSystem::Mount

Public Class Methods

new() click to toggle source
# File lib/getch/filesystem/mount.rb, line 6
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

Public Instance Methods

boot(dev) click to toggle source
# File lib/getch/filesystem/mount.rb, line 36
def boot(dev)
  return if ! dev
  Helpers::mkdir(@boot_dir)
  exec("mount #{dev} #{@boot_dir}")
end
esp(dev) click to toggle source
# File lib/getch/filesystem/mount.rb, line 30
def esp(dev)
  return if ! dev
  Helpers::mkdir(@boot_efi_dir)
  exec("mount #{dev} #{@boot_efi_dir}")
end
home(dev) click to toggle source
# File lib/getch/filesystem/mount.rb, line 42
def home(dev)
  return if ! dev
  Helpers::mkdir(@home_dir)
  exec("mount #{dev} #{@home_dir}")
end
root(dev) click to toggle source
# File lib/getch/filesystem/mount.rb, line 24
def root(dev)
  return if ! dev
  Helpers::mkdir(@root_dir)
  exec("mount #{dev} #{@root_dir}")
end
swap(dev) click to toggle source
# File lib/getch/filesystem/mount.rb, line 15
def swap(dev)
  return if ! dev
  if Helpers::grep?('/proc/swaps', /^\/dev/)
    exec("swapoff #{dev}")
  end

  exec("swapon #{dev}")
end

Private Instance Methods

exec(cmd) click to toggle source
# File lib/getch/filesystem/mount.rb, line 50
def exec(cmd)
  @log.info("==> #{cmd}")
  Helpers::sys(cmd)
end