From cdba39ac084f70a07e656cb95e08011f58e3ccae Mon Sep 17 00:00:00 2001 From: Slack Coder Date: Tue, 5 Mar 2019 08:58:06 +0100 Subject: FIX: Ensure new signatures are downloaded Overwrite all files when downloaded. This fixes an issue where the signature file for CHECKSUMS.md5 was not being updated. --- not-slackware.com | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/not-slackware.com b/not-slackware.com index 78cb97a..fb0bc4a 100755 --- a/not-slackware.com +++ b/not-slackware.com @@ -10,10 +10,6 @@ require "time" # TODO: Rename command to slackware.com # TODO: Silence when backgrounded like 'scp' # BUG: File verification with Checksums appears to fail when QUIET is enabled, -# BUG: CHECKSUMS file not being correctly downloaded after update: -# This is because 'wget' does not replace downloaded signature files as -# expected, resulting in a verification error. Maybe the 'download' function -# should be changed? env_vars = {} ROOT = ENV["ROOT"] || "/" @@ -283,13 +279,16 @@ class Local return nil end - def self.download(mirror, dest, file_path) + def self.download(src, dst = nil) + dst = File.basename(src) unless dst + dst = File.join(dst, File.basename(src)) if File.directory?(dst) + File.unlink(dst) if File.exists?(dst) + command = ["wget", - "--directory-prefix", dest, - url + "-O", dst, + src ] command << "--quiet" if QUIET == "true" - ok = system(*command) ok ? nil : DownloadError.new(url) end @@ -300,15 +299,13 @@ class Local if File.extname(file_name) == ".txz" || file_name == CHECKSUMS remote_file_path_sig = "#{remote_file_path}.asc" local_file_path_sig = File.join(CACHE, "#{file_name}.asc") - err = download(mirror, CACHE, remote_file_path_sig) + err = self.download(File.join(mirror, remote_file_path_sig), CACHE) File.unlink(local_file_path_sig) if err && File.exist?(local_file_path_sig) return err if err end file_name = File.basename(remote_file_path) - puts "downloading #{remote_file_path}" - err = self.download(mirror, CACHE, remote_file_path) - puts "erorr" if err + err = self.download(File.join(mirror, remote_file_path), CACHE) return err if err local_file_path = File.join(CACHE, file_name) -- cgit v1.2.3