From 1bea0c5566a8b1e8a28f456d0aaf0dfd73dcec43 Mon Sep 17 00:00:00 2001 From: eiflera Date: Thu, 10 Apr 2014 13:52:46 +0200 Subject: [PATCH] Added proxy support Original change comes from GitHub-User <>/<>@<<01833f2adf4a14ed14ef32ac0d85790826947119>> Added default variables for 'proxy_user' and 'proxy_password' because this variables can be empty --- apt-mirror | 11 +++++++++-- mirror.list | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apt-mirror b/apt-mirror index 77e2b37..f16b08d 100755 --- a/apt-mirror +++ b/apt-mirror @@ -113,7 +113,9 @@ my %config_variables = ( "auth_no_challenge" => 0, "no_check_certificate" => 0, "unlink" => 0, - "postmirror_script" => '$var_path/postmirror.sh' + "postmirror_script" => '$var_path/postmirror.sh', + "proxy_user" => '', + "proxy_password" => '' ); my @config_binaries = (); @@ -228,7 +230,12 @@ sub download_urls if ( get_variable("auth_no_challenge") == 1 ) { push( @args, "--auth-no-challenge" ); } if ( get_variable("no_check_certificate") == 1 ) { push( @args, "--no-check-certificate" ); } if ( get_variable("unlink") == 1 ) { push( @args, "--unlink" ); } - + if ( length ( get_variable("use_proxy") ) && ( get_variable("use_proxy") eq 'yes' || get_variable("use_proxy") eq 'on' ) ) + { + if ( length ( get_variable("http_proxy") ) ) { push( @args, "-e use_proxy=yes"); push( @args, "-e http_proxy=" . get_variable( "http_proxy" ) ); } + if ( length ( get_variable("proxy_user") ) ) { push( @args, "-e proxy_user=" . get_variable( "proxy_user" ) ); } + if ( length ( get_variable("proxy_password") ) ) { push( @args, "-e proxy_password=" . get_variable( "proxy_password" ) ); } + } print "Downloading " . scalar(@urls) . " $stage files using $nthreads threads...\n"; while ( scalar @urls ) diff --git a/mirror.list b/mirror.list index f744cd0..a572b1b 100644 --- a/mirror.list +++ b/mirror.list @@ -9,6 +9,10 @@ set nthreads 20 set _tilde 0 # Use --unlink with wget (for use with hardlinked directories) set unlink 1 +set use_proxy off +set http_proxy 127.0.0.1:3128 +set proxy_user user +set proxy_password password deb http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse