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

Bug#576634: live-helper: Try to guess the user's preferred mirror from sources.list.

Package: live-helper
Version: 2.0~a9-1
Severity: normal
Tags: patch

  I noticed that live-helper defaults to using a mirror in Germany.  It seems like
it would be better to use the same mirror that the user's system is taking its
packages from.  Obviously we can't know that in general (well, except for copying
sources.list, but that has its own issues), but in the common case, Debian systems
get their apt sources from a mirror that looks like this:

deb http://http.XX.debian.org/debian(... more stuff)

  I suggest just taking the first such line from sources.list and using it to
determine the mirror, and I've attached a patch (admittedly a bit ugly, but it
should illustrate what I mean) that uses grep and sed to acheive this goal.


-- Package-specific info:

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-3-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages live-helper depends on:
ii  debootstrap                   1.0.22     Bootstrap a basic Debian system

Versions of packages live-helper recommends:
ii  cpio                          2.11-1     GNU cpio -- a program to manage ar
ii  gettext-base                  0.17-10    GNU Internationalization utilities

Versions of packages live-helper suggests:
ii  dosfstools                 3.0.9-1       utilities for making and checking 
ii  fakeroot                   1.14.4-1      Gives a fake root environment
ii  genisoimage                9:1.1.10-1    Creates ISO-9660 CD-ROM filesystem
pn  memtest86+ | memtest86     <none>        (no description available)
ii  mtools                     4.0.12-1      Tools for manipulating MSDOS files
ii  parted                     2.2-3         The GNU Parted disk partition resi
pn  squashfs-tools | genext2fs <none>        (no description available)
ii  sudo                       1.7.2p5-1     Provide limited super user privile
ii  syslinux                   2:3.86+dfsg-1 utilities for the syslinux bootloa
pn  uuid-runtime               <none>        (no description available)
pn  win32-loader               <none>        (no description available)

-- no debconf information
--- defaults.sh.orig	2010-03-12 07:19:52.000000000 -0800
+++ defaults.sh	2010-04-05 20:19:43.325448780 -0700
@@ -7,6 +7,18 @@
 # This is free software, and you are welcome to redistribute it
 # under certain conditions; see COPYING for details.
+# Read /etc/apt/sources.list and grab the first line of the form
+# deb http://http.XX.debian.org/debian/
+# to guess what the user's preferred Debian mirror is.
+    (egrep -m1 '^\s*deb\s*(http|ftp)://(http|ftp)\.[a-zA-Z_]+\.debian\.org/debian' /etc/apt/sources.list
+     echo http://http.de.debian.org/debian) |
+    sed 's%^\s*deb\s*\(http\|ftp\)://\(http\|ftp\)\.\([a-zA-Z_]\+\)\..*$%http://ftp.\3.debian.org/debian/%'
 Set_defaults ()
 	## config/common
@@ -284,7 +296,7 @@
 		case "${LH_MODE}" in
-				LH_MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian/";
+				LH_MIRROR_BOOTSTRAP=$(infer_main_mirror_from_apt_sources)

Reply to: