aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xslackware.com11
1 files changed, 10 insertions, 1 deletions
diff --git a/slackware.com b/slackware.com
index 5fced45..4684c6b 100755
--- a/slackware.com
+++ b/slackware.com
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
require "time"
+require "uri"
# TODO: List changelog entries per package
# TODO: List mirrors
@@ -76,6 +77,11 @@ def exitOnError(arg)
exit(1)
end
+# is_onion checks the argument is a TOR host
+def is_onion(host)
+ %r{.onion$}.match(host) != nil
+end
+
def verifySynced(path)
unless File.exists?(path)
exitOnError(SyncRequiredError.new("#{path} not found"))
@@ -285,11 +291,14 @@ class Local
dst = File.join(dst, File.basename(src)) if File.directory?(dst)
File.unlink(dst) if File.exists?(dst)
+ src_uri = URI(src)
command = ["wget",
"-O", dst,
- src
+ src_uri.to_s,
]
command << "--quiet" if QUIET == "true"
+ command.unshift("torsocks") if is_onion(src_uri.host)
+
ok = system(*command)
ok ? nil : DownloadError.new(src)
end