diff options
author | B. Watson <yalhcru@gmail.com> | 2015-10-16 02:01:43 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2015-10-16 02:01:43 -0400 |
commit | d1cf05f126174fd6a36f26faf17823b2baf6e86d (patch) | |
tree | b4f1ecf5022873145250e32df72f9ad3adbec590 /sbosrcarch | |
parent | 6ac0db861e3ee0cb71a14108dc2cefe7e1962e7e (diff) | |
download | sbostuff-d1cf05f126174fd6a36f26faf17823b2baf6e86d.tar.gz |
sbosrcarch: make wget binary a config option
Diffstat (limited to 'sbosrcarch')
-rwxr-xr-x | sbosrcarch | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -295,7 +295,7 @@ use POSIX 'getcwd'; use File::Path qw/mkpath rmtree/; use File::Copy 'copy'; -our($sbogiturl, $sbogitdir, $archivedir, $maxfilemegs, +our($sbogiturl, $sbogitdir, $archivedir, $maxfilemegs, $wget, $wgetargs, $symlinks, $wgetrc_contents, $wgetrc, %user_agent_overrides, @trim_empty_dirs, $skipcount, $urlcount, $archivecount, $attemptcount, $failcount, $dlcount, $nowarchived, $coverage, @@ -352,6 +352,7 @@ sub read_config { } # quietly use defaults if missing: + $wget = "wget" unless defined $wget; $wgetargs = "" unless defined $wgetargs; $symlinks = "" unless defined $symlinks; @@ -515,7 +516,7 @@ sub toobig { sub wget_fake_head { my $url = shift; our $wget_config_arg; - my $cmd = "wget $wget_config_arg " . + my $cmd = "$wget $wget_config_arg " . "--tries 1 --quiet -O- --save-headers " . user_agent($url) . " " . " $wgetargs " . @@ -573,7 +574,7 @@ sub wget { if(not defined $wget_config_arg) { $wget_config_arg = ""; - open my $fh, "wget --help|" or die "can't run wget: $!\n"; + open my $fh, "$wget --help|" or die "can't run wget: $!\n"; while(<$fh>) { $wget_config_arg = "--config=$wgetrc" if /--config/; } @@ -591,7 +592,7 @@ sub wget { # TODO: open3? # the -O is there to force the filename, in case of a redirect. newer # versions of wget don't actually need this, but it doesn't hurt. - my $cmd = "wget $wget_config_arg " . + my $cmd = "$wget $wget_config_arg " . user_agent($url) . " " . ($head ? "--spider --tries 1" : "-O '" . url_to_filename($url) . "'") . " $wgetargs " . |