lib/getch/void/tarball.rb in getch-0.3.6 vs lib/getch/void/tarball.rb in getch-0.5.0
- old
+ new
@@ -2,14 +2,15 @@
require 'open3'
module Getch
module Void
+ # Download the last tarball of void
class Tarball
def initialize
@log = Log.new
- @url = 'https://alpha.de.repo.voidlinux.org/live/current'
+ @url = 'https://repo-default.voidlinux.org/live/current'
@file = 'sha256sum.txt'
@xbps = false
Dir.chdir OPTIONS[:mountpoint]
end
@@ -21,13 +22,15 @@
end
protected
def tarball
- OPTIONS[:musl] ?
- /void-x86_64-musl-ROOTFS-[\d._]+.tar.xz/ :
+ if OPTIONS[:musl]
+ /void-x86_64-musl-ROOTFS-[\d._]+.tar.xz/
+ else
/void-x86_64-ROOTFS-[\d._]+.tar.xz/
+ end
end
# Search the name of the last release in @file 'sha256sum.txt'
# Should find a line like this:
# SHA256 (void-x86_64-ROOTFS-20210930.tar.xz) = 8681b060e39e173682e1721a6088280c2b6eade628f5e5e3e8e4b74163d187f6
@@ -55,11 +58,11 @@
def checksum
@log.info 'Checking SHA256 checksum...'
# Should contain 2 spaces...
command = "echo #{@xbps[3]} #{@xbps[1]} | sha256sum --check"
_, stderr, status = Open3.capture3(command)
- if status.success? then
+ if status.success?
@log.result_ok
else
cleaning
@log.fatal "Problem with the checksum, relaunch getch.\n#{stderr}"
end
@@ -74,10 +77,10 @@
def decompress
@log.info "Decompressing #{@xbps[1]}..."
cmd = "tar xpf #{@xbps[1]} --xattrs-include=\'*.*\' --numeric-owner"
_, stderr, status = Open3.capture3(cmd)
- if status.success? then
+ if status.success?
@log.result_ok
else
@log.fatal "Fail to decompressing #{@xbps[1]} - #{stderr}."
end
end