lib/getch/disk.rb in getch-0.0.2 vs lib/getch/disk.rb in getch-0.0.3
- old
+ new
@@ -4,14 +4,10 @@
@hdd = disk
@fs = fs
@state = Getch::States.new()
end
- def efi?
- Dir.exist? '/sys/firmware/efi/efivars'
- end
-
# https://wiki.archlinux.org/index.php/Securely_wipe_disk
def cleaning
return if STATES[:partition ]
puts
print "Cleaning data on #{@hdd}, can be long, avoid this on Flash Memory (SSD,USB,...) ? (n,y) "
@@ -23,13 +19,13 @@
end
end
def partition
return if STATES[:partition]
- system("wipefs -a /dev/#{@hdd}")
system("sgdisk --zap-all /dev/#{@hdd}")
- if efi? then
+ system("wipefs -a /dev/#{@hdd}")
+ if Helpers::efi? then
puts "Partition disk #{@hdd} for an EFI system"
partition_efi
else
puts "Partition disk #{@hdd} for a Bios system"
partition_bios
@@ -38,18 +34,16 @@
end
def format
return if STATES[:format]
puts "Format #{@hdd} with #{@fs}"
- if efi? then
- system("mkfs.vfat -F32 /dev/#{@hdd}1")
+ if Helpers::efi? then
+ system("mkfs.fat -F32 /dev/#{@hdd}1")
system("mkswap /dev/#{@hdd}2")
- system("swapon /dev/#{@hdd}2")
system("mkfs.ext4 /dev/#{@hdd}3")
system("mkfs.ext4 /dev/#{@hdd}4")
else
system("mkswap /dev/#{@hdd}2")
- system("swapon /dev/#{@hdd}2")
system("mkfs.ext4 /dev/#{@hdd}3")
system("mkfs.ext4 /dev/#{@hdd}4")
end
@state.format
end