diff --git a/aptsync/apt-mirror b/aptsync/apt-mirror index 4cc8ca3..d8b867e 100644 --- a/aptsync/apt-mirror +++ b/aptsync/apt-mirror @@ -129,6 +129,9 @@ my @childrens = (); my %skipclean = (); my %clean_directory = (); +# USTC mirror env +my $bind_address = $ENV{'BIND_ADDRESS'}; + ###################################################################################### ## Setting up $config_file variable @@ -263,7 +266,11 @@ sub download_urls if ( $pid == 0 ) { - exec 'wget', '--no-cache', '--limit-rate=' . get_variable("limit_rate"), '-t', '5', '-r', '-N', '-l', 'inf', '-o', get_variable("var_path") . "/$stage-log.$i", '-i', get_variable("var_path") . "/$stage-urls.$i", @args; + if (defined $bind_address) { + exec 'wget', '--bind-address', $bind_address, '--no-cache', '--limit-rate=' . get_variable("limit_rate"), '-t', '5', '-r', '-N', '-l', 'inf', '-o', get_variable("var_path") . "/$stage-log.$i", '-i', get_variable("var_path") . "/$stage-urls.$i", @args; + } else { + exec 'wget', '--no-cache', '--limit-rate=' . get_variable("limit_rate"), '-t', '5', '-r', '-N', '-l', 'inf', '-o', get_variable("var_path") . "/$stage-log.$i", '-i', get_variable("var_path") . "/$stage-urls.$i", @args; + } # shouldn't reach this unless exec fails die("\n\nCould not run wget, please make sure its installed and in your path\n\n"); diff --git a/aptsync/sync.sh b/aptsync/sync.sh index 3280bbb..96d821c 100755 --- a/aptsync/sync.sh +++ b/aptsync/sync.sh @@ -8,6 +8,7 @@ ## SET IN ENVIRONMENT VARIABLES #APTSYNC_URL= #APTSYNC_DISTS= +#BIND_ADDRESS= set -e [[ $DEBUG = true ]] && set -x