Index: CLFS/config
===================================================================
--- CLFS/config	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ CLFS/config	(revision 3e7af380e3c3837e41050fadaaad8ed5de630c02)
@@ -6,5 +6,4 @@
 #
 #####
-declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/lfs/conglomeration
 
 #--- Which target architecture you want to build for,
@@ -59,5 +58,5 @@
 
 #--- Extra files that need be copied to $JHALFSDIR
-FILES="patcheslist.xsl  packageslist.xsl"
+FILES=""
 
 #--- Default stylesheet
@@ -70,4 +69,2 @@
 MKFILE=$JHALFSDIR/Makefile
 
-#--- FTP/HTTP mirror used as fallback (full path)
-SERVER=ftp://anduin.linuxfromscratch.org/LFS/conglomeration
Index: FS/packageslist.xsl
===================================================================
--- CLFS/packageslist.xsl	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ 	(revision )
@@ -1,26 +1,0 @@
-<?xml version='1.0' encoding='ISO-8859-1'?>
-
-<!--$Id$ -->
-<!-- Get list of packages from the CLFS Book -->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    version="1.0">
-
-  <xsl:output method="text"/>
-
-  <xsl:template match="/">
-    <xsl:apply-templates select="//ulink"/>
-  </xsl:template>
-
-  <xsl:template match="ulink">
-      <!-- Packages. If some package don't have the string ".tar." in their
-      name, the next test must be fixed to match it also. Skip possible
-      duplicated URLs due that may be splitted for PDF output -->
-    <xsl:if test="(contains(@url, '.tar.') or contains(@url, '.tgz'))
-            and not(ancestor-or-self::*/@condition = 'pdf')">
-      <xsl:value-of select="@url"/>
-      <xsl:text>&#x0a;</xsl:text>
-    </xsl:if>
-  </xsl:template>
-
-</xsl:stylesheet>
Index: FS/patcheslist.xsl
===================================================================
--- CLFS/patcheslist.xsl	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-<?xml version='1.0' encoding='ISO-8859-1'?>
-
-<!--$Id$ -->
-<!-- Get list of patches from the CLFS Book -->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    version="1.0">
-
-  <xsl:output method="text"/>
-
-  <xsl:template match="/">
-    <xsl:apply-templates select="//ulink"/>
-  </xsl:template>
-
-  <xsl:template match="ulink">
-      <!-- Patches. Match only the patches and skip possible duplicated
-      URLs due that may be splitted for PDF output-->
-    <xsl:if test="contains(@url, '.patch')
-            and not(ancestor-or-self::*/@condition = 'pdf')">
-      <xsl:value-of select="@url"/>
-      <xsl:text>&#x0a;</xsl:text>
-    </xsl:if>
-  </xsl:template>
-
-</xsl:stylesheet>
Index: HLFS/config
===================================================================
--- HLFS/config	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ HLFS/config	(revision 3e7af380e3c3837e41050fadaaad8ed5de630c02)
@@ -6,5 +6,4 @@
 #
 #####
-declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/lfs/conglomeration
 
 #--- Which library model to use uclibc/glibc
@@ -29,5 +28,5 @@
 
 #--- Extra files that need be copied to $JHALFSDIR
-FILES="patcheslist.xsl"
+FILES=""
 
 #--- Default stylesheet
@@ -39,5 +38,2 @@
 #--- Name of the makefile
 MKFILE=$JHALFSDIR/Makefile
-
-#--- FTP/HTTP mirror used as fallback (full path)
-SERVER=ftp://anduin.linuxfromscratch.org/HLFS/conglomeration
Index: HLFS/master.sh
===================================================================
--- HLFS/master.sh	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ HLFS/master.sh	(revision 3e7af380e3c3837e41050fadaaad8ed5de630c02)
@@ -7,93 +7,4 @@
 ###          FUNCTIONS          ###
 ###################################
-
-
-#----------------------------#
-get_sources() {              #
-#----------------------------#
-  local IFS
-
-  # Test if the packages must be downloaded
-  if [ ! "$HPKG" = "1" ] ; then
-    return
-  fi
-
-  # Modify the 'internal field separator' to break on 'LF' only
-  IFS=$'\x0A'
-
-  if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
-  cd $BUILDDIR/sources
-
-  > MISSING_FILES.DMP  # Files not in md5sum end up here
-
-  if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
-  if [ -f MD5SUMS-$VERSION ] ; then rm MD5SUMS-$VERSION ; fi
-
-  # Retrieve the master md5sum file
-  download "" MD5SUMS
-
-  # Iterate through each package and grab it, along with any patches it needs.
-  for i in `cat $JHALFSDIR/packages` ; do
-    PKG=`echo $i | sed -e 's/-version.*//' \
-                       -e 's/uclibc/uClibc/' `
-
-    #
-    # How to deal with orphan packages..??
-    #
-    VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
-    case "$PKG" in
-      "gcc" )
-        download $PKG "gcc-core-$VRS.tar.bz2"
-        download $PKG "gcc-g++-$VRS.tar.bz2"
-        if [ ! "$TEST" = "0" ] ; then
-          download $PKG "gcc-testsuite-$VRS.tar.bz2" ;
-        fi
-        ;;
-
-      "glibc")
-        if [ "$MODEL" = "glibc" ] ; then
-          download $PKG "$PKG-$VRS.tar.bz2"
-          download $PKG "$PKG-libidn-$VRS.tar.bz2"
-        fi
-        ;;
-
-      "tcl" )
-        FILE="$PKG$VRS-src.tar.bz2" ; download $PKG $FILE ;;
-
-      "uclibc" )
-        if [ "$MODEL" = "uclibc" ] ; then
-          download $PKG "$PKG-$VRS.tar.bz2"
-        fi
-        ;;
-
-      "uClibc-locale" )
-        if [ "$MODEL" = "uclibc" ] ; then
-          FILE="$PKG-$VRS.tgz" ; PKG="uClibc"
-          download $PKG $FILE
-          # There can be no patches for this file
-          continue
-        fi
-        ;;
-
-      "uClibc-patch" )      continue ;;
-
-      * )
-        FILE="$PKG-$VRS.tar.bz2" ;  download $PKG $FILE ;;
-    esac
-
-    for patch in `grep "$PKG-&$PKG" $JHALFSDIR/patches` ; do
-      PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
-      download $PKG $PATCH
-    done
-
-  done
-
-  # .... U G L Y .... what to do with the grsecurity patch to the kernel..
-  download grsecurity `grep grsecurity $JHALFSDIR/patches`
-
-  if [[ -s $BUILDDIR/sources/MISSING_FILES.DMP ]]; then
-    echo  -e "\n\n${tab_}${RED} One or more files were not retrieved.\n${tab_} Check <MISSING_FILES.DMP> for names ${OFF}\n\n"
-  fi
-}
 
 
Index: FS/patcheslist.xsl
===================================================================
--- HLFS/patcheslist.xsl	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-<?xml version='1.0' encoding='ISO-8859-1'?>
-
-<!-- $Id$ -->
-<!-- Get list of patches from the HLFS Book -->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                version="1.0">
-
-  <xsl:output method="text"/>
-
-  <!-- What libc implentation must be used? -->
-  <xsl:param name="model" select="glibc"/>
-
-  <!-- No text needed -->
-  <xsl:template match="//text()">
-    <xsl:text/>
-  </xsl:template>
-
-  <!-- Just grab the url from the patches.xml file. Skip possible
-  duplicated URLs due that may be splitted for PDF output -->
-  <xsl:template match="//ulink">
-    <xsl:if test="(ancestor::varlistentry[@condition=$model]
-            or not(ancestor::varlistentry[@condition]))
-            and not(ancestor-or-self::*/@condition = 'pdf')">
-       <xsl:value-of select="@url"/>
-       <xsl:text>&#x0a;</xsl:text>
-    </xsl:if>
-  </xsl:template>
-
-</xsl:stylesheet>
Index: LFS/config
===================================================================
--- LFS/config	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ LFS/config	(revision 3e7af380e3c3837e41050fadaaad8ed5de630c02)
@@ -6,5 +6,4 @@
 #
 #####
-declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/lfs/conglomeration
 
 #--- Location of fstab file (if empty, a template is created)
@@ -33,5 +32,2 @@
 #--- Name of the makefile
 MKFILE=$JHALFSDIR/Makefile
-
-#--- FTP/HTTP mirror used as fallback (full path)
-SERVER=ftp://anduin.linuxfromscratch.org/LFS/conglomeration
Index: common/common-functions
===================================================================
--- common/common-functions	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ common/common-functions	(revision 3e7af380e3c3837e41050fadaaad8ed5de630c02)
@@ -506,8 +506,4 @@
         development)
            svn co $SVN/${svn_root}/trunk/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
