Index: BLFS/Makefile
===================================================================
--- BLFS/Makefile	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
+++ BLFS/Makefile	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -0,0 +1,38 @@
+# From the Build Scripts Written By: Jim Gifford <lfs@jg555.com>
+# Modified By: Joe Ciccone <jciccone@linuxfromscratch.org
+# Additional changes: George Boudreau <georgeb@linuxfromscratch.org>
+
+# $Id$
+
+TOPDIR=$(shell pwd)
+CONFIG_CONFIG_IN = Config.in
+CONFIG = menu
+
+all: 	menuconfig
+
+$(CONFIG)/conf:
+	$(MAKE) -C $(CONFIG) conf
+
+$(CONFIG)/mconf:
+	$(MAKE) -C $(CONFIG) ncurses conf mconf
+
+menuconfig: $(CONFIG)/mconf
+	@./update_book.sh none
+	@./gen_config.sh
+	@$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
+	@./gen_pkg_book.sh
+
+config: $(CONFIG)/conf
+	@$(CONFIG)/conf $(CONFIG_CONFIG_IN)
+
+# Clean up
+
+clean:
+	rm -f configuration configuration.old error
+	- $(MAKE) -C $(CONFIG) clean
+
+clean-target:
+	rm -f error
+	- $(MAKE) -C $(CONFIG) clean
+
+.PHONY: all menuconfig config clean clean-target
Index: BLFS/TODO
===================================================================
--- BLFS/TODO	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ BLFS/TODO	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -6,22 +6,13 @@
 #####
 
-For now the code is able to do the first step for the new approach: to create
-LFS-like books from BLFS sources, allowing to create linear build scrips and
-Makefiles similars to the current ones for {C,H}LFS.
 
-What remains to do:
+--   Review generated scripts for bugs trying to figure out if are due fails
+     in the BLFS book XML tagging (that will implied that the book need be
+     fixed) or are required variations due book layout. If the latter, try
+     to fix it via XSL, documenting in README.BLFS that issues that can't be
+     fixed.
 
---   To review the XSL code needed to create the build scripts.
-     A lot of book-versus-scripts and testing is needed.
-     We need yet to figure out if we can to to handle Perl modules installation
-     and other pages that have commands to install more that one package
-     (e.g., Gnat in GCC Java-bin in Java, sane-backends and sane-frontends
-     in Sane, etc) or not-estandart installations, like Xorg7
-
---   Test the method used to track already installed packages by previous runs.
-     See if the packages version can be watched also.
-
---   Integrate the menuconfig based package selection, trying to make use of the
-     installed packages traking system.
+     This is an on-going and never-end task due that, ideally, each commit to
+     the BLFS book should be revised and validated, but our time is limited.
 
 --   Bugs hunting.
Index: FS/alternatives.conf
===================================================================
--- BLFS/alternatives.conf	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ 	(revision )
@@ -1,27 +1,0 @@
-#####
-#
-# Configuration file for the BLFS module
-#
-# $Id$
-#
-# Set default package for alternatives when resolving dependencies
-#
-#####
-
-# Print server cups/LPRng
-PRINT_SERVER=cups
-
-# Mail server sendmail/postfix/exim
-MAIL_SERVER=sendmail
-
-# GhostScript  gs/espgs
-GHOSTSCRIPT=espgs
-
-# Kerberos 5 mitkrb/heimdal
-KBR5=heimdal
-
-# X11 implementation xorg7/xorg/xfree86
-X11=xorg7
-
-
-
Index: FS/blfs-parser.sh
===================================================================
--- BLFS/blfs-parser.sh	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ 	(revision )
@@ -1,119 +1,0 @@
-#!/bin/bash
-#
-# $Id$
-#
-set -e
-declare TARGET
-declare DEP_LEVEL
-declare PKGXML
-declare BLFS_XML
-declare VERBOSITY=1
-
-# Grab and name the command line options
-    optTARGET=$1  # Package target
-optDEPENDENCY=$2  # Dependencies level, 1/2/3
-         SUDO=$3  # Build as user (y) or as root (n)
-
-[[ -z $SUDO ]] && SUDO=y
-
-
-#---------------------
-# Constants
-source libs/constants.inc
-[[ $? > 0 ]] && echo -e "\n\tERROR: constants.inc did not load..\n" && exit
-
-#---------------------
-# Configuration file for alternatives
-source alternatives.conf
-[[ $? > 0 ]] && echo -e "\n\tERROR: alternatives.conf did not load..\n" && exit
-
-#---------------------
-# Dependencies module
-source libs/func_dependencies
-[[ $? > 0 ]] && echo -e "\n\tERROR: func_dependencies did not load..\n" && exit
-
-#---------------------
-# parser module
-source libs/func_parser
-[[ $? > 0 ]] && echo -e "\n\tERROR: func_parser did not load..\n" && exit
-
-
-
-#-------------------------#
-validate_target() {       # ID of target package (as listed in packages file)
-#-------------------------#
-: <<inline_doc
-    function:   Validate the TARGET parameter.
-    input vars: $1, package/target to validate
-    externals:  file: packages
-    modifies:   TARGET
-    returns:    nothing
-    output:     nothing
-    on error:   exit
-    on success: modifies TARGET
-inline_doc
-
-  if [[ -z "$1" ]] ; then
-    echo -e "\n\tYou must to provide a package ID."
-    echo -e "\tSee packages file for a list of available targets.\n"
-    exit 1
-  fi
-
-  if ! grep  "^$1[[:space:]]" packages > /dev/null ; then
-    echo -e "\n\t$1 is not a valid package ID."
-    echo -e "\tSee packages file for a list of available targets.\n"
-    exit 1
-  fi
-
-  TARGET=$1
-  echo -e "\n\tUsing $TARGET as the target package."
-}
-
-#-------------------------#
-validate_dependency() {   # Dependencies level 1(required)/2(1 + recommended)/3(2+ optional)
-#-------------------------#
-: <<inline_doc
-    function:   Validate the dependency level requested.
-    input vars: $1, requested dependency level
-    externals:  vars: TARGET
-    modifies:   vars: DEP_LEVEL
-    returns:    nothing
-    output:     nothing
-    on error:   nothing
-    on success: modifies DEP_LEVEL, default value = 2
-inline_doc
-
-  if [[ -z "$1" ]] ; then
-    DEP_LEVEL=2
-    echo -e "\n\tNo dependencies level has been defined."
-    echo -e "\tAssuming level $DEP_LEVEL (Required plus Recommended).\n"
-    return
-  fi
-
-  case $1 in
-    1 | 2 | 3 )
-      DEP_LEVEL=$1
-      echo -e "\n\tUsing $DEP_LEVEL as dependencies level.\n"
-      ;;
-    * )
-      DEP_LEVEL=2
-      echo -e "\n\t$1 is not a valid dependencies level."
-      echo -e "\tAssuming level $DEP_LEVEL (Required plus Recommended).\n"
-      ;;
-  esac
-}
-
-
-#------- MAIN --------
-if [[ ! -f packages ]] ; then
-  echo -e "\tNo packages file has been found.\n"
-  echo -e "\tExecution aborted.\n"
-  exit 1
-fi
-
-validate_target     "${optTARGET}"
-validate_dependency "${optDEPENDENCY}"
-generate_dependency_tree
-generate_TARGET_xml
-generate_target_book
-create_build_scripts "${SUDO}"
Index: BLFS/gen-makefile.sh
===================================================================
--- BLFS/gen-makefile.sh	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ BLFS/gen-makefile.sh	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -5,11 +5,9 @@
 set -e
 
-
-
 # TEMPORARY VARIABLES.. development use only
 declare MKFILE=Makefile
 declare PREV_PACKAGE=""
 declare BUILD_SCRIPTS=scripts
-declare TRACKING_DIR=/var/lib/jhalfs/BLFS
+declare TRACKING_DIR=tracking-dir
 
 HEADER="# This file is automatically generated by jhalfs
@@ -51,8 +49,43 @@
   local pkg_name=$1
   local pkg_ver=$2
+  local alsa_ver=$(grep "^alsa[[:space:]]" ../packages | cut -f3)
+  local kde_core_ver=$(grep "^kde-core[[:space:]]" ../packages | cut -f3)
+  local xorg7_ver=$(grep "^xorg7[[:space:]]" ../packages | cut -f3)
+
+  if [[ -n "$pkg_ver" ]] ; then
+(
+cat << EOF
+	@touch \$(TRACKING_DIR)/${pkg_name#*-?-}-${pkg_ver}
+EOF
+) >> $MKFILE.tmp
+  fi
+
+  case $pkg_name in
+    *-alsa-lib ) #this the unique mandatory package for ALSA support.
+(
+cat << EOF
+	@touch \$(TRACKING_DIR)/alsa-${alsa_ver}
+EOF
+) >> $MKFILE.tmp
+      ;;
+    *-kdebase )
+(
+cat << EOF
+	@touch \$(TRACKING_DIR)/kde-core-${kde_core_ver}
+EOF
+) >> $MKFILE.tmp
+      ;;
+    *-xorg7-driver ) # xtrerm2 and rman are optional
+(
+cat << EOF
+	@touch \$(TRACKING_DIR)/xorg7-${xorg7_ver}
+EOF
+) >> $MKFILE.tmp
+      ;;
+  esac
+
 (
 cat << EOF
 	@touch  \$@ && \\
-	touch \$(TRACKING_DIR)/${pkg_name#*-?-}-${pkg_ver} && \\
 	sleep .25 && \\
 	echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
@@ -68,5 +101,5 @@
   local script_name=$1
   local pkg_ver=$2
-  
+
   echo -n "${tab_}${tab_} entry for <$script_name>"
 
@@ -91,4 +124,45 @@
 
 #----------------------------#
+__write_meta_pkg_touch() {   #
+#----------------------------#
+  local meta_pkg=$1
+  local pkg_ver=$(grep "^${meta_pkg}[[:space:]]" ../packages | cut -f3)
+  local gnome_core_ver=$(grep "^gnome-core[[:space:]]" ../packages | cut -f3)
+  local kde_full_ver=$(grep "^kde-full[[:space:]]" ../packages | cut -f3)
+
+(
+cat << EOF
+
+999-z-$meta_pkg:  $PREV_PACKAGE
+	@touch \$(TRACKING_DIR)/${meta_pkg}-${pkg_ver}
+EOF
+) >> $MKFILE.tmp
+
+  case $meta_pkg in
+    gnome-full )
+(
+cat << EOF
+	@touch \$(TRACKING_DIR)/gnome-core-${gnome_core_ver}
+EOF
+) >> $MKFILE.tmp
+      ;;
+    kde-koffice )
+(
+cat << EOF
+	@touch \$(TRACKING_DIR)/kde-full-${kde_full_ver}
+EOF
+) >> $MKFILE.tmp
+      ;;
+  esac
+
+(
+cat << EOF
+	@touch  \$@
+EOF
+) >> $MKFILE.tmp
+
+}
+
+#----------------------------#
 generate_Makefile () {       #
 #----------------------------#
@@ -104,13 +178,22 @@
   for package_script in scripts/* ; do
     this_script=`basename $package_script`
-    script_ver=$(xmllint --noent ../blfs-xml/book/bookinfo.xml 2>/dev/null | \
-    		grep -i " ${this_script#*-?-}-version " | \
-		cut -d "\"" -f2 )
-    if [ ! -e $TRACKING_DIR/${this_script#*-?-}-$script_ver ]; then
-      pkg_list="$pkg_list ${this_script}"
-     __write_entry "${this_script}" "${script_ver}"
-      PREV_PACKAGE=${this_script}
-    fi
+    pkg_ver=$(grep "^${this_script#*-?-}[[:space:]]" ../packages | cut -f3)
+    pkg_list="$pkg_list ${this_script}"
+    __write_entry "${this_script}" "${pkg_ver}"
+    PREV_PACKAGE=${this_script}
   done
+
+  PACKAGE=$(basename $PWD)
+
+   # alsa, kde-core and xorg7 are also available dependencies, thus handled
+   # in another way.
+  case $PACKAGE in
+    gnome-core | \
+    gnome-full | \
+    kde-full | \
+    kde-koffice )  pkg_list="$pkg_list 999-z-${PACKAGE}"
+                  __write_meta_pkg_touch "${PACKAGE}"
+                  ;;
+  esac
 
 
@@ -121,5 +204,5 @@
 $HEADER
 
-PACKAGE= "`basename $PWD`"
+PACKAGE= $PACKAGE
 TRACKING_DIR= $TRACKING_DIR
 
Index: BLFS/gen_config.sh
===================================================================
--- BLFS/gen_config.sh	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
+++ BLFS/gen_config.sh	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -0,0 +1,268 @@
+#!/bin/bash
+#
+# $Id$
+#
+
+export outFile=Config.in	# file for reading and writing to.
+export inFile=packages		# file for reading and writing to.
+
+declare PKG_NAME
+declare PKG_XML_FILE
+declare PKG_DIR
+declare PKG_VER
+declare INST_VER
+declare INST_STRING
+declare SAVE_IFS=${IFS}
+declare -a DIR_TREE
+declare PREV_DIR1="none"
+declare PREV_DIR2="none"
+declare MENU_SET1="n"
+declare MENU_SET2="n"
+
+> $outFile
+
+#---------------------#
+#         MAIN        #
+#---------------------#
+: <<enddoc
+  This script will create a Config.in file from the contents
+  of the file <packages>.
+  Packages previously installed will not be included.
+enddoc
+
+echo -en "\tGenerating Config.in from package data ..."
+while [ 0 ]
+do
+
+#  read -r || break 1
+  read || break 1
+
+  set -- $REPLY
+  PKG_NAME=$1
+  PKG_XML_FILE=$(basename $2)
+  PKG_DIR=$(dirname $2)
+  PKG_VER=$3
+  INST_VER=$4
+    # These are the META packages.
+  if [ $PKG_DIR = "." ]; then
+    SET_COMMENT=y
+      # Do not include previously installed packages
+    if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
+      continue
+    fi
+      # Set installed version for updated meta-packages
+    [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
+
+    META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z])
+(
+cat << EOF
+	config	CONFIG_$META_PKG
+		bool	"$META_PKG $PKG_VER $INST_STRING"
+		default	n
+
+		menu	"$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components"
+			depends	CONFIG_$META_PKG
+
+EOF
+) >> $outFile
+
+    unset INST_STRING
+
+         # Include the dependency data for this meta package
+       while [ 0 ]; do
+         read || break 1
+         PKG_NAME=${REPLY}
+         PKG_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f3)
+         INST_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f4)
+           # Skip installed meta-package components
+         if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
+           continue
+         fi
+           # Set installed version for updated meta-packages components
+         [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
+(
+cat << EOF
+	config	DEP_${META_PKG}_${PKG_NAME}
+		bool	"$PKG_NAME ${PKG_VER} ${INST_STRING}"
+		default	y
+
+EOF
+) >> $outFile
+         unset INST_STRING
+       done <./libs/${PKG_NAME}.dep
+     echo -e "endmenu" >> $outFile
+    continue
+  fi
+  [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT
+
+    # Deal with a few unusable (at target level) package names
+  case ${PKG_NAME} in
+     xorg7-* ) continue ;;
+     alsa-* ) continue ;;
+     x-config | x-setup ) continue ;;
+  esac
+
+    # Skip installed packages
+  if [ -n "${PKG_VER}" ] && [ "x${PKG_VER}" = "x${INST_VER}" ]; then
+    continue
+  fi
+    # Set installed version for updated packages
+  [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]"
+
+  IFS="/"
+  DIR_TREE=(${PKG_DIR})
+  IFS="$SAVE_IFS"
+
+    # Define a top level menu
+  if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then
+    [[ "${DIR_TREE[1]}" = "kde" ]] && continue
+    [[ "${DIR_TREE[1]}" = "gnome" ]] && continue
+
+    if [ $MENU_SET1 = "y" ]; then
+      # Close out any open secondary menu
+      if [ $MENU_SET2 = "y" ]; then
+        echo -e "\tendmenu" >> $outFile
+        # Reset 'menu open' flag
+        MENU_SET2="n"
+      fi
+      # Close the current top level menu
+      echo -e "endmenu\n" >> $outFile
+    fi
+    # Open a new top level menu
+    echo -e "menu "$(echo ${DIR_TREE[1]:0:1} | tr [a-z] [A-Z])${DIR_TREE[1]:1}"" >> $outFile
+    MENU_SET1="y"
+  fi
+
+    # Define a secondary menu
+  if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then
+      # Close out the previous open menu structure
+    if [ $MENU_SET2 = "y" ]; then
+      echo -e "\tendmenu\n"  >> $outFile
+    fi
+      # Initialize a new 2nd level menu structure.
+    echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile
+    MENU_SET2="y"
+  fi
+(
+cat << EOF
+	config CONFIG_$PKG_NAME
+		bool "$PKG_NAME ${PKG_VER} ${INST_STRING}"
+		default n
+EOF
+) >> $outFile
+
+  unset INST_STRING
+
+  PREV_DIR1=${DIR_TREE[1]}
+  PREV_DIR2=${DIR_TREE[2]}
+done <"$inFile"
+
+if [ $MENU_SET2 = "y" ]; then echo -e "\tendmenu" >> $outFile; fi
+if [ $MENU_SET1 = "y" ]; then echo "endmenu" >> $outFile; fi
+
+(
+cat << EOF
+
+comment	""
+
+menu	"Default packages for resolving dependencies"
+
+choice
+	prompt	"Default print server"
+	config	PS_cups
+		bool	"cups"
+	config	PS_LPRng
+		bool	"LPRng"
+endchoice
+config	PRINT_SERVER
+	string
+	default	cups	if PS_cups
+	default	LPRng	if PS_LPRng
+
+choice
+	prompt	"Mail server"
+	config	MS_sendmail
+		bool	"sendmail"
+	config	MS_postfix
+		bool	"postfix"
+	config	MS_exim
+		bool	"exim"
+endchoice
+config	MAIL_SERVER
+	string
+	default	sendmail	if MS_sendmail
+	default	postfix		if MS_postfix
+	default	exim		if MS_exim
+
+choice
+	prompt	"Postscript package"
+	config	GS_espgs
+		bool	"espgs"
+	config	GS_ghostscript
+		bool	"ghostscript"
+endchoice
+config	GHOSTSCRIPT
+	string
+	default	espgs       if GS_espgs
+	default ghostscript if GS_ghostscript
+
+choice
+	prompt	"Kerberos 5"
+	config	KER_mitkrb
+		bool	"mitkrb"
+	config	KER_heimdal
+		bool	"heimdal"
+endchoice
+config	KBR5
+	string
+	default	heimdal	if KER_heimdal
+	default mitkrb	if KER_mitkrb
+
+choice
+	prompt	"Window package"
+	config	WIN_xorg7
+	bool	"Xorg7"
+	config	WIN_xorg
+	bool	"Xorg"
+	config	WIN_xfree86
+	bool	"xfree86"
+endchoice
+config	X11
+	string
+	default	xorg7	if WIN_xorg7
+	default	xorg	if WIN_xorg
+	default xfree86	if WIN_xfree86
+endmenu
+
+choice
+	prompt	"Dependency level"
+	default DEPLVL_2
+
+	config	DEPLVL_1
+	bool	"Required dependencies only"
+
+	config	DEPLVL_2
+	bool	"Required and recommended dependencies"
+
+	config	DEPLVL_3
+	bool	"Required, recommended and optional dependencies"
+
+endchoice
+config	optDependency
+	int
+	default	1	if DEPLVL_1
+	default	2	if DEPLVL_2
+	default	3	if DEPLVL_3
+
+
+config	SUDO
+	bool "Build as User"
+	default	y
+	help
+		Select if sudo will be used (you want build as a normal user)
+		        otherwise sudo is not needed (you want build as root)
+EOF
+) >> $outFile
+echo "done"
+
+
Index: BLFS/gen_pkg_book.sh
===================================================================
--- BLFS/gen_pkg_book.sh	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
+++ BLFS/gen_pkg_book.sh	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -0,0 +1,178 @@
+#!/bin/bash
+#
+# $Id$
+#
+#  Read and parse the configuration parameters..
+#
+set -e
+
+declare -r ConfigFile="configuration"
+declare TARGET
+declare DEP_LEVEL
+declare SUDO
+declare PKGXML
+declare BLFS_XML
+declare VERBOSITY=1
+
+#--------------------------#
+parse_configuration() {    #
+#--------------------------#
+  local	cntr
+  local	optTARGET
+
+  while [ 0 ]; do
+    read || break 1
+
+    # Garbage collection
+    case ${REPLY} in
+      \#* | '') continue ;;
+    esac
+
+    case "${REPLY}" in
+      CONFIG_ALSA=* | \
+      CONFIG_GNOME-CORE=* | \
+      CONFIG_GNOME-FULL=* | \
+      CONFIG_KDE-CORE=* | \
+      CONFIG_KDE-FULL=* | \
+      CONFIG_KDE-KOFFICE=* | \
+      CONFIG_XORG7=* ) REPLY=${REPLY%=*}  # Strip the trailing '=y' test.. unecessary
+                       echo -n "${REPLY}"
+                       if [[ $((++cntr)) > 1 ]]; then
+                         echo "  <<-- ERROR:: SELECT ONLY 1 PACKAGE AT A TIME, META-PACKAGE NOT SELECTED"
+                       else
+                         echo ""
+                         optTARGET=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z])
+                       fi
+                       continue ;;
+
+      # Create global variables for these parameters.
+      optDependency=* | \
+      PRINT_SERVER=*  | \
+      MAIL_SERVER=*   | \
+      GHOSTSCRIPT=*   | \
+      KBR5=*  | \
+      X11=*   | \
+      SUDO=*  )  eval ${REPLY} # Define/set a global variable..
+                      continue ;;
+    esac
+
+    if [[ "${REPLY}" =~ "^CONFIG_" ]]; then
+      echo -n "$REPLY"
+      if [[ $((++cntr)) > 1 ]]; then
+        echo "  <<-- ERROR SELECT ONLY 1 PACKAGE AT A TIME, WILL NOT BUILD"
+      else
+        echo ""
+        optTARGET=$( echo $REPLY | sed -e 's@CONFIG_@@' -e 's@=y@@' )
+      fi
+    fi
+  done <$ConfigFile
+
+  if [[ $optTARGET = "" ]]; then
+    echo -e "\n>>> NO TARGET SELECTED.. applicaton terminated"
+    echo -e "    Run <make> again and select a package to build\n"
+    exit 0
+  fi
+
+  TARGET=$optTARGET
+  DEP_LEVEL=$optDependency
+  SUDO=${SUDO:-n}
+}
+
+#--------------------------#
+validate_configuration() { #
+#--------------------------#
+  local -r dotSTR=".................."
+  local -r PARAM_LIST="TARGET DEP_LEVEL SUDO PRINT_SERVER MAIL_SERVER GHOSTSCRIPT KBR5 X11"
+  local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
+  local config_param
+
+  for config_param in ${PARAM_LIST}; do
+    echo -e "`eval echo $PARAM_VALS`"
+  done
+}
+
+#
+# Regenerate the META-package dependencies from the configuration file
+#
+#--------------------------#
+regenerate_deps() {        #
+#--------------------------#
+
+  rm -f libs/*.dep-MOD
+  while [ 0 ]; do
+    read || break 1
+    case ${REPLY} in
+      \#* | '') continue ;;
+    esac
+
+    # Drop the "=y"
+    REPLY=${REPLY%=*}
+    if [[ "${REPLY}" =~ "^DEP_" ]]; then
+      META_PACKAGE=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z])
+      DEP_FNAME=$(echo $REPLY | cut -d "_" -f3)
+       echo "${DEP_FNAME}" >>libs/${META_PACKAGE}.dep-MOD
+    fi
+
+  done <$ConfigFile
+  #
+  # Replace to 'old' dependency file with a new one.
+  #
+  for dst in `ls ./libs/*.dep-MOD 2>/dev/null`; do
+    cp -vf $dst ${dst%-MOD}
+  done
+}
+
+#
+# Clean configuration file keeping only global default settings.
+# That prevent "trying to assign nonexistent symbol" messages
+# and assures that there is no TARGET selected from a previous run
+#
+#--------------------------#
+clean_configuration() {    #
+#--------------------------#
+
+tail -n 30 configuration > configuration.tmp
+mv configuration.tmp configuration
+
+}
+
+#---------------------
+# Constants
+source libs/constants.inc
+[[ $? > 0 ]] && echo -e "\n\tERROR: constants.inc did not load..\n" && exit
+
+#---------------------
+# Dependencies module
+source libs/func_dependencies
+[[ $? > 0 ]] && echo -e "\n\tERROR: func_dependencies did not load..\n" && exit
+
+#---------------------
+# parser module
+source libs/func_parser
+[[ $? > 0 ]] && echo -e "\n\tERROR: func_parser did not load..\n" && exit
+
+
+#------- MAIN --------
+if [[ ! -f packages ]] ; then
+  echo -e "\tNo packages file has been found.\n"
+  echo -e "\tExecution aborted.\n"
+  exit 1
+fi
+
+
+parse_configuration
+validate_configuration
+echo "${SD_BORDER}${nl_}"
+echo -n "Are you happy with these settings? yes/no (no): "
+read ANSWER
+if [ x$ANSWER != "xyes" ] ; then
+  echo "${nl_}Rerun make and fix your settings.${nl_}"
+  exit 1
+fi
+echo "${nl_}${SD_BORDER}${nl_}"
+regenerate_deps
+generate_dependency_tree
+generate_TARGET_xml
+generate_target_book
+create_build_scripts "${SUDO}"
+clean_configuration
Index: BLFS/libs/constants.inc
===================================================================
--- BLFS/libs/constants.inc	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ BLFS/libs/constants.inc	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -3,5 +3,5 @@
 # common constants
 #
-# $Id:
+# $Id$
 #####
 
Index: BLFS/libs/func_dependencies
===================================================================
--- BLFS/libs/func_dependencies	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ BLFS/libs/func_dependencies	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -47,6 +47,4 @@
   #---------------------
   # The BLFS sources directory.
-  # Note: for book.xsl this value must be set via a sed in ./blfs.
-  # For consistency, we should to do the same here.
   BLFS_XML=`echo $PKGXML | sed -e 's,/.*,,'`
 
@@ -74,8 +72,6 @@
 
     # Meta-packages at target level
-    # KDE and Gnome-{core,full} could be made via packages.sh, but not sure yet how.
     alsa )
-      echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n \
-               alsa-plugins\nalsa-lib" > dependencies/alsa.dep
+      cp ../libs/alsa.dep dependencies/
       ;;
     gnome-core )
@@ -92,11 +88,8 @@
       ;;
     kde-koffice )
-      cp ../libs/kde-{core,full}.dep dependencies/
-      echo -e "koffice\nkde-full\nkde-core" > dependencies/kde-koffice.dep
-      ;;
-    xorg7 ) # At atarget level, add also x-config and x-setup
-      echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n \
-               xorg7-font\nxorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n \
-               xorg7-lib\nxorg7-util\nxorg7-proto" > dependencies/xorg7.dep
+      cp ../libs/kde-{core,full,koffice}.dep dependencies/
+      ;;
+    xorg7 )
+      cp ../libs/xorg7.dep dependencies/
       ;;
     * ) # Default
@@ -115,5 +108,5 @@
   case $TARGET in
     # If there is no usefull XML page, skip it.
-    alsa | gnome-core | gnome-full | kde-core | kde-full | kde-koffice ) ;;
+    alsa | gnome-core | gnome-full | kde-core | kde-full | kde-koffice | xorg7) ;;
     * )
       echo -e "    $ENTRY_START$PKGXML$ENTRY_END" >> $TARGET-index.xml.tmp
@@ -161,5 +154,5 @@
   local saveIFS=$IFS
   local DEP_LV=$DEP_LEVEL
-  local line line2 DEP
+  local line line2 DEP pkg_ver inst_ver
 
   #------------------
@@ -185,5 +178,6 @@
   > xincludes/$PKG.xinc.tmp
   for DEP in `cat dependencies/$PKG.dep`; do
-    # Special packages (a lot of hacks)
+
+    # Special packages that need be remaped
     case $DEP in
 
@@ -198,15 +192,25 @@
       kde )                      DEP=kde-core ;;
 
-       # Dummy gnome-core pages
-      GNOME-desktop-file-utils ) DEP=desktop-file-utils ;;
-      GNOME-shared-mime-info )   DEP=shared-mime-info ;;
-
         # Set values for alternative packages
-        # X is a meta-package, thus handled in another way.
       LPRng | cups )             DEP=$PRINT_SERVER ;;
       mitkrb | heimdal )         DEP=$KBR5 ;;
       gs | espgs )               DEP=$GHOSTSCRIPT ;;
       server-mail )              DEP=$MAIL_SERVER ;;
+      x-window-system )
+        case $X11 in
+          xorg7 ) DEP=xorg7 ;;
+              * )
+                  pkg_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f3)
+                  inst_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f4)
+                  [ -n "${pkg_ver}" ] && [ "x${pkg_ver}" = "x${inst_ver}" ] && continue
+                  ;;
+        esac
+        ;;
     esac
+
+    # If DEP has been previouly installed, skip it
+    pkg_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f3)
+    inst_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f4)
+    [ -n "${pkg_ver}" ] && [ "x${pkg_ver}" = "x${inst_ver}" ] && continue
 
     #------------------
@@ -272,19 +276,16 @@
         # Skip the creation when all dependencies are circular.
         alsa-lib | cracklib | libexif | unixodbc ) ;;
-        # Meta-packages at dependency level (ugly *.dep files, but work for now)
-        alsa ) # When dependency "alsa", use all alsa-* packages
-          echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n \
-                   alsa-plugins\nalsa-lib" > dependencies/alsa.dep
+        # Meta-packages at dependency level
+        alsa )
+          cp ../libs/alsa.dep dependencies/
           ;;
         kde-core )
           cp ../libs/kde-core.dep dependencies/
           ;;
-        x-window-system ) # X11 alternatives
+        x-window-system ) # When X11 is not Xorg7
           echo -e "x-config\nx-setup\n$X11" > dependencies/x-window-system.dep
           ;;
         xorg7 )
-          echo -e "rman\nxterm2\nxorg7-driver\nxorg7-server\nluit\nxorg7-font\n \
-                   xorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n \
-                   xorg7-lib\nxorg7-util\nxorg7-proto" > dependencies/xorg7.dep
+          cp ../libs/xorg7.dep dependencies/
           ;;
         * ) xsltproc --stringparam dependencies $DEP_LV \
@@ -338,5 +339,5 @@
   if [[ "$PKG" = "xorg7" ]] ; then
     # Add their XInclude
-    PKG_XML=`grep "^$PKG[[:space:]]" ../packages | cut -f2`
+    PKG_XML=${BLFS_XML}/x/installing/xorg7.xml
     echo -e "    $ENTRY_START$PKG_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
   fi
Index: BLFS/libs/func_packages
===================================================================
--- BLFS/libs/func_packages	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ BLFS/libs/func_packages	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -6,7 +6,50 @@
 
 #-----------------------#
+get_pkg_ver() {         # Find package version for a given package ID
+#-----------------------#
+  local pkg_id=$1
+
+  case ${pkg_id} in
+                  # ALSA packages version
+            alsa* ) pkg_id=alsa ;;
+
+                  # KDE packages version
+          kdevelop ) : ;;
+        kde*config ) : ;;
+              kde* ) pkg_id=kde ;;
+
+                  # Xorg7 packages version
+      xorg7-server ) pkg_id=xorg-server ;;
+            xterm2 ) pkg_id=xterm ;;
+            xorg7* ) pkg_id=xorg7 ;;
+
+                   # Others (ID value don't match entity name)
+    wireless_tools ) pkg_id=wireless-tools ;;
+        bind-utils ) pkg_id=bind ;;
+         html-tidy ) pkg_id=tidy ;;
+               jdk ) pkg_id=jdk-src ;;
+          reiserfs ) pkg_id=reiser ;;
+               xfs ) pkg_id=xfsprogs ;;
+  esac
+
+  xmllint --noent ./${BLFS_XML}/book/bookinfo.xml 2>/dev/null | \
+  grep -i " ${pkg_id}-version " | cut -d "\"" -f2
+
+}
+
+#-----------------------#
+get_installed_ver() {   # Find installed package version for a given package ID
+#-----------------------#
+  local pkg_id=$1
+
+  find $TRACKING_DIR -name "${pkg_id}-[[:digit:]]*" | sed "s/.*${pkg_id}-//"
+
+}
+
+#-----------------------#
 generate_packages()  {  # Master packages file
 #-----------------------#
-  local pkg_id file
+  local pkg_id file pkg_ver
+  local ALSA_VER GNOME_VER GNOME_MINOR_VER KDE_VER KDE_KOFFICE_VER XORG7_VER
 
   > packages.tmp
@@ -14,38 +57,51 @@
   # Extract Id and path for sect1 files
   for file in `find $BLFS_XML -name "*.xml"` ; do
-    pkg_id=`grep "sect1 id" $file | sed -e 's/<sect1 id="//;s/".*//'`
-    [[ ! -z "$pkg_id" ]] && echo -e "$pkg_id\t$file" >> packages.tmp
+    pkg_id=$(grep "sect1 id" $file | sed -e 's/<sect1 id="//;s/".*//')
+    pkg_ver=$(get_pkg_ver $pkg_id)
+    installed_ver=$(get_installed_ver $pkg_id)
+    [[ ! -z "$pkg_id" ]] && echo -e "$pkg_id\t$file\t$pkg_ver\t$installed_ver" >> packages.tmp
   done
 
   # IDs clean-up (unuseful pages or commented-out packages, could be more)
-  sed -i '/template/d;/ntroduction/d;/preface/d' packages.tmp
-  sed -i '/courier.xml/d' packages.tmp
-  sed -i '/nautilus-media.xml/d;/gal.xml/d;/gpdf.xml/d;/gv.xml/d' packages.tmp
+  sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d' packages.tmp
+  sed -i '/obsolete/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp
+  sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d' packages.tmp
+  sed -i '/fw-firewall\t/d;/gcc2\t/d;/cvsserver\t/d;/svnserver\t/d' packages.tmp
+  sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d' packages.tmp
+  sed -i '/gst-plugins\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp
+
+  # Meta-packages version
+  ALSA_VER=$(get_pkg_ver alsa)
+  GNOME_VER=$(get_pkg_ver gnome)
+  GNOME_MINOR_VER=$(get_pkg_ver gnome-minor)
+  KDE_VER=$(get_pkg_ver kde)
+  KDE_INST_VER=$(get_installed_ver kde)
+  KDE_KOFFICE_VER=$(get_pkg_ver koffice)
+  XORG7_VER=$(get_pkg_ver xorg7)
+
+  # Meta-packages installed version
+  ALSA_INST_VER=$(get_installed_ver alsa)
+  GNOME_CORE_INST_VER=$(get_installed_ver gnome-core)
+  GNOME_FULL_INST_VER=$(get_installed_ver gnome-full)
+  KDE_CORE_INST_VER=$(get_installed_ver kde-core)
+  KDE_FULL_INST_VER=$(get_installed_ver kde-full)
+  KDE_KOFFICE_INST_VER=$(get_installed_ver kde-koffice)
+  XORG7_INST_VER=$(get_installed_ver xorg7)
 
   # Add header with meta-packages pseudo Id
 {
   cat << EOF
-
-=== GNOME META-PACKAGES ===
-# GNOME base packages
-gnome-core	$BLFS_XML
-# All GNOME packages
-gnome-full	$BLFS_XML
-
-=== KDE META-PACKAGES ===
-# KDE base packages
-kde-core	$BLFS_XML
-# All KDE packages
-kde-full	$BLFS_XML
-# All KDE packages plus Koffice
-kde-koffice	$BLFS_XML
-
-=== INDIVIDUAL PACKAGES ===
-
+alsa	$BLFS_XML	$ALSA_VER	$ALSA_INST_VER
+gnome-core	$BLFS_XML	$GNOME_VER$GNOME_MINOR_VER	$GNOME_CORE_INST_VER
+gnome-full	$BLFS_XML	$GNOME_VER$GNOME_MINOR_VER	$GNOME_FULL_INST_VER
+kde-core	$BLFS_XML	$KDE_VER	$KDE_CORE_INST_VER
+kde-full	$BLFS_XML	$KDE_VER	$KDE_FULL_INST_VER
+kde-koffice	$BLFS_XML	$KDE_KOFFICE_VER	$KDE_KOFFICE_INST_VER
+xorg7	$BLFS_XML	$XORG7_VER	$XORG7_INST_VER
 EOF
-} > packages
+} >> packages.tmp
 
   # Dump packages list
-  sort packages.tmp >> packages
+  sort packages.tmp -b --key=2 --field-separator=/ --output=packages
 
   # Clean up
@@ -68,4 +124,7 @@
   done
 
+  # Replace dummy packages with the proper ones
+  sed -i 's/GNOME-//g' gnome-core.dep.tmp
+
   tac gnome-core.dep.tmp > libs/gnome-core.dep
   rm gnome-core.dep.tmp
@@ -128,2 +187,23 @@
   rm kde-full.dep.tmp
 }
+
+#--------------------------#
+generate_kde_koffice()  {  # KDE full + Koffice
+#--------------------------#
+  echo -e "koffice\nkde-full\nkde-core" > libs/kde-koffice.dep
+}
+
+#--------------------------#
+generate_alsa()  {         # ALSA packages
+#--------------------------#
+  echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n\
+alsa-plugins\nalsa-lib" > libs/alsa.dep
+}
+
+#--------------------------#
+generate_xorg7()  {        # Xorg7 packages
+#--------------------------#
+  echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n\
+xorg7-font\nxorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n\
+xorg7-lib\nxorg7-util\nxorg7-proto" > libs/xorg7.dep
+}
Index: BLFS/libs/func_parser
===================================================================
--- BLFS/libs/func_parser	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ BLFS/libs/func_parser	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -144,7 +144,8 @@
            -o ./scripts/ ../libs/scripts.xsl \
            $TARGET-index.xml >> xsltproc.log 2>&1
