[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: use of release names in d-i



I wrote:
> It would probably work something like this: If debootstrap is told to
> use a suite that it does not have a script for, try calling
> download_release_indices. If that is able to download a release file for
> the suite, look for the codename. If there is a script for the codename,
> then use it (and try to avoid re-downloading the Release and Packages
> files again, probably). Else abort.

Patch attached. It does download the Release file an extra time if the
suite is one that must map to a code name. That could be fixed, but the
extra complexity may not be worth it.

-- 
see shy jo
diff -ur old/debootstrap-0.2.18/debian/changelog debootstrap-0.2.18/debian/changelog
--- old/debootstrap-0.2.18/debian/changelog	2003-11-14 09:19:28.000000000 -0500
+++ debootstrap-0.2.18/debian/changelog	2003-12-03 13:53:43.000000000 -0500
@@ -1,3 +1,9 @@
+debootstrap (0.2.19) unstable; urgency=low
+
+  * Add support for mapping from symbolic suite names to code names.
+
+ -- Joey Hess <joeyh@debian.org>  Wed,  3 Dec 2003 13:52:56 -0500
+
 debootstrap (0.2.18) unstable; urgency=low
 
   * Thanks to Steinar Gunderson and Matt Kraii for the NMU fixing some
diff -ur old/debootstrap-0.2.18/debootstrap debootstrap-0.2.18/debootstrap
--- old/debootstrap-0.2.18/debootstrap	2003-11-10 09:06:10.000000000 -0500
+++ debootstrap-0.2.18/debootstrap	2003-12-03 14:11:38.000000000 -0500
@@ -176,7 +176,19 @@
 fi
 
 if [ ! -e "$SCRIPT" ]; then
-  error 1 NOSCRIPT "No such script: %s" "$SCRIPT"
+  tmp_release="tmp.$$/Release"
+  on_exit "rm -rf tmp.$$"
+  (download_release_file $tmp_release 2>/dev/null) || true
+  if [ -e $tmp_release ]; then
+    SUITE=$(get_release_suite $tmp_release)
+    if [ "$SUITE" != "" ]; then
+      SCRIPT="$DEBOOTSTRAP_DIR/scripts/$SUITE"
+    fi
+  fi
+
+  if [ ! -e "$SCRIPT" ]; then
+    error 1 NOSCRIPT "No such script: %s" "$SCRIPT"
+  fi
 fi
 
 mkdir -p "$TARGET"
diff -ur old/debootstrap-0.2.18/functions debootstrap-0.2.18/functions
--- old/debootstrap-0.2.18/functions	2003-11-14 09:18:27.000000000 -0500
+++ debootstrap-0.2.18/functions	2003-12-03 13:50:57.000000000 -0500
@@ -324,9 +324,14 @@
   done | head -n 1
 }
 
-download_release_indices () {
+get_release_suite () {
+  local reldest="$1"
+  sed -n 's/^Codename: //p' < $reldest
+}
+
+download_release_file () {
+  local reldest=$1
   local m1=${MIRRORS%% *}
-  local reldest="$TARGET/$($DLDEST rel $SUITE $m1 dists/$SUITE/Release)"
   progress 0 100 DOWNREL "Downloading Release file"
   progress_next 100
   get "$m1/dists/$SUITE/Release" $reldest || 
@@ -348,6 +353,11 @@
     error 1 INVALIDREL "Invalid Release file, no valid components"
   fi
   progress 100 100 DOWNREL "Downloading Release file"
+}
+
+download_release_indices () {
+  local reldest="$TARGET/$($DLDEST rel $SUITE $m1 dists/$SUITE/Release)"
+  download_release_file $reldest
 
   local totalpkgs=0
   for c in $COMPONENTS; do

Attachment: signature.asc
Description: Digital signature


Reply to: