Class: Getch::Gentoo::Stage
- Inherits:
-
Object
- Object
- Getch::Gentoo::Stage
- Defined in:
- lib/getch/gentoo/stage.rb
Instance Method Summary collapse
- #checksum ⇒ Object
- #control_files ⇒ Object
- #file ⇒ Object
- #get_stage3 ⇒ Object
-
#initialize ⇒ Stage
constructor
A new instance of Stage.
- #release ⇒ Object
- #stage3 ⇒ Object
Constructor Details
#initialize ⇒ Stage
Returns a new instance of Stage.
8 9 10 11 12 |
# File 'lib/getch/gentoo/stage.rb', line 8 def initialize @mirror = "https://mirrors.soeasyto.com/distfiles.gentoo.org" @release = release @stage_file="stage3-amd64-systemd-#{@release}.tar.xz" end |
Instance Method Details
#checksum ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/getch/gentoo/stage.rb', line 44 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 ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/getch/gentoo/stage.rb', line 35 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 ⇒ Object
24 25 26 |
# File 'lib/getch/gentoo/stage.rb', line 24 def file "#{@release}/#{@stage_file}" end |
#get_stage3 ⇒ Object
28 29 30 31 32 33 |
# File 'lib/getch/gentoo/stage.rb', line 28 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 ⇒ Object
18 19 20 21 22 |
# File 'lib/getch/gentoo/stage.rb', line 18 def release URI.open(stage3) do |file| file.read.match(/^[[:alnum:]]+/) end end |
#stage3 ⇒ Object
14 15 16 |
# File 'lib/getch/gentoo/stage.rb', line 14 def stage3 @mirror + '/releases/amd64/autobuilds/latest-stage3-amd64-systemd.txt' end |