-  echo -e "done\n"
     # Make the scripts executable.
   chmod -R +x scripts
+  cd ..
+  echo -e "done\n"
 
 }
Index: BLFS/libs/scripts.xsl
===================================================================
--- BLFS/libs/scripts.xsl	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ BLFS/libs/scripts.xsl	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -27,7 +27,5 @@
 
         <!-- The file names -->
-      <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
-      <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
-      <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
+      <xsl:variable name="filename" select="@id"/>
 
         <!-- Package name (use "Download FTP" by default. If empty, use "Download HTTP" -->
Index: BLFS/update_book.sh
===================================================================
--- BLFS/update_book.sh	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ BLFS/update_book.sh	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -7,6 +7,6 @@
 declare -r SVN="svn://svn.linuxfromscratch.org"
 
-BLFS_XML=$1  # Book directory
-DOC_MODE=$2  # Action to take, update or get
+DOC_MODE=$1  # Action to take, update, get or none
+BLFS_XML=$2  # Book directory
 TREE=$3      # SVN tree for the BLFS book version
 
@@ -14,4 +14,6 @@
 [[ -z $DOC_MODE ]] && DOC_MODE=update
 [[ -z $TREE ]] && TREE=trunk/BOOK
+
+TRACKING_DIR=tracking-dir
 
 #---------------------
@@ -69,24 +71,38 @@
 }
 
