class Getch::Gentoo::Stage
Public Class Methods
new()
click to toggle source
# File lib/getch/gentoo/stage.rb, line 7 def initialize @mirror = "https://mirrors.soeasyto.com/distfiles.gentoo.org" @release = release @stage_file="stage3-amd64-systemd-#{@release}.tar.xz" end
Public Instance Methods
checksum()
click to toggle source
# File lib/getch/gentoo/stage.rb, line 43 def checksum puts 'Check the SHA512 checksum.' command = "awk '/SHA512 HASH/{getline;print}' #{@stage_file}.DIGESTS.asc | sha512sum --check" _, stderr, status = Open3.capture3(command) if status.success? then puts "Checksum is ok" decompress cleaning else cleaning raise "Problem with the checksum, stderr\n#{stderr}" end end
control_files()
click to toggle source
# File lib/getch/gentoo/stage.rb, line 34 def control_files puts "Download the DIGESTS" Helpers::get_file_online(@mirror + "/releases/amd64/autobuilds/" + file + ".DIGESTS", "#{@stage_file}.DIGESTS") puts "Download the DIGESTS.asc" Helpers::get_file_online(@mirror + "/releases/amd64/autobuilds/" + file + ".DIGESTS.asc", "#{@stage_file}.DIGESTS.asc") puts "Download the CONTENTS.gz" Helpers::get_file_online(@mirror + "/releases/amd64/autobuilds/" + file + ".CONTENTS.gz", "#{@stage_file}.CONTENTS.gz") end
file()
click to toggle source
# File lib/getch/gentoo/stage.rb, line 23 def file "#{@release}/#{@stage_file}" end
get_stage3()
click to toggle source
# File lib/getch/gentoo/stage.rb, line 27 def get_stage3 Dir.chdir(MOUNTPOINT) return if File.exist?(@stage_file) puts "Download the last #{@stage_file}, please wait..." Helpers::get_file_online(@mirror + "/releases/amd64/autobuilds/" + file, @stage_file) end
release()
click to toggle source
# File lib/getch/gentoo/stage.rb, line 17 def release URI.open(stage3) do |file| file.read.match(/^[[:alnum:]]+/) end end
stage3()
click to toggle source
# File lib/getch/gentoo/stage.rb, line 13 def stage3 @mirror + '/releases/amd64/autobuilds/latest-stage3-amd64-systemd.txt' end
Private Instance Methods
cleaning()
click to toggle source
# File lib/getch/gentoo/stage.rb, line 66 def cleaning Dir.glob("stage3-amd64-systemd*").each do |f| File.delete(f) end end
decompress()
click to toggle source
wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage
# File lib/getch/gentoo/stage.rb, line 60 def decompress puts "Decompressing archive #{@stage_file}..." cmd = "tar xpf #{@stage_file} --xattrs-include=\'*.*\' --numeric-owner" Getch::Command.new(cmd).run! end