-        alphabetical)
-           svn co $SVN/${svn_root}/branches/$LFSVRS/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
-        udev_update)
-           svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
       esac
       echo -ne "done\n"
@@ -526,67 +522,7 @@
 }
 
-
-#----------------------------#
-build_patches_file() {       # Supply a suitably formated list of patches.
-#----------------------------#
-  local saveIFS=$IFS
-  local IFS
-
-  rm -f patches
-
-  LOC_add_patches_entry() {
-    for f in `grep "/$1-" patcheslist_.wget`; do
-      basename $f | sed "s|${2}|\&${1}-version;|" >> patches
-    done
-  }
-
-  case ${PROGNAME} in
-    hlfs)
-         echo -n "Creating the HLFS ${L_arrow}${BOLD}$MODEL${R_arrow} specific patches file"
-         xsltproc --nonet \
-                  --xinclude \
-                  --stringparam model $MODEL \
-                  -o patcheslist_.wget \
-                  patcheslist.xsl \
-                  $BOOK/chapter04/patches.xml
-                  #> /dev/null 2>&1
-
-         # .... U G L Y .... what to do with the grsecurity patch to the kernel..
-         for f in `grep "/grsecurity-" patcheslist_.wget`; do
-           basename $f >> patches
-         done
-      ;;
-
-    clfs)  # Pull out a list of arch specific patches
-         echo -n "Creating CLFS ${L_arrow}${BOLD}$ARCH${R_arrow} specific patches file"
-         xsltproc -xinclude  \
-                  -o patcheslist_.wget \
-                  patcheslist.xsl \
-                  $BOOK/materials/${ARCH}-chapter.xml
-      ;;
-    *)  return
-  esac
-
-
-  IFS=$'\x0A'  # Modify the 'internal field separator' to break on 'LF' only
-  for f in `cat packages`; do
-    IFS=$saveIFS  # Restore the system defaults
-    LOC_add_patches_entry \
-    `echo $f | sed -e 's/-version//' \
-                   -e 's/-file.*//' \
-                   -e 's/"//g' \
-                   -e 's/uclibc/uClibc/'`
-  done
-
-  rm -f patcheslist_.wget
-
-  echo " ...OK"
-}
-
-
 #----------------------------#
 extract_commands() {         #
 #----------------------------#
-  local saveIFS=$IFS
 
   # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
@@ -652,5 +588,5 @@
                  -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
       ;;
-    *) exit 1
+    *) exit 1 ;;
   esac
 
@@ -660,60 +596,12 @@
   chmod -R +x $JHALFSDIR/${PROGNAME}-commands
 
-  # Grab the patches and package names.
-  for i in patches packages ; do
-    rm -f $i
-  done
-  #
+  # Create the packages file. We need it for proper Makefile creation
+  rm -f packages
   case "${PROGNAME}" in
     clfs)
-      ################################
-      # A LOCAL function
-      # xx_.wget contains arch specific files but in URL format
-      # Build a file with only arch specific files.. small ugly..
-      LOC_add_packages_entry() {
-        local fileMATCH aFILE
-
-	  # Deal with a non-standard format
-        if [[ "$1" = "clfs-bootscripts" ]]; then
-	  set -- "bootscripts-cross-lfs" $2
-	fi
-        fileMATCH="/$1"
-
-        # format.. Filename-Version  or FilenameVersion
-        for aFILE in `grep ${fileMATCH}-*[[:digit:]] packageslist_.wget`; do
-         # Block vim-x.x-lang file, will add it later based on config flag
-	 if [[ ! "${aFILE}" =~ "vim-$2-lang" ]]; then
-           echo "$1-version \"$2\"" >> packages
-	 fi
-        done
-      }
-      #################################
-
-      # We only want a list arch specific files..
-      # Unfortunately this script produces URL's which must be converted to a std format
-      echo -n "Creating CLFS ${L_arrow}${BOLD}${ARCH}${R_arrow} specific packages file"
-      xsltproc -xinclude  \
-               -o packageslist_.wget \
-               packageslist.xsl \
-               $BOOK/materials/${ARCH}-chapter.xml
-
-      # This has the correct format but contains packages from every book
+      echo -n "Creating <${PROGNAME}> specific packages file"
       grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \
                                                  -e 's@">@"@' \