-BOOK_Source
+[ "${DOC_MODE}" != "none" ] && BOOK_Source
 
-echo -en "\n\tGenerating packages file ..."
-generate_packages
-echo "done."
+if [ "${DOC_MODE}" = "none" ] ; then
+  echo -en "\n\tGenerating packages database file ..."
+  generate_packages
+  echo "done."
 
-echo -en "\tGenerating gnome-core dependencies list ..."
-generate_gnome_core
-echo "done."
+  echo -en "\tGenerating alsa dependencies list ..."
+  generate_alsa
+  echo "done."
 
-echo -en "\tGenerating gnome-full dependencies list ..."
-generate_gnome_full
-echo "done."
+  echo -en "\tGenerating gnome-core dependencies list ..."
+  generate_gnome_core
+  echo "done."
 
-echo -en "\tGenerating kde-core dependencies list ..."
-generate_kde_core
-echo "done."
+  echo -en "\tGenerating gnome-full dependencies list ..."
+  generate_gnome_full
+  echo "done."
 
-echo -en "\tGenerating kde-full dependencies list ..."
-generate_kde_full
-echo -e "done.\n"
+  echo -en "\tGenerating kde-core dependencies list ..."
+  generate_kde_core
+  echo "done."
 
+  echo -en "\tGenerating kde-full dependencies list ..."
+  generate_kde_full
+  echo -e "done."
+
+  echo -en "\tGenerating kde-koffice dependencies list ..."
+  generate_kde_koffice
+  echo -e "done."
+
+  echo -en "\tGenerating xorg7 dependencies list ..."
+  generate_xorg7
+  echo "done."
+fi
+
Index: Config.in
===================================================================
--- Config.in	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ Config.in	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -295,4 +295,15 @@
 			#-- The directory name where BLFS book sources
 			#   will be checkout.
