Sha256: 5ff4ebd531c716661b76c44664de9aa3e80fc8e011de9e09b359c651a7483716
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 KB
Contents
module Getch module FileSystem class Partition def initialize @log = Getch::Log.new end def gpt(dev) return if ! dev disk = disk_name(dev) part = dev.match(/[0-9]/) exec("sgdisk -n#{part}:1MiB:+1MiB -t#{part}:EF02 #{disk}") end def boot(dev) return if ! dev disk = disk_name(dev) part = dev.match(/[0-9]/) if Getch::OPTIONS[:fs] == "zfs" exec("sgdisk -n#{part}:0:+2G -t#{part}:BE00 #{disk}") else exec("sgdisk -n#{part}:0:+128MiB -t#{part}:8300 #{disk}") end end def efi(dev) return if ! dev disk = disk_name(dev) part = dev.match(/[0-9]/) exec("sgdisk -n#{part}:1M:+260M -t#{part}:EF00 #{disk}") end def swap(dev) return if ! dev disk = disk_name(dev) part = dev.match(/[0-9]/) if Getch::OPTIONS[:cache_disk] exec("sgdisk -n#{part}:0:0 -t#{part}:8200 #{disk}") else mem=`awk '/MemTotal/ {print $2}' /proc/meminfo`.chomp + 'K' exec("sgdisk -n#{part}:0:+#{mem} -t#{part}:8200 #{disk}") end end def root(dev, code) return if ! dev disk = disk_name(dev) part = dev.match(/[0-9]/) exec("sgdisk -n#{part}:0:0 -t#{part}:#{code} #{disk}") end def home(dev, code) return if ! dev disk = disk_name(dev) part = dev.match(/[0-9]/) if Getch::OPTIONS[:home_disk] exec("sgdisk -n#{part}:0:0 -t#{part}:#{code} #{disk}") end end private def disk_name(dev) dev.match(/[^0-9]+/) end def exec(cmd) @log.debug "Partition disk with #{cmd}" if Getch::OPTIONS[:encrypt] Helpers::sys(cmd) else Getch::Command.new(cmd).run! end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
getch-0.1.6 | lib/getch/filesystem/partition.rb |