-                                                 -e '/generic/d' > packages.tmp
-      # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
-      # separates each iteration by lines.
-      # Modify the 'internal field separator' to break on 'LF' only
-      IFS=$'\x0A'
-      for f in `cat packages.tmp`; do
-        IFS=$saveIFS  # Restore the system defaults
-        LOC_add_packages_entry \
-        `echo $f | sed -e 's/-version//' \
-                       -e 's/-file.*//' \
-                       -e 's/"//g'`
-     done
-
-     rm -f packageslist_.wget packages.tmp
-
+                                                 -e '/generic/d' > packages
      echo " ...OK"
      ;;
@@ -732,26 +620,6 @@
                                                -e 's@">@"@' \
                                                -e '/generic/d' >> packages
-      echo `grep "glibc" packages | sed 's@glibc@glibc-libidn@'` >> packages
-      echo `grep "udev-config-file" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@'` >> packages
       echo " ...OK"
       ;;
-  esac
-
-  # Download the vim-lang package if it must be installed
-  if [ "$VIMLANG" = "1" ] && [ ! "$PROGNAME" = "hlfs" ] ; then
-    echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages
-  fi
-
-  # Create the patches file
-  case "${PROGNAME}" in
-    hlfs)
-      build_patches_file ;;
-    clfs )
-      build_patches_file ;;
-    lfs)
-      grep "^<\!ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
-      ;;
-    blfs) ;;
-    *) exit 1
   esac
 
@@ -762,119 +630,127 @@
 
 #----------------------------#