+
+	config	TRACKING_DIR
+		string "Installed packages database directory"
+		default "/var/lib/jhalfs/BLFS"
+		depends on BOOK_BLFS
+		help
+			#-- Full path to the directory where the installed
+			#   packages database will be created.
+			#
+			#   Note that the user that will build the packages must
+			#   have read and write privileges on that directory.
 	#--- End BLFS specific params
 
Index: README
===================================================================
--- README	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ README	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -22,9 +22,22 @@
   uClibc rather than glibc.
 
-2. INSTALLATION::
+2. PREREQUISITES::
+
+     To use this tool you MUST:
+
+     - have experience building {c,h,b}LFS packages
+     - know how to edit and write shell scripts
+     - know how a Makefile works
+     - be able to trace build failures and to find what is causing it
+       (user error, package bug, {c,h,b}LFS command bug, or jhalfs code bug)
+
+     If you don't have the above skill, please don't use this tool.
+
+
+3. INSTALLATION::
      No installation is required. System-wide installation is not allowed
   for now.
 
-3. CONFIGURATION FILES::
+4. CONFIGURATION FILES::
      Each book in the LFS series has its own set of configurable parameters
   as well as the common parameters file.
@@ -49,5 +62,5 @@
      This will create a new file named configuration but will not launch jhalfs.
 
