Skip to content

Commit

Permalink
aptsync: add BIND_ADDRESS support
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky committed May 18, 2024
1 parent 8abafc7 commit bbae205
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion aptsync/apt-mirror
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions aptsync/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
## SET IN ENVIRONMENT VARIABLES
#APTSYNC_URL=
#APTSYNC_DISTS=
#BIND_ADDRESS=

set -e
[[ $DEBUG = true ]] && set -x
Expand Down

0 comments on commit bbae205

Please sign in to comment.