-download() {                 # Download file, write name to MISSING_FILES.DMP if an error
-#----------------------------#
-  cd $BUILDDIR/sources
-
-  # Hackish fix for the bash-doc, glibc-{linuxthreads,libidn}
-  # that don't conform to norms in the URL scheme.
-  DIR=`echo $1 | sed 's@-doc@@;s@-linuxthreads@@;s@-libidn@@;s@-testsuite@@'`
-
-  # If the file exists in the archive copy it to the $BUILDDIR/sources dir
-  # MD5SUM is assumed to be correct from previous download
-  if [ ! -z ${SRC_ARCHIVE} ] &&
-     [   -d ${SRC_ARCHIVE} ] &&
-     [   -f ${SRC_ARCHIVE}/$2 ]; then
-    cp ${SRC_ARCHIVE}/$2 .
-    echo "$2: -- ok"
-    return
-  fi
-
-  # Find the md5 sum for this package.
-  if [ $2 != MD5SUMS ] ; then
-    set +e
-    MD5=`grep "  $2" MD5SUMS`
-    if [ $? -ne 0 ]; then
-      set -e
-      echo "${RED}$2 not found in MD5SUMS${OFF}"
-      echo "$2 not found in MD5SUMS" >> MISSING_FILES.DMP
-      return
+get_sources() {              # Download file, write name to MISSING_FILES.DMP if an error
+#----------------------------#
+  local saveIFS=$IFS
+  local IFS line URL1 URL2 FILE MD5
+
+  # Test if the packages must be downloaded
+  if [ "$GETPKG" = "1" ] ; then
+
+    [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
+    cd $BUILDDIR/sources
+    [[ -f MD5SUMS ]] && rm MD5SUMS
+    [[ -f MD5SUMS-$VERSION ]] && rm MD5SUMS-$VERSION
+    [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
+    [[ -f urls.lst ]] && rm urls.lst
+
+    # Download a fresh MD5SUMS file
+    wget $SERVER/pub/lfs/conglomeration/MD5SUMS
+
+    # Generate URLs file
+    create_urls
+
+    IFS=$'\x0A'  # Modify the 'internal field separator' to break on 'LF' only
+    for line in `cat urls.lst`; do
+      IFS=$saveIFS  # Restore the system defaults
+
+      # Skip some packages if they aren't needed
+      case $line in
+        */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
+            [[ "$TEST" = "0" ]] && continue
+          ;;
+        */vim-*-lang* )
+            [[ "$VIMLANG" = "0" ]] && continue
+          ;;
+      esac
+
+      URL1=`echo $line | cut -d" " -f1` # Upstream URL
+      URL2=`echo $line | cut -d" " -f2` # Fallback URL
+      FILE=`basename $URL2` # File name
+
+      # If the file exists in the archive copy it to the $BUILDDIR/sources dir
+      # MD5SUM is assumed to be correct from previous download
+      if [ ! -z ${SRC_ARCHIVE} ] &&
+         [ -d ${SRC_ARCHIVE} ] &&
+         [ -f ${SRC_ARCHIVE}/$FILE ]; then
+        cp ${SRC_ARCHIVE}/$FILE .
+        echo "$FILE: -- copied from $SRC_ARCHIVE"
+      fi
+
+      # Find the md5 sum for this package.
+      set +e
+      MD5=`grep "  $FILE" MD5SUMS`
+      if [ $? -ne 0 ]; then
+        set -e
+        echo "${RED}$FILE not found in MD5SUMS${OFF}"
+        echo "$FILE not found in MD5SUMS" >> MISSING_FILES.DMP
       fi
       set -e
+
+      if [ ! -f $FILE ] ; then
+        wget $URL1 || wget $URL2
+      elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
+        wget -N $URL1 || wget -N $URL2
+      fi
+
+      if ! echo "$MD5" | md5sum -c - ; then
+        echo "${RED}$FILE not match MD5SUMS value${OFF}"
+        echo "$FILE not match MD5SUMS value" >> MISSING_FILES.DMP
+      fi
+      echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION
+
+      # Copy the freshly downloaded file
+      # to the source archive.
+      if [ ! -z ${SRC_ARCHIVE} ] &&
+         [ -d ${SRC_ARCHIVE} ] &&
+         [ -w ${SRC_ARCHIVE} ] &&
+         [ ! -f ${SRC_ARCHIVE}/$FILE ] ; then
+        echo "Store file:<$FILE> in package archive"
+        cp -v $FILE ${SRC_ARCHIVE}
+      fi
+
+    done
+
+    if [[ -s MISSING_FILES.DMP ]]; then
+      echo  -e "\n\n${tab_}${RED} One or more files were not retrieved or have a bad MD5SUMS chechsum.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n\n"
+    fi
+
   fi
-
-  if [ ! -f $2 ] ; then
-    case $DL in
-      wgetFTP )  wget --passive $FTP/$DIR/$2            ;;
-      wget )  wget $HTTP/$DIR/$2            ;;
-      curl )  `curl -# $FTP/$DIR/$2 -o $2`     ;;
-      * )     echo "$DL not supported at this time."  ;;
-    esac
-  elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
-    case $DL in
-      wgetFTP )  wget --passive -c $FTP/$DIR/$2         ;;
-      wget )   wget -c $HTTP/$DIR/$2            ;;
-      curl )  `curl -# -C - $FTP/$DIR/$2 -o $2`    ;;
-      * )     echo "$DL not supported at this time."  ;;
-    esac
-  fi
-
-  if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then
-    exit 1
-  fi
-  if [ $2 != MD5SUMS ] ; then
-    echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION
-  fi
-
-  # If we make it this far we should copy the freshly downloaded file
-  # to the source archive.
-  if [ ! -z ${SRC_ARCHIVE} ] &&
-     [   -d ${SRC_ARCHIVE} ] &&
-     [   -w ${SRC_ARCHIVE} ] &&
-     [ $2 != MD5SUMS ]; then
-       echo "Store file:<$2> in package archive"
-       cp -v $2 ${SRC_ARCHIVE}
-  fi
-
-}
-
-
-#----------------------------#
-get_sources() {
-#----------------------------#
-
-  # Test if the packages must be downloaded
-  if [ "$HPKG" = "1" ] ; then
-
-    # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
-    # separates each iteration by lines.
-    # Modify the 'internal field separator' to break on 'LF' only
-    IFS=$'\x0A'
-
-    if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
-    cd $BUILDDIR/sources
-    if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
-    if [ -f MD5SUMS-$VERSION ] ; then rm MD5SUMS-$VERSION ; fi
-    if [ -f MISSING_FILES.DMP ] ; then rm MISSING_FILES.DMP ; fi
-
-    download "" MD5SUMS
-
-    # Iterate through each package and grab it, along with any patches it needs.
-    for i in `cat $JHALFSDIR/packages` ; do
-      PKG=`echo $i | sed -e 's/-version.*//' -e 's/-file.*//'`
-
-      # There are some entities that aren't valid packages.
-      if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi
-
-      VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
-      case $PKG in
-        tcl)         FILE="$PKG$VRS-src.tar.bz2"  ;;
-        vim-lang)    PKG="vim"
-                     FILE="vim-$VRS-lang.tar.bz2" ;;
-        udev-config) PKG="udev"
-                     FILE="$VRS"                  ;;
-        *)           FILE="$PKG-$VRS.tar.bz2"     ;;
-      esac
-      download $PKG $FILE
-
-      # Download any associated patches
-      for patch in `grep "&$PKG-version" $JHALFSDIR/patches` ; do
-        PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
-        download $PKG $PATCH
-      done
-    done
-    if [[ -s $BUILDDIR/sources/MISSING_FILES.DMP ]]; then
-      echo  -e "\n\n${tab_}${RED} One or more files were not retrieved.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n\n"
-    fi
-  fi
-}
-
+}
+
+
+#----------------------------#
+create_urls() {              #
+#----------------------------#
+  cd $JHALFSDIR
+
+  case ${PROGNAME} in
+    clfs)
+        echo -n "Creating CLFS <${ARCH}> specific URLs file"
+        xsltproc --nonet --xinclude \
+                 --stringparam server $SERVER \
+                 -o $BUILDDIR/sources/urls.lst urls.xsl \
+                 $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
+        echo " ...OK"
+      ;;
+    hlfs)
+        echo -n "Creating HLFS <${MODEL}> specific URLs file"
+        xsltproc --nonet --xinclude \
+                 --stringparam server $SERVER \
+                 --stringparam model $MODEL \
+                 -o $BUILDDIR/sources/urls.lst urls.xsl \
+                 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
+        echo " ...OK"
+      ;;
+    lfs)
+        echo -n "Creating LFS specific URLs file"
+        xsltproc --nonet --xinclude \
+                 --stringparam server $SERVER \
+                 -o ../sources/urls.lst urls.xsl \
+                 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
+        echo " ...OK"
+      ;;
+  esac
+
+  cd $BUILDDIR/sources
+}
Index: common/config
===================================================================
--- common/config	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ common/config	(revision 3e7af380e3c3837e41050fadaaad8ed5de630c02)
@@ -8,18 +8,23 @@
 declare -r SVN="svn://svn.linuxfromscratch.org"
 declare -r LOG=000-masterscript.log