-4. RUNNING::
+5. RUNNING::
      The script master.sh cannot be invoked directly but only via the
   supplied symlinks. After editing the config file for the project you wish
@@ -115,5 +128,5 @@
 
 
-5. LAYOUT::
+6. LAYOUT::
 
         /CLFS/config
@@ -157,5 +170,5 @@
 
 
-6. FAQ::
+7. FAQ::
     Q. "This 'help' file is very sparse"
     A. Yes, it is. This tool, jhalfs, is for those who understand the LFS books
Index: README.BLFS
===================================================================
--- README.BLFS	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ README.BLFS	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -18,12 +18,26 @@
 
 
-2. USAGE::
+2. PREREQUISITES::
+
+     To use this tool you MUST to:
+
+     - have experience building BLFS packages
+     - know how to edit and write shell scripts
+     - know how a Makefile works
+     - be able to trace build failures and to find what is causing it
+       (user error, package bug, BLFS command bug, or jhalfs code bug)
+
+     If you don't have the above skill, please don't use this tool.
+
+
+3. USAGE::
 
      Due the complexity of the BLFS book, the scripts/Makefile generation is
   done in several steps:
 
-  2.1  INSTALLATION::
-       Run "make" to launch the menuconfig interface. Select the BLFS book
-    and it version. Then set the installation directory (default
+  3.1  INSTALLATION::
+
+       Run "make" to launch the jhalfs menuconfig interface. Select the BLFS
+    book and it version. Then set the installation directory (default
     $HOME/blfs_root) and the BLFS sources directory (default blfs-xml).
 
@@ -33,24 +47,37 @@
        Installed files:
 
-    lib/*              functions, xsl, and auto-generates dependencies tree files
+    blfs-xml/*         SVN tree of the selected BLFS book version
+    lib/*              functions libraries, xsl stylesheets, and auto-generated
+                       meta-packages dependencies tree files
+    menu/*             lxdialog and menuconfig source code
     README.BLFS        this file
     TODO               developers notes
-    packages           auto-generated file with packages info
-    alternatives.conf  configuration files for alternative packages
-    envars.conf        envars needed when running the build scripts
-    update_book.sh     update the XML book sources and regenerate packages file
-                       and GNOME and KDE dependencies tree
-    blfs-parser.sh     generates linear BLFS books and build scripts
-    gen-makefile.sh    generates Makefile
-    progress_bar.sh    the Makefile progress bar
+    update_book.sh     update the XML book sources and regenerates packages
+                       database and meta-packages dependencies tree
+    gen_config.sh      regenerates Config.in
+    gen_pkg_book.sh    solve dependencies and generates linear BLFS books
+                       and build scripts
+    gen-makefile.sh    generates target Makefile
+    progress_bar.sh    the target Makefile progress bar
+    Makefile           run gen_config.sh to update Config.in,
+                       then launch the menuconfig interface, and lastly run
+                       gen_pkg_book.sh based on configuration settings
+    Config.in          menuconfig interface input file
+    packages           auto-generated packages database
+    envars.conf        envars needed when running the target build scripts
 
        From now on, all the work must be done from inside the installation
     root directory.
 
-  2.2  UPDATING BOOK SOURCES::
-       If using the SVN book version, from time to time you may want to update
-    the XML sources. To do that run "./update_book.sh"
-
-  2.3  PARSING THE BOOK::
+  3.2  UPDATING BOOK SOURCES::
+
+       If using the development book version, and if you want to update already
+    installed packages to the new version found in that book, you need to update
+    the XML sources and packages database.
+
+    To do that run "./update_book.sh"
+
+  3.3  CONFIGURING AND PARSING THE BOOK:: (obsolete, to be rewritten)
+
        Next step is to create a book and build scripts in dependencies build order
     for a target package. A target package can be any of the ones listed in the
@@ -76,12 +103,22 @@
     that uses sudo for commands that need root privileges.
 
-    There is also two other directories that contains files generated while
-    resolving dependencies trees.
-
-    Now is the time to review the generated book and scripts, making in the
-    scripts any changes you want to fit your needs. Scripts for additional
-    packages (i.e., for non-BLFS packages) can be inserted in an easy way.
-
-  2.4  CREATING THE MAKEFILE
+       There is also two other directories, dependencies and xincludes, that
+    contains files generated while resolving dependencies trees.
+
+  3.4  EDITING BUILD SCRIPTS
+
+       Now is the time to review the generated book and scripts, making in the
+    scripts any changes required to fix generation bugs or to fit your needs.
+
+       Scripts for additional packages (i.e., for non-BLFS packages) can be
+    inserted in an easy way due how the scripts are named. For example, if you
+    want to install the external dependency "bar" before "foo" package and the
+    "foo" script is named "064-z-foo", you need to create a "064-y-bar" build
+    script.
+
+      Note that the packages tracking system isn't a packages management tool
+    and know nothing about packages not in the BLFS book.
+
+  3.5  CREATING THE MAKEFILE
        When the build scripts are ready to be run, the Makefile can be
     created. Be sure that you cd into the "package" directory and run
@@ -92,16 +129,21 @@
 
 
-(Text is needed for the installed packages tracking system and like)
-
-3. GENERATED BUILD SCRIPTS ISSUES::
+(Text is needed about meta-packages, the installed packages tracking system
+and like)
+
+(The TRACKING_DIR directory must be created before using this tool running as root
+
+install -d -m1777 /var/lib/jhalfs/BLFS )
+
+4. GENERATED BUILD SCRIPTS ISSUES::
 
       In this section known issues with the generated build scripts are
-   discussed. They are due build procedures and BLFS layout particularities
-   than we can't handle. In some cases editing the build scripts is mandatory.
+   discussed. They are due build procedures and/or BLFS layout particularities
+   than we can't handle. In several cases editing the build scripts is mandatory.
    You may need also to insert some build script created by you to resolve
-   unhandled dependencies and/or to remove some script and install the
-   affected package by hand.
-
-   3.1  BLFS BOOTSCRIPTS
+   unhandled dependencies and/or to remove some script installing the affected
+   package by hand.
+
+   4.1  BLFS BOOTSCRIPTS
 
         For now, bootscripts installation will fail. You will need to edit the
@@ -109,10 +151,10 @@
      command. That could be fixed in the future, but not sure.
 
-   3.2  PACKAGES CONFIGURATION
+   4.2  PACKAGES CONFIGURATION
 
         For that packages that have a "Configuration" section, you should to
      edit it build script to fit the configuration to your needs.
 
-   3.4  PDL and Perl modules.
+   4.4  PDL and Perl modules.
 
         The generated scripts for that packages are plainly broken and can't
@@ -120,5 +162,5 @@
      packages by hand.
 
-   3.4  GCC, JDK, Sane, and KDE-multimedia
+   4.4  GCC, JDK, Sane, and KDE-multimedia
 
         On the pages for that packages, the BLFS book actually have instructions
@@ -126,5 +168,75 @@
      try to fix some of them, but may not be possible.
 
-   3.5  OTHERS
+   4.5  XORG7
+
+        The generated scripts for Xorg7 pseudo-packages don't have support for
+     $SRC_ARCHIVE nor MD5 checking.
+
+        If you has downloaded previously the packages, you must to edit the scripts
+     to make it to use your local packages.
+
+        Also, you will need to edit the scripts to fix the commands that must
+     be applied only to a concret individual sub-package. For example the "for"
+     loop to install xotg7-util packages may read like:
+
+for package in $(cat $WGET_LST) ; do
+  packagedir=$(echo $package | sed 's/.tar.bz2//')
+  tar -xf $package
+  cd $packagedir
+  sed -i "s@/usr/X11R6@$XORG_PREFIX@" X11.tmpl &&
+  ./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config
+  sudo sh -c "make install"
+  ./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config &&
+  make
+  sudo sh -c "make install"
+  ./configure $XORG_CONFIG &&
+  make
+  sudo sh -c "make install"
+  cd ..
+  rm -rf $packagedir
+done
+
+        After reading the HTML page to know what commands is for what package,
+     the loop can be changed to read something like:
+
+for package in $(cat $WGET_LST) ; do
+  packagedir=$(echo $package | sed 's/.tar.bz2//')
+  tar -xf $package
+  cd $packagedir
+  if [ ${packagedir} = "xorg-cf-files" ] ; then
+    sed -i "s@/usr/X11R6@$XORG_PREFIX@" X11.tmpl &&
+    ./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config
+    sudo sh -c "make install"
+  elif [ ${packagedir} = "Imake" ] ; then
+    ./configure $XORG_CONFIG --with-config-dir=$XORG_PREFIX/lib/X11/config &&
+    make
+    sudo sh -c "make install"
+  else
+    ./configure $XORG_CONFIG &&
+    make
+    sudo sh -c "make install"
+  fi
+  cd ..
+  rm -rf $packagedir
+done
+
+   4.6  PATCHES
+
+        By default all required patches will be downloaded from the NET.
+
+        If you has downloaded previously the patches, you must to edit the scripts
+     to make it to use your local patches.
+
+        Also, be sure that all scripts have the commands to download/apply the
+     required patches. Due book layout issues some patches may be missing.
+
+   4.7  ROOT COMMANDS
+
+        If building as a normal user (the default setting) be sure that all
+     commands that need root privileges are run using sudo.
+
+        Due book layout issues some sudo command may be missing.
+
+   4.8  OTHERS
 
         May have other issues that we are not aware on them yet. If you find
Index: blfs
===================================================================
--- blfs	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ blfs	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -112,6 +112,7 @@
 
 cp -r BLFS/* $BLFS_ROOT
+cp -r menu $BLFS_ROOT
 cp $COMMON_DIR/progress_bar.sh $BLFS_ROOT
-# cp -r menu $BLFS_ROOT
+cp README.BLFS $BLFS_ROOT
 
 # Start the work
@@ -120,18 +121,20 @@
 # Clean-up
 rm -rf libs/.svn
+rm -rf menu/.svn
+rm -rf menu/lxdialog/.svn
 
-# Fix BLFS_XML harcoded values
-sed -i 's,blfs-xml,'$BLFS_XML',' update_book.sh
-sed -i 's,blfs-xml,'$BLFS_XML',' libs/book.xsl
 
-# Fetch book sources and create packages and GNOME/KDE dependencies files
+# Set some harcoded envars to their proper values
+sed -i 's,blfs-xml,'$BLFS_XML',' update_book.sh libs/book.xsl
+sed -i 's,tracking-dir,'$TRACKING_DIR',' update_book.sh gen-makefile.sh
+
+# Fetch book sources and create packages and meta-packages dependencies files
 if [[ -d $BLFS_XML ]] ; then
   ./update_book.sh
 else
-  ./update_book.sh $BLFS_XML get $TREE
+  ./update_book.sh get $BLFS_XML $TREE
 fi
 
-# Generate Config.in and run the menuconfig interfaz
-# ./gen_config.sh
-# make
+# Run the menuconfig interface
+make
 
Index: common/func_validate_configs.sh
===================================================================
--- common/func_validate_configs.sh	(revision 7bf2fdd68fa3341404d408b787b9e1ab683aaa9b)
+++ common/func_validate_configs.sh	(revision f4ed135b1787de20f28ad3c84dd54043cf73922f)
@@ -93,5 +93,5 @@
   local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE         ARCH  TARGET                 OPTIMIZE REPORT                                      STRIP FSTAB             CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG        LUSER LGROUP"
   local -r   lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE                       TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL        VIMLANG PAGE TIMEZONE LANG        LUSER LGROUP"
-  local -r  blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML"
+  local -r  blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
 
   local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
@@ -268,5 +268,6 @@
 
       # BLFS params. No validation is required/allowed, IMHO
-      BRANCH_ID | BLFS_ROOT | BLFS_XML)  echo "`eval echo $PARAM_VALS`" ;;
+      BRANCH_ID | BLFS_ROOT | BLFS_XML )  echo "`eval echo $PARAM_VALS`" ;;
+      TRACKING_DIR ) validate_dir -z -d -w ;;
 
     esac
