Package: debian-installer Version: 20150828 Severity: normal Tags: patch Instead of caching apt-config's output and piping through sed, it seems simpler to use apt-config's support for providing the information for evaluation by the shell. The â/fâ modifier on the end of the config name makes apt-config provide the full path as a filename (i.e., no trailing slash).
-- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.1.0-2-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)
>From e6835a537c27c5815e361eb58fd88bb233d5582e Mon Sep 17 00:00:00 2001 From: James McCoy <james...@debian.org> Date: Tue, 1 Sep 2015 20:13:10 -0400 Subject: [PATCH] Use apt-config's shell command to get sourcelist/sourceparts Signed-off-by: James McCoy <james...@debian.org> --- build/util/gen-sources.list.udeb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/build/util/gen-sources.list.udeb b/build/util/gen-sources.list.udeb index 26a0ac2..715dc68 100755 --- a/build/util/gen-sources.list.udeb +++ b/build/util/gen-sources.list.udeb @@ -45,20 +45,14 @@ get_mirrors() { done } -# Cache the apt configuration dump, with only the needed namespace -APT_CONFIG=$(apt-config dump | grep '^Dir::Etc') - -# Get the system apt directory -APT_DIR_ETC=$(echo "$APT_CONFIG" | sed -n -e 's/^Dir::Etc *\"\(.*\)\";$/\1/p') - # Fetch APT's sources.list -APT_SOURCELIST=$(echo "$APT_CONFIG" | sed -n -e 's/^Dir::Etc::sourcelist *\"\(.*\)\";$/\1/p') +eval $(apt-config shell APT_SOURCELIST Dir::Etc::sourcelist/f) # Fetch APT' sources.list.d -APT_SOURCEPARTS=$(echo "$APT_CONFIG" | sed -n -e 's/^Dir::Etc::sourceparts *\"\(.*\)\";$/\1/p') +eval $(apt-config shell APT_SOURCEPARTS Dir::Etc::sourceparts/f) # Also use mirrors defined in files in $SOURCES_LIST.d/ -MIRRORS="$(get_mirrors $SOURCES_LIST /$APT_DIR_ETC/$APT_SOURCELIST /$APT_DIR_ETC/$APT_SOURCEPARTS/*)" +MIRRORS="$(get_mirrors $SOURCES_LIST $APT_SOURCELIST $APT_SOURCEPARTS/*)" if ! which 'wget' >/dev/null; then echo "ERROR: the command wget is not available; please install it" >&2 -- 2.5.1