-declare -r HTTP=http://ftp.lfs-matrix.net/pub/lfs/conglomeration
 
 #--- Mount point for the build
 BUILDDIR=/mnt/build_dir
 
+#=== Getting packages ===
+#--- Download the source packages 0(no)/1(yes)
+GETPKG=0
+
 #--- The local repository for packages/file
-#    Used only if HPKG = 1
+#    Used only if GETPKG = 1
 #    Any missing file will be downloaded and archived here,
 #    if the user has the right priviledges.
 SRC_ARCHIVE=$SRC_ARCHIVE
 
-#--- Download the source packages 0(no)/1(yes)
-HPKG=0
+# --- Server used as fallback if the file isn't found in
+# SRC_ARCHIVE and/or can't be dowloaded from upstream
+SERVER=ftp://ftp.lfs-matrix.net
 
+#=== Build options ===
 #--- Run the makefile at the end  0(no)/1(yes)
 #    In BLFS the Makefile can't be run automatically
Index: common/func_validate_configs.sh
===================================================================
--- common/func_validate_configs.sh	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ common/func_validate_configs.sh	(revision 3e7af380e3c3837e41050fadaaad8ed5de630c02)
@@ -85,8 +85,8 @@
 
   # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
-  local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG         DEPEND                TEST"
-  local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE MODEL GRSECURITY_HOST TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG KEYMAP         PAGE TIMEZONE LANG LC_ALL"
-  local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE METHOD  ARCH  TARGET  TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
-  local -r  lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE                       TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG        VIMLANG PAGE TIMEZONE LANG"
+  local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG         DEPEND                TEST"
+  local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG KEYMAP         PAGE TIMEZONE LANG LC_ALL"
+  local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD  ARCH  TARGET  TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
+  local -r  lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE                       TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG        VIMLANG PAGE TIMEZONE LANG"
 
   local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
@@ -178,5 +178,5 @@
 
       # Validate general parameters..
-      HPKG)       validate_against_str "x0x x1x" ;;
+      GETPKG)     validate_against_str "x0x x1x" ;;
       RUNMAKE)    validate_against_str "x0x x1x" ;;
       REPORT)     validate_against_str "x0x x1x"
