aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)