From cea763b669ddfa52cd4f5d249b59c109fc2c168c Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Mon, 17 May 2010 02:52:19 +0200 Subject: [PATCH] Let --mirror overrule per-distro mirror defaults Previously the --mirror value was ignored if a default mirror for the --dist value has been defined. Now the --mirror value is by default unset and filled with the per-distro default mirror in that case. --- bin/xen-create-image | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/bin/xen-create-image b/bin/xen-create-image index f2cac79..59fa744 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -1213,7 +1213,7 @@ sub setupDefaultOptions # Default distribution is Debian Stable $CONFIG{ 'dist' } = 'stable'; - $CONFIG{ 'mirror' } = 'http://ftp.debian.org/debian'; + $CONFIG{ 'mirror' } = ''; # Initialize per distribution mirror defaults: Debian foreach my $debdist (qw(etch lenny squeeze sid testing stable unstable)) { @@ -1598,9 +1598,20 @@ sub checkArguments # Sarge amd64 needs different default mirror # if ( $CONFIG{ 'dist' } =~ /sarge/ and - $CONFIG{ 'mirror' } eq 'http://archive.debian.org/debian' ) + $CONFIG{ 'mirror_sarge' } eq 'http://archive.debian.org/debian' ) { - $CONFIG{ 'mirror' } = 'http://amd64.debian.net/debian'; + $CONFIG{ 'mirror_sarge' } = 'http://amd64.debian.net/debian'; + } + + # + # If no mirror is set, use the default per-distro mirror + # + my $distMirror = "mirror_" . $CONFIG{ 'dist' }; + if ( !$CONFIG{ 'mirror' } and + $CONFIG{ $distMirror } and + length( $CONFIG{ $distMirror } ) ) + { + $CONFIG{ 'mirror' } = $CONFIG{ $distMirror }; } # @@ -3138,14 +3149,6 @@ sub mountImage sub installSystem { - # - # We might have a per-distro mirror. - my $distMirror = "mirror_" . $CONFIG{ 'dist' }; - if ( $CONFIG{ $distMirror } && length( $CONFIG{ $distMirror } ) ) - { - $CONFIG{ 'mirror' } = $CONFIG{ $distMirror }; - } - # # # Basic command