aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlack Coder <slackcoder@server.ky>2019-03-05 08:58:06 +0100
committerSlack Coder <slackcoder@server.ky>2019-03-05 08:58:06 +0100
commitcdba39ac084f70a07e656cb95e08011f58e3ccae (patch)
tree135720626d15ccab31bd4cf5dae11ce5ca8fb3b4
parent98675c3de64fc54a2dc7422178249913faf11c66 (diff)
downloadslackware.com-client-cdba39ac084f70a07e656cb95e08011f58e3ccae.tar.gz
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.
-rwxr-xr-xnot-slackware.com21
1 files 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)