class Getch::FileSystem::Zfs::Encrypt::Partition

Public Class Methods

new() click to toggle source
# File lib/getch/filesystem/zfs/encrypt/partition.rb, line 6
def initialize
  super
  @state = Getch::States.new()
  @clean = Getch::FileSystem::Clean
  @partition = Getch::FileSystem::Partition.new
  @log = Getch::Log.new()
  run
end

Public Instance Methods

run() click to toggle source
# File lib/getch/filesystem/zfs/encrypt/partition.rb, line 15
def run
  return if STATES[:partition ]
  @clean.old_zpool
  @clean.hdd(@disk)
  @clean.external_disk(@disk, @boot_disk, @cache_disk, @home_disk)

  partition
  cache
  @state.partition
end

Private Instance Methods

cache() click to toggle source
# File lib/getch/filesystem/zfs/encrypt/partition.rb, line 42
def cache
  if @cache_disk
    mem=`awk '/MemTotal/ {print $2}' /proc/meminfo`.chomp + 'K'
    exec("sgdisk -n1:0:+#{mem} -t1:8200 /dev/#{@cache_disk}")
    exec("sgdisk -n2:0:+4G -t2:BF07 /dev/#{@cache_disk}")
    exec("sgdisk -n3:0:0 -t3:BF08 /dev/#{@cache_disk}")
  end
end
exec(cmd) click to toggle source

Partition_bios None - Bios Boot Partition - 1MiB /boot - Boot - 8300 / - Root

# File lib/getch/filesystem/zfs/encrypt/partition.rb, line 60
def exec(cmd)
  @log.info("===> #{cmd}")
  Helpers::sys(cmd)
end
partition() click to toggle source
# File lib/getch/filesystem/zfs/encrypt/partition.rb, line 28
def partition
  if Helpers::efi?
    @partition.efi(@dev_esp)
    @partition.boot(@dev_boot) if Getch::OPTIONS[:os] == 'void'
    @partition.swap(@dev_swap) if !@cache_disk
    @partition.root(@dev_root, "BF00") if @root_part != 1
  else
    @partition.gpt(@dev_gpt)
    @partition.boot(@dev_boot)
    @partition.swap(@dev_swap) if !@cache_disk
    @partition.root(@dev_root, "BF00") if @root_part != 1
  end
end