Index: common/urls.xsl
===================================================================
--- common/urls.xsl	(revision 3e7af380e3c3837e41050fadaaad8ed5de630c02)
+++ common/urls.xsl	(revision 3e7af380e3c3837e41050fadaaad8ed5de630c02)
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+
+  <xsl:output method="text"/>
+
+  <!-- The FTP server used as fallback -->
+  <xsl:param name="server">ftp://ftp.osuosl.org</xsl:param>
+
+  <!-- The libc model used for HLFS -->
+  <xsl:param name="model" select="glibc"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="//ulink"/>
+  </xsl:template>
+
+  <xsl:template match="ulink">
+      <!-- If some package don't have the predefined strings in their
+      name, the next test must be fixed to match it also. Skip possible
+      duplicated URLs due that may be splitted for PDF output -->
+    <xsl:if test="(ancestor::varlistentry[@condition=$model]
+                  or not(ancestor::varlistentry[@condition])) and
+                  (contains(@url, '.tar.') or contains(@url, '.tgz')
+                  or contains(@url, '.patch') or contains(@url, '.rules')) and
+                  not(ancestor-or-self::*/@condition = 'pdf')">
+      <!-- Extract the package name -->
+      <xsl:variable name="package">
+        <xsl:call-template name="package.name">
+          <xsl:with-param name="url" select="@url"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <!-- Extract the directory for that package -->
+      <xsl:variable name="cut"
+                    select="translate(substring-after($package, '-'),
+                    '0123456789', '0000000000')"/>
+      <xsl:variable name="package2">
+        <xsl:value-of select="substring-before($package, '-')"/>
+        <xsl:text>-</xsl:text>
+        <xsl:value-of select="$cut"/>
+      </xsl:variable>
+      <xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
+      <!-- Write the upstream URLs, except the redirected ones -->
+      <xsl:if test="not(contains(@url,'?'))">
+        <xsl:value-of select="@url"/>
+      </xsl:if>
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="$server"/>
+      <xsl:text>/pub/lfs/conglomeration/</xsl:text>
+      <xsl:choose>
+        <!-- Fix some directories. Test against package2 to be sure that we
+        are matching the start of a package name, not a string in a patch name -->
+        <xsl:when test="contains($package2, 'bash')">
+          <xsl:text>bash/</xsl:text>
+        </xsl:when>
+        <xsl:when test="contains($package2, 'gcc')">
+          <xsl:text>gcc/</xsl:text>
+        </xsl:when>
+        <xsl:when test="contains($package2, 'glibc')">
+          <xsl:text>glibc/</xsl:text>
+        </xsl:when>
+        <xsl:when test="contains($package2, 'tcl')">
+          <xsl:text>tcl/</xsl:text>
+        </xsl:when>
+        <xsl:when test="contains($package2, 'uClibc')">
+          <xsl:text>uClibc/</xsl:text>
+        </xsl:when>
+        <xsl:when test="contains($package2, 'udev')">
+          <xsl:text>udev/</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$dirname"/>
+          <xsl:text>/</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:value-of select="$package"/>
+      <xsl:text>&#x0a;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="package.name">
+    <xsl:param name="url"/>
+    <xsl:choose>
+      <xsl:when test="contains($url, '/')">
+        <xsl:call-template name="package.name">
+          <xsl:with-param name="url" select="substring-after($url, '/')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="contains($url, '?')">
+            <xsl:value-of select="substring-before($url, '?')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$url"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>
Index: master.sh
===================================================================
--- master.sh	(revision c58f33028d4f78e7277d4c9e2080e758f639010c)
+++ master.sh	(revision 3e7af380e3c3837e41050fadaaad8ed5de630c02)
@@ -149,5 +149,5 @@
       ;;
 
-    --get-packages | -G )      HPKG=1    ;;
+    --get-packages | -G )      GETPKG=1    ;;
 
     --help | -h )  usage | more && exit  ;;
@@ -412,16 +412,4 @@
 done
 
-# Find the download client to use, if not already specified.
-
-if [ -z $DL ] ; then
-  if [ `type -p wget` ] ; then
-    DL=wget
-  elif [ `type -p curl` ] ; then
-    DL=curl
-  else
-    eval "$no_dl_client"
-  fi
-fi
-
 #===================================================
 # Set the document location...
@@ -492,4 +480,5 @@
   fi
   [[ "$REPORT" = "1" ]] && cp $COMMON_DIR/create-sbu_du-report.sh  $JHALFSDIR/
+  [[ "$GETPKG" = "1" ]] && cp $COMMON_DIR/urls.xsl  $JHALFSDIR/
   sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
   export XSL=$JHALFSDIR/${XSL}
