From c31448846df8326741195e0aaf1659b94c95aade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Mon, 25 Jan 2010 17:32:00 +0100 Subject: Add support for debootstrap-mirror and -suite --- pbuilder-apt-config | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'pbuilder-apt-config') diff --git a/pbuilder-apt-config b/pbuilder-apt-config index 2da6937..307e0ad 100755 --- a/pbuilder-apt-config +++ b/pbuilder-apt-config @@ -8,6 +8,7 @@ self="$(basename "$0")" # TODO # - support setting --mirror-map (for --profile) # - Debian security entries? +# - oldstable log() { echo "$@" >&2 @@ -106,6 +107,9 @@ output_sources() { } sources="" +debootstrap_suite="" +debootstrap_mirror="" + add_output_sources() { local output="$(output_sources "$@")" @@ -113,6 +117,33 @@ add_output_sources() { }$output" } +set_debootstrap_suite() { + local archive="$1" + local suite="$2" + + case "$archive" in + debian) + case "$suite" in + unstable) + debootstrap_suite="sid" + ;; + testing) + debootstrap_suite="squeeze" + ;; + stable) + debootstrap_suite="lenny" + ;; + *) + debootstrap_suite="$suite" + ;; + esac + ;; + *) + debootstrap_suite="$suite" + ;; + esac +} + getopt_output="`getopt -o "" -l help,with-sources::,arch:,components:,mirror:,suite:,pockets:,profile: -n "$self" -s sh -- "$@"`" eval set -- "$getopt_output" @@ -249,7 +280,7 @@ if [ -n "$profile" ]; then ;; esac ;; - ubuntu) + ubuntu|ubuntu-ports) if [ "$base_dist" != "${profile%%-*}" ]; then die "Unknown Ubuntu based profile=$profile" fi @@ -282,6 +313,8 @@ if [ -n "$profile" ]; then die "Unknown profile for base_archive=$base_archive" ;; esac + set_debootstrap_suite "$base_archive" "$base_dist" + debootstrap_mirror="$base_mirror" fi if [ -n "$suite" ]; then @@ -295,6 +328,12 @@ if [ -n "$suite" ]; then for pocket in $pockets; do add_output_sources "$with_sources" "$mirror" "$suite-$pocket" "$components" done + # NB: archive might be empty; best effort to try to guess it + if [ -z "$archive" ]; then + archive="`guess_dist_arch_archive "$suite" "$arch"`" 2>/dev/null || true + fi + set_debootstrap_suite "$archive" "$suite" + debootstrap_mirror="$mirror" fi command="$1" @@ -303,8 +342,10 @@ case $1 in echo "$sources" ;; debootstrap-mirror) + echo "$debootstrap_mirror" ;; debootstrap-suite) + echo "$debootstrap_suite" ;; *) usage -- cgit v1.2.3