r3216 - in jhalfs/trunk/common: . libs

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Sat Nov 11 09:20:29 PST 2006


Author: manuel
Date: 2006-11-11 10:20:27 -0700 (Sat, 11 Nov 2006)
New Revision: 3216

Added:
   jhalfs/trunk/common/libs/custom_pkgs
   jhalfs/trunk/common/libs/func_check_version.sh
   jhalfs/trunk/common/libs/func_compare.sh
   jhalfs/trunk/common/libs/func_validate_configs.sh
Removed:
   jhalfs/trunk/common/custom_pkgs
   jhalfs/trunk/common/func_check_version.sh
   jhalfs/trunk/common/func_compare.sh
   jhalfs/trunk/common/func_validate_configs.sh
Log:
Moved current functions library files to libs directory.

Deleted: jhalfs/trunk/common/custom_pkgs
===================================================================
--- jhalfs/trunk/common/custom_pkgs	2006-11-11 17:06:11 UTC (rev 3215)
+++ jhalfs/trunk/common/custom_pkgs	2006-11-11 17:20:27 UTC (rev 3216)
@@ -1,134 +0,0 @@
-#!/bin/bash
-
-# $Id$
-
-#----------------------------------#
-add_CustomTools() {                # Add any users supplied scripts
-#----------------------------------#
-  PREV_SCRIPT=""
-  CUSTOM_LIST=""
-
-  echo "Adding custom packages... ${BOLD}START${OFF}"
-
-  cd $JHALFSDIR
-  > ${MKFILE}.tmp2
-
-  # First some build commands and a placeholder for the build list.
-  # This will not cause problems if there are no custom scripts.
-( cat << xEOFx
-
-
-mk_CUSTOM_TOOLS:
-	@\$(call echo_CHROOT_request)
-	@ sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}
-	@( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS")
-	@touch \$@
-
-CUSTOM_TOOLS:
-xEOFx
-) >> ${MKFILE}.tmp2
-
-
-  for this_script in custom-commands/config/*; do
-    if [[ `basename ${this_script}` = "*" ]]; then
-      break
-    fi
-    source $this_script
-    THIS_SCRIPT=$(basename ${this_script})
-    echo "$tab_${GREEN}Adding${OFF} ${THIS_SCRIPT}"
-
-      # Create a Makefile entry
-    if [[ "x${PKG}" = "x" ]]; then
-    # Create an entry for a self contained cmd script that does not reference a package tarball
-( cat << EOF
-
-${THIS_SCRIPT}: ${PREV_SCRIPT}
-	@\$(call echo_message, Building)
-	@./progress_bar.sh \$@ \$\$PPID &
-	@( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT}
-	@touch \$@
-	@\$(call housekeeping)
-EOF
-) >> ${MKFILE}.tmp2
-
-    # Create the build script file
-( cat <<- xEOFx
-#!/bin/bash
-set -e
-
-`cat tmp`
-exit
-xEOFx
-) > custom-commands/scripts/$THIS_SCRIPT
-
-    else
-    # Create an entry for package
-( cat << EOF
-
-${THIS_SCRIPT}: ${PREV_SCRIPT}
-	@\$(call echo_message, Building)
-	@./progress_bar.sh \$@ \$\$PPID &
-	@\$(call remove_existing_dirs2,${PKG_FILE})
-	@\$(call unpack3,${PKG_FILE})
-	@\$(call get_pkg_root2)
-	@( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT}
-	@\$(call remove_build_dirs2,${PKG})
-	@touch \$@
-	@touch ${TRACKING_DIR}/${PKG}-${PKG_VERSION}
-	@\$(call housekeeping)
-EOF
-) >> ${MKFILE}.tmp2
-
-    # Create the build script file
-( cat <<- xEOFx
-#!/bin/bash
-set -e
-
-cd \$PKGDIR
-`cat tmp`
-exit
-xEOFx
-) > custom-commands/scripts/$THIS_SCRIPT
-    fi
-
-    chmod 755 custom-commands/scripts/$THIS_SCRIPT
-    rm -f tmp
-    PREV_SCRIPT=$THIS_SCRIPT
-    CUSTOM_LIST="${CUSTOM_LIST}${THIS_SCRIPT} "
-  done
-
-  # Add the dependancy list.
-  sed "s|^CUSTOM_TOOLS:|CUSTOM_TOOLS: ${CUSTOM_LIST}|" -i ${MKFILE}.tmp2
-  cat ${MKFILE}.tmp2 >> ${MKFILE}
-  rm  ${MKFILE}.tmp2
-  echo "Adding custom packages... ${BOLD}DONE${OFF}"
-}
-
-
-
-#----------------------------------#
-add_CustomToolsURLS() {            # Add any users supplied scripts URL information
-#----------------------------------#
-  local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
-  local this_script
-  local URL PKG PKG_VERSION PKG_FILE MD5
-
-  > urls.lst.tmp
-  for this_script in $JHALFSDIR/custom-commands/config/*; do
-    if [[ `basename ${this_script}` = "*" ]]; then
-      CUSTOM_TOOLS="n"
-      break
-    fi
-    source $this_script
-      # A cmd only script had no PKG defined
-    [[ "x${PKG}" = "x" ]] && continue
-
-    echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp
-     # Add any patches..
-    for PATCH in PATCH{1..10}; do
-      [[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp
-    done
-  done
-  cat  urls.lst.tmp >> $BUILDDIR/sources/urls.lst
-  rm urls.lst.tmp
-}

Deleted: jhalfs/trunk/common/func_check_version.sh
===================================================================
--- jhalfs/trunk/common/func_check_version.sh	2006-11-11 17:06:11 UTC (rev 3215)
+++ jhalfs/trunk/common/func_check_version.sh	2006-11-11 17:20:27 UTC (rev 3216)
@@ -1,158 +0,0 @@
-# $Id$
-
-check_version() {
-: <<inline_doc
-      Tests for a minimum version level. Compares to version numbers and forces an
-        exit if minimum level not met.
-      NOTE: This test will fail on versions containing alpha chars. ie. jpeg 6b
-
-    usage:	check_version "2.6.2" "`uname -r`"         "KERNEL"
-		check_version "3.0"   "$BASH_VERSION"      "BASH"
-		check_version "3.0"   "`gcc -dumpversion`" "GCC"
-
-    input vars: $1=min acceptable version
-    		$2=version to check
-		$3=app name
-    externals:  --
-    modifies:   --
-    returns:    nothing
-    on error:	write text to console and dies
-    on success: write text to console and returns
-inline_doc
-
-  declare -i major minor revision change
-  declare -i ref_major ref_minor ref_revision ref_change
-  declare -r spaceSTR="         "
-
-  ref_version=$1
-  tst_version=$2
-  TXT=$3
-
-  # This saves us the save/restore hassle of the system IFS value
-  local IFS
-
-  write_error_and_die() {
-     echo -e "\n\t\t$TXT version -->${tst_version}<-- is too old.
-		    This script requires ${ref_version} or greater\n"
-     exit 1
-  }
-
-  echo -ne "${TXT}${dotSTR:${#TXT}} ${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
-
-#  echo -ne "$TXT:\t${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
-  IFS=".-(p"   # Split up w.x.y.z as well as w.x.y-rc  (catch release candidates)
-  set -- $ref_version # set postional parameters to minimum ver values
-  ref_major=$1; ref_minor=$2; ref_revision=$3
-  #
-  set -- $tst_version # Set postional parameters to test version values
-  major=$1; minor=$2; revision=$3
-  #
-  # Compare against minimum acceptable version..
-  (( major > ref_major )) && echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF}" && return
-  (( major < ref_major )) && write_error_and_die
-    # major=ref_major
-  (( minor < ref_minor )) && write_error_and_die
-  (( minor > ref_minor )) && echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF}" && return
-    # minor=ref_minor
-  (( revision >= ref_revision )) && echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF}" && return
-
-  # oops.. write error msg and die
-  write_error_and_die
-}
-#  local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
-
-#----------------------------#
-check_prerequisites() {      #
-#----------------------------#
-
-  # LFS/HLFS/CLFS prerequisites
-  if [ ! "${PROGNAME}" = "hlfs" ]; then
-    check_version "2.6.2"    "`uname -r`"                                     "KERNEL"
-    check_version "2.0.5"    "$BASH_VERSION"                                  "BASH"
-    check_version "3.0.0"    "`gcc -dumpversion`"                             "GCC"
-    libcVer="`/lib/libc.so.6 | head -n1`"
-    libcVer="${libcVer##*version }"
-    check_version "2.2.5"    ${libcVer%%,*}                                     "GLIBC"
-    check_version "2.12"     "$(ld --version  | head -n1 | cut -d" " -f4)"      "BINUTILS"
-    check_version "1.14"     "$(tar --version | head -n1 | cut -d" " -f4)"      "TAR"
-    bzip2Ver="$(bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f8)"
-    check_version "1.0.2"    "${bzip2Ver%%,*}"                                   "BZIP2"
-    check_version "5.0"      "$(chown --version | head -n1 | cut -d")" -f2)"     "COREUTILS"
-    check_version "2.8"      "$(diff --version  | head -n1 | cut -d" " -f4)"     "DIFF"
-    check_version "4.1.20"   "$(find --version  | head -n1 | cut -d" " -f4)"     "FIND"
-    check_version "3.0"      "$(gawk --version  | head -n1 | cut -d" " -f3)"     "GAWK"
-    check_version "2.5"      "$(grep --version  | head -n1 | cut -d" " -f4)"     "GREP"
-    check_version "1.2.4"    "$(gzip --version 2>&1 | head -n1 | cut -d" " -f2)" "GZIP"
-    check_version "3.79.1"   "$(make --version  | head -n1 | cut -d " " -f3 | cut -c1-4)"    "MAKE"
-    check_version "2.5.4"    "$(patch --version | head -n1 | cut -d" " -f2)"     "PATCH"
-    check_version "3.0.2"    "$(sed --version   | head -n1 | cut -d" " -f4)"     "SED"
-  else
-    # HLFS prerequisites
-    check_version "2.6.2" "$(uname -r)"                                  "KERNEL"
-    check_version "3.0"   "$BASH_VERSION"                                "BASH"
-    check_version "3.0"   "$(gcc -dumpversion)"                          "GCC"
-    check_version "1.14"  "$(tar --version | head -n1 | cut -d" " -f4)"  "TAR"
-  fi
-
-  # Check for minimum sudo version
-  SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)"
-  if [ -x $SUDO_LOC ]; then
-    sudoVer="$(sudo -V | head -n1 | cut -d" " -f3)"
-    check_version "1.6.8"  "${sudoVer}"      "SUDO"
-  else
-    echo "${nl_}\"${RED}sudo${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
-    exit 1
-  fi
-
-  # Check for minimum libxml2 and libxslt versions
-  xsltprocVer=$(xsltproc -V | head -n1 )
-  libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
-  libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)
-
-  # Version numbers are packed strings not xx.yy.zz format.
-  check_version "2.06.20"  "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}"     "LIBXML2"
-  check_version "1.01.14"  "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}"  "LIBXSLT"
-
-  # The next versions checks are required only when BLFS_TOOL is set and
-  # this dependencies has not be selected for installation
-  if [[ "$BLFS_TOOL" = "y" ]] ; then
-
-    if [[ -z "$DEP_TIDY" ]] ; then
-      tidyVer=$(tidy -V | cut -d " " -f9)
-      check_version "2004" "${tidyVer}" "TIDY"
-    fi
-
-    # Check if the proper DocBook-XML-DTD and DocBook-XSL are correctly installed
-XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
-<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
-<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'
-  'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd'>
-<article>
-  <title>Test file</title>
-  <sect1>
-    <title>Some title</title>
-    <para>Some text</para>
-  </sect1>
-</article>"
-
-    if [[ -z "$DEP_DBXML" ]] ; then
-      if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
-        check_version "4.4" "4.4" "DocBook XML DTD"
-      else
-        echo "Warning: not found a working DocBook XML DTD 4.4 installation"
-        exit 2
-      fi
-    fi
-
-    if [[ -z "$DEP_DBXSL" ]] ; then
-      if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
-        check_version "1.69.1" "1.69.1" "DocBook XSL"
-      else
-        echo "Warning: not found a working DocBook XSL 1.69.1 installation"
-        exit 2
-      fi
-    fi
-
-  fi # end BLFS_TOOL=Y
-
-}
\ No newline at end of file

Deleted: jhalfs/trunk/common/func_compare.sh
===================================================================
--- jhalfs/trunk/common/func_compare.sh	2006-11-11 17:06:11 UTC (rev 3215)
+++ jhalfs/trunk/common/func_compare.sh	2006-11-11 17:20:27 UTC (rev 3216)
@@ -1,127 +0,0 @@
-# $Id$
-
-#----------------------------------#
-wrt_compare_targets() {            #
-#----------------------------------#
-
-  for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
-                                          # and "ITERATIONS" with no "$".
-    ITERATION=iteration-$N
-    if [ "$N" != "1" ] ; then
-      wrt_system_build "$N" "$PREV_IT"
-    fi
-    this_script=$ITERATION
-    CHROOT_wrt_target "$ITERATION" "$PREV"
-    wrt_compare_work "$ITERATION" "$PREV_IT"
-    wrt_logs "$N"
-    PREV_IT=$ITERATION
-    PREV=$ITERATION
-  done
-}
-
-#----------------------------------#
-wrt_system_build() {               #
-#----------------------------------#
-  local     RUN=$1
-  local PREV_IT=$2
-
-  if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "chroot" ]] ; then
-    chroot_final_system_Makefiles $RUN
-  elif [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
-    boot_final_system_Makefiles $RUN
-  else
-    chapter6_Makefiles $RUN
-  fi
-
-  if [[ "$PROGNAME" = "clfs" ]] ; then
-    basicsystem="$basicsystem $PREV_IT $system_build"
-  else
-    chapter6="$chapter6 $PREV_IT $system_build"
-  fi
-
-  if [[ "$RUN" = "$ITERATIONS" ]] ; then
-    if [[ "$PROGNAME" = "clfs" ]] ; then
-      basicsystem="$basicsystem iteration-$RUN"
-    else
-      chapter6="$chapter6 iteration-$RUN"
-    fi
-  fi
-
-  echo -e "\nsystem_build_$RUN: $PREV_IT $system_build" >> $MKFILE.tmp
-}
-
-#----------------------------------#
-wrt_compare_work() {               #
-#----------------------------------#
-  local ITERATION=$1
-  local   PREV_IT=$2
-  local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
-/sources /root /srv /sys /tmp /tools /usr/local /usr/src /var/log/paco"
-
-  local    ROOT_DIR=/
-  local DEST_TOPDIR=/${SCRIPT_ROOT}
-  local   ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
-  local FARCELOGDIR=/${SCRIPT_ROOT}/logs/farce
-
-  if [[ "$RUN_ICA" = "y" ]] ; then
-    local DEST_ICA=$DEST_TOPDIR/ICA && \
-(
-    cat << EOF
-	@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1 && \\
-	extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1
-EOF
-) >> $MKFILE.tmp
-    if [[ "$ITERATION" != "iteration-1" ]] ; then
-      wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
-    fi
-  fi
-
-  if [[ "$RUN_FARCE" = "y" ]] ; then
-    local DEST_FARCE=$DEST_TOPDIR/farce && \
-(
-    cat << EOF
-	@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION >>logs/$ITERATION.log 2>&1 && \\
-	extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/filelist-$ITERATION >>logs/$ITERATION.log 2>&1
-EOF
-) >> $MKFILE.tmp
-    if [[ "$ITERATION" != "iteration-1" ]] ; then
-      wrt_do_farce_work "$PREV_IT" "$ITERATION" "$DEST_FARCE"
-    fi
-  fi
-}
-
-#----------------------------------#
-wrt_do_ica_work() {                #
-#----------------------------------#
-  echo -e "\t at extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp
-}
-
-#----------------------------------#
-wrt_do_farce_work() {              #
-#----------------------------------#
-  local OUTPUT=$FARCELOGDIR/${1}_V_${2}
-  local PREDIR=$3/$1
-  local PREFILE=$3/filelist-$1
-  local ITEDIR=$3/$2
-  local ITEFILE=$3/filelist-$2
-  echo -e "\t at extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp
-}
-
-#----------------------------------#
-wrt_logs() {                       #
-#----------------------------------#
-  local ITERATION=iteration-$1
-
-(
-    cat << EOF
-	@pushd logs 1> /dev/null && \\
-	mkdir $ITERATION && \\
-	mv ${LOGS} $ITERATION && \\
-	popd 1> /dev/null
-	@touch \$@ && \\
-        sleep .25 && \\
-	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
-	echo --------------------------------------------------------------------------------\$(WHITE)
-EOF
-) >> $MKFILE.tmp
-}

Deleted: jhalfs/trunk/common/func_validate_configs.sh
===================================================================
--- jhalfs/trunk/common/func_validate_configs.sh	2006-11-11 17:06:11 UTC (rev 3215)
+++ jhalfs/trunk/common/func_validate_configs.sh	2006-11-11 17:20:27 UTC (rev 3216)
@@ -1,204 +0,0 @@
-# $Id$
-
-declare -r dotSTR=".................."
-
-
-#----------------------------#
-validate_config() {          # Are the config values sane (within reason)
-#----------------------------#
-: <<inline_doc
-      Validates the configuration parameters. The global var PROGNAME selects the
-    parameter list.
-
-    input vars: none
-    externals:  color constants
-                PROGNAME (lfs,clfs,hlfs)
-    modifies:   none
-    returns:    nothing
-    on error:   write text to console and dies
-    on success: write text to console and returns
-inline_doc
-
-  # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
-  local -r  hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL  GRSECURITY_HOST      TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL         PAGE TIMEZONE LANG LC_ALL LUSER LGROUP BLFS_TOOL              REBUILD_MAKEFILE"
-  local -r  clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG        LUSER LGROUP BLFS_TOOL              REBUILD_MAKEFILE"
-  local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE        ARCH TARGET                         OPTIMIZE REPORT                                      STRIP FSTAB             CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG        LUSER LGROUP BLFS_TOOL              REBUILD_MAKEFILE"
-  local -r clfs3_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE        ARCH TARGET                         OPTIMIZE REPORT                                      STRIP FSTAB             CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG        LUSER LGROUP BLFS_TOOL              REBUILD_MAKEFILE"
-  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 BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
-  local -r  blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
-
-  local -r  blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_UNZIP DEP_DBXML DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM"
-  local -r custom_tool_PARAM_LIST="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,'
-  local -r ERROR_MSG_pt2='rerun make and fix your configuration settings${OFF}'
-  local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
-
-  local    PARAM_LIST=
-  local config_param
-  local validation_str
-  local save_param
-
-  write_error_and_die() {
-    echo -e "\n${DD_BORDER}"
-    echo -e "`eval echo ${ERROR_MSG_pt1}`" >&2
-    echo -e "`eval echo ${ERROR_MSG_pt2}`" >&2
-    echo -e "${DD_BORDER}\n"
-    exit 1
-  }
-
-  validate_file() {
-     # For parameters ending with a '+' failure causes a warning message only
-     echo -n "`eval echo $PARAM_VALS`"
-     while test $# -gt 0 ; do
-       case $1 in
-        # Failures caused program exit
-        "-z")  [[   -z "${!config_param}" ]] && echo "${tab_}<-- NO file name given"  && write_error_and_die ;;
-        "-e")  [[ ! -e "${!config_param}" ]] && echo "${tab_}<-- file does not exist" && write_error_and_die ;;
-        "-s")  [[ ! -s "${!config_param}" ]] && echo "${tab_}<-- file has zero bytes" && write_error_and_die ;;
-        "-r")  [[ ! -r "${!config_param}" ]] && echo "${tab_}<-- no read permission " && write_error_and_die ;;
-        "-w")  [[ ! -w "${!config_param}" ]] && echo "${tab_}<-- no write permission" && write_error_and_die ;;
-        "-x")  [[ ! -x "${!config_param}" ]] && echo "${tab_}<-- file cannot be executed" && write_error_and_die ;;
-        # Warning messages only
-        "-z+") [[   -z "${!config_param}" ]] && echo && return ;;
-       esac
-       shift 1
-     done
-     echo
-  }
-
-  validate_dir() {
-     # For parameters ending with a '+' failure causes a warning message only
-     echo -n "`eval echo $PARAM_VALS`"
-     while test $# -gt 0 ; do
-       case $1 in
-        "-z") [[   -z "${!config_param}" ]] && echo "${tab_}NO directory name given" && write_error_and_die ;;
-        "-d") [[ ! -d "${!config_param}" ]] && echo "${tab_}This is NOT a directory" && write_error_and_die ;;
-        "-w") if [[ ! -w "${!config_param}" ]]; then
-                echo "${nl_}${DD_BORDER}"
-                echo "${tab_}${RED}You do not have ${L_arrow}write${R_arrow}${RED} access to the directory${OFF}"
-                echo "${tab_}${BOLD}${!config_param}${OFF}"
-                echo "${DD_BORDER}${nl_}"
-                exit 1
-              fi  ;;
-        # Warnings only
-        "-w+") if [[ ! -w "${!config_param}" ]]; then
-                 echo "${nl_}${DD_BORDER}"
-                 echo "${tab_}WARNING-- You do not have ${L_arrow}write${R_arrow} access to the directory${OFF}"
-                 echo "${tab_}       -- ${BOLD}${!config_param}${OFF}"
-                 echo "${DD_BORDER}"
-               fi  ;;
-        "-z+") [[ -z "${!config_param}" ]] && echo "${tab_}<-- NO directory name given" && return
-       esac
-       shift 1
-     done
-     echo
-  }
-
-  set +e
-  PARAM_GROUP=${PROGNAME}_PARAM_LIST
-  for config_param in ${!PARAM_GROUP}; do
-    case $config_param in
-      # Allways display this, if found in ${PROGNAME}_PARAM_LIST
-      GETPKG          | \
-      RUNMAKE         | \
-      TEST            | \
-      OPTIMIZE        | \
-      STRIP           | \
-      VIMLANG         | \
-      MODEL           | \
-      METHOD          | \
-      ARCH            | \
-      TARGET          | \
-      GRSECURITY_HOST | \
-      BLFS_TOOL       | \
-      CUSTOM_TOOLS    | \
-      TIMEZONE        | \
-      PAGE            | \
-      REBUILD_MAKEFILE ) echo -e "`eval echo $PARAM_VALS`" ;;
-
-      # Envvars that depend on other settings to be displayed
-      GETKERNEL ) if [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] ; then
-                    [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`"
-                  fi ;;
-      COMPARE)    [[ ! "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      RUN_ICA)    [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      RUN_FARCE)  [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      ITERATIONS) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      BOMB_TEST)  [[ ! "$TEST" = "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
-      TARGET32)   [[ -n "${TARGET32}" ]] &&  echo -e "`eval echo $PARAM_VALS`" ;;
-
-      # Envars that requires some validation
-      LUSER)      echo -e "`eval echo $PARAM_VALS`"
-                  [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
-                  ;;
-      LGROUP)     echo -e "`eval echo $PARAM_VALS`"
-                  [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
-                  ;;
-      REPORT)     echo -e "`eval echo $PARAM_VALS`"
-                  if [[ "${!config_param}" = "y" ]]; then
-                    if [[ `type -p bc` ]]; then
-                      continue
-                    else
-                      echo -e "  ${BOLD}The bc binary was not found${OFF}"
-                      echo -e "  The SBU and disk usage report creation will be skiped"
-                      REPORT=n
-                      continue
-                    fi
-                  fi ;;
-
-        # BOOK validation. Very ugly, need be fixed
-      BOOK)        if [[ "${WORKING_COPY}" = "y" ]] ; then
-                     validate_dir -z -d
-                   else
-                     echo -e "`eval echo $PARAM_VALS`"
-                   fi ;;
-
-        # Validate directories, testable states:
-        #  fatal   -z -d -w,
-        #  warning -z+   -w+
-      SRC_ARCHIVE) [[ "$GETPKG" = "y" ]] && validate_dir -z+ -d -w+ ;;
-        # The build directory/partition MUST exist and be writable by the user
-      BUILDDIR)   validate_dir -z -d -w
-                  [[ "xx x/x" =~ x${!config_param}x ]] && write_error_and_die ;;
-
-        # Validate files, testable states:
-        #  fatal   -z -e -s -w -x -r,
-        #  warning -z+
-      FSTAB)       validate_file -z+ -e -s ;;
-      CONFIG)      validate_file -z+ -e -s ;;
-      BOOT_CONFIG) [[ "${METHOD}" = "boot" ]] && validate_file -z -e -s ;;
-
-        # Treatment of 'special' parameters
-      LANG | \
-      LC_ALL)  # See it the locale values exist on this machine
-               echo -n "`eval echo $PARAM_VALS`"
-               [[ -z "${!config_param}" ]] &&
-                 echo " -- Variable $config_param cannot be empty!" &&
-                 write_error_and_die
-               echo
-               ;;
-
-      # BLFS params.
-      BRANCH_ID | BLFS_ROOT | BLFS_XML )  echo "`eval echo $PARAM_VALS`" ;;
-      TRACKING_DIR ) validate_dir -z -d -w ;;
-
-    esac
-  done
-
-  if [[ "${BLFS_TOOL}" = "y" ]] ; then
-    echo "${nl_}    ${BLUE}blfs-tool settings${OFF}"
-    for config_param in ${blfs_tool_PARAM_LIST}; do
-      echo -e "`eval echo $PARAM_VALS`"
-    done
-  fi
-
-  if [[ "${CUSTOM_TOOLS}" = "y" ]] && [[ "${BLFS_TOOL}" = "n" ]]  ; then
-    for config_param in ${custom_tool_PARAM_LIST}; do
-      echo -e "`eval echo $PARAM_VALS`"
-    done
-  fi
-
-  set -e
-  echo "${nl_}***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***${nl_}"
-}

Copied: jhalfs/trunk/common/libs/custom_pkgs (from rev 3214, jhalfs/trunk/common/custom_pkgs)
===================================================================
--- jhalfs/trunk/common/libs/custom_pkgs	                        (rev 0)
+++ jhalfs/trunk/common/libs/custom_pkgs	2006-11-11 17:20:27 UTC (rev 3216)
@@ -0,0 +1,134 @@
+#!/bin/bash
+
+# $Id$
+
+#----------------------------------#
+add_CustomTools() {                # Add any users supplied scripts
+#----------------------------------#
+  PREV_SCRIPT=""
+  CUSTOM_LIST=""
+
+  echo "Adding custom packages... ${BOLD}START${OFF}"
+
+  cd $JHALFSDIR
+  > ${MKFILE}.tmp2
+
+  # First some build commands and a placeholder for the build list.
+  # This will not cause problems if there are no custom scripts.
+( cat << xEOFx
+
+
+mk_CUSTOM_TOOLS:
+	@\$(call echo_CHROOT_request)
+	@ sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}
+	@( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make CUSTOM_TOOLS")
+	@touch \$@
+
+CUSTOM_TOOLS:
+xEOFx
+) >> ${MKFILE}.tmp2
+
+
+  for this_script in custom-commands/config/*; do
+    if [[ `basename ${this_script}` = "*" ]]; then
+      break
+    fi
+    source $this_script
+    THIS_SCRIPT=$(basename ${this_script})
+    echo "$tab_${GREEN}Adding${OFF} ${THIS_SCRIPT}"
+
+      # Create a Makefile entry
+    if [[ "x${PKG}" = "x" ]]; then
+    # Create an entry for a self contained cmd script that does not reference a package tarball
+( cat << EOF
+
+${THIS_SCRIPT}: ${PREV_SCRIPT}
+	@\$(call echo_message, Building)
+	@./progress_bar.sh \$@ \$\$PPID &
+	@( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT}
+	@touch \$@
+	@\$(call housekeeping)
+EOF
+) >> ${MKFILE}.tmp2
+
+    # Create the build script file
+( cat <<- xEOFx
+#!/bin/bash
+set -e
+
+`cat tmp`
+exit
+xEOFx
+) > custom-commands/scripts/$THIS_SCRIPT
+
+    else
+    # Create an entry for package
+( cat << EOF
+
+${THIS_SCRIPT}: ${PREV_SCRIPT}
+	@\$(call echo_message, Building)
+	@./progress_bar.sh \$@ \$\$PPID &
+	@\$(call remove_existing_dirs2,${PKG_FILE})
+	@\$(call unpack3,${PKG_FILE})
+	@\$(call get_pkg_root2)
+	@( time { source envars && /\$(SCRIPT_ROOT)/custom-commands/scripts/${THIS_SCRIPT} >>logs/${THIS_SCRIPT} 2>&1 ; } ) 2>>logs/${THIS_SCRIPT}
+	@\$(call remove_build_dirs2,${PKG})
+	@touch \$@
+	@touch ${TRACKING_DIR}/${PKG}-${PKG_VERSION}
+	@\$(call housekeeping)
+EOF
+) >> ${MKFILE}.tmp2
+
+    # Create the build script file
+( cat <<- xEOFx
+#!/bin/bash
+set -e
+
+cd \$PKGDIR
+`cat tmp`
+exit
+xEOFx
+) > custom-commands/scripts/$THIS_SCRIPT
+    fi
+
+    chmod 755 custom-commands/scripts/$THIS_SCRIPT
+    rm -f tmp
+    PREV_SCRIPT=$THIS_SCRIPT
+    CUSTOM_LIST="${CUSTOM_LIST}${THIS_SCRIPT} "
+  done
+
+  # Add the dependancy list.
+  sed "s|^CUSTOM_TOOLS:|CUSTOM_TOOLS: ${CUSTOM_LIST}|" -i ${MKFILE}.tmp2
+  cat ${MKFILE}.tmp2 >> ${MKFILE}
+  rm  ${MKFILE}.tmp2
+  echo "Adding custom packages... ${BOLD}DONE${OFF}"
+}
+
+
+
+#----------------------------------#
+add_CustomToolsURLS() {            # Add any users supplied scripts URL information
+#----------------------------------#
+  local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
+  local this_script
+  local URL PKG PKG_VERSION PKG_FILE MD5
+
+  > urls.lst.tmp
+  for this_script in $JHALFSDIR/custom-commands/config/*; do
+    if [[ `basename ${this_script}` = "*" ]]; then
+      CUSTOM_TOOLS="n"
+      break
+    fi
+    source $this_script
+      # A cmd only script had no PKG defined
+    [[ "x${PKG}" = "x" ]] && continue
+
+    echo "${URL} ${BLFS_SERVER}${PKG}/${PKG_FILE} ${MD5}" >> urls.lst.tmp
+     # Add any patches..
+    for PATCH in PATCH{1..10}; do
+      [[ -n ${!PATCH} ]] && echo "dummy-url ${!PATCH}" >> urls.lst.tmp
+    done
+  done
+  cat  urls.lst.tmp >> $BUILDDIR/sources/urls.lst
+  rm urls.lst.tmp
+}

Copied: jhalfs/trunk/common/libs/func_check_version.sh (from rev 3214, jhalfs/trunk/common/func_check_version.sh)
===================================================================
--- jhalfs/trunk/common/libs/func_check_version.sh	                        (rev 0)
+++ jhalfs/trunk/common/libs/func_check_version.sh	2006-11-11 17:20:27 UTC (rev 3216)
@@ -0,0 +1,158 @@
+# $Id$
+
+check_version() {
+: <<inline_doc
+      Tests for a minimum version level. Compares to version numbers and forces an
+        exit if minimum level not met.
+      NOTE: This test will fail on versions containing alpha chars. ie. jpeg 6b
+
+    usage:	check_version "2.6.2" "`uname -r`"         "KERNEL"
+		check_version "3.0"   "$BASH_VERSION"      "BASH"
+		check_version "3.0"   "`gcc -dumpversion`" "GCC"
+
+    input vars: $1=min acceptable version
+    		$2=version to check
+		$3=app name
+    externals:  --
+    modifies:   --
+    returns:    nothing
+    on error:	write text to console and dies
+    on success: write text to console and returns
+inline_doc
+
+  declare -i major minor revision change
+  declare -i ref_major ref_minor ref_revision ref_change
+  declare -r spaceSTR="         "
+
+  ref_version=$1
+  tst_version=$2
+  TXT=$3
+
+  # This saves us the save/restore hassle of the system IFS value
+  local IFS
+
+  write_error_and_die() {
+     echo -e "\n\t\t$TXT version -->${tst_version}<-- is too old.
+		    This script requires ${ref_version} or greater\n"
+     exit 1
+  }
+
+  echo -ne "${TXT}${dotSTR:${#TXT}} ${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
+
+#  echo -ne "$TXT:\t${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
+  IFS=".-(p"   # Split up w.x.y.z as well as w.x.y-rc  (catch release candidates)
+  set -- $ref_version # set postional parameters to minimum ver values
+  ref_major=$1; ref_minor=$2; ref_revision=$3
+  #
+  set -- $tst_version # Set postional parameters to test version values
+  major=$1; minor=$2; revision=$3
+  #
+  # Compare against minimum acceptable version..
+  (( major > ref_major )) && echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF}" && return
+  (( major < ref_major )) && write_error_and_die
+    # major=ref_major
+  (( minor < ref_minor )) && write_error_and_die
+  (( minor > ref_minor )) && echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF}" && return
+    # minor=ref_minor
+  (( revision >= ref_revision )) && echo " ${spaceSTR:${#tst_version}}${GREEN}OK${OFF}" && return
+
+  # oops.. write error msg and die
+  write_error_and_die
+}
+#  local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
+
+#----------------------------#
+check_prerequisites() {      #
+#----------------------------#
+
+  # LFS/HLFS/CLFS prerequisites
+  if [ ! "${PROGNAME}" = "hlfs" ]; then
+    check_version "2.6.2"    "`uname -r`"                                     "KERNEL"
+    check_version "2.0.5"    "$BASH_VERSION"                                  "BASH"
+    check_version "3.0.0"    "`gcc -dumpversion`"                             "GCC"
+    libcVer="`/lib/libc.so.6 | head -n1`"
+    libcVer="${libcVer##*version }"
+    check_version "2.2.5"    ${libcVer%%,*}                                     "GLIBC"
+    check_version "2.12"     "$(ld --version  | head -n1 | cut -d" " -f4)"      "BINUTILS"
+    check_version "1.14"     "$(tar --version | head -n1 | cut -d" " -f4)"      "TAR"
+    bzip2Ver="$(bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f8)"
+    check_version "1.0.2"    "${bzip2Ver%%,*}"                                   "BZIP2"
+    check_version "5.0"      "$(chown --version | head -n1 | cut -d")" -f2)"     "COREUTILS"
+    check_version "2.8"      "$(diff --version  | head -n1 | cut -d" " -f4)"     "DIFF"
+    check_version "4.1.20"   "$(find --version  | head -n1 | cut -d" " -f4)"     "FIND"
+    check_version "3.0"      "$(gawk --version  | head -n1 | cut -d" " -f3)"     "GAWK"
+    check_version "2.5"      "$(grep --version  | head -n1 | cut -d" " -f4)"     "GREP"
+    check_version "1.2.4"    "$(gzip --version 2>&1 | head -n1 | cut -d" " -f2)" "GZIP"
+    check_version "3.79.1"   "$(make --version  | head -n1 | cut -d " " -f3 | cut -c1-4)"    "MAKE"
+    check_version "2.5.4"    "$(patch --version | head -n1 | cut -d" " -f2)"     "PATCH"
+    check_version "3.0.2"    "$(sed --version   | head -n1 | cut -d" " -f4)"     "SED"
+  else
+    # HLFS prerequisites
+    check_version "2.6.2" "$(uname -r)"                                  "KERNEL"
+    check_version "3.0"   "$BASH_VERSION"                                "BASH"
+    check_version "3.0"   "$(gcc -dumpversion)"                          "GCC"
+    check_version "1.14"  "$(tar --version | head -n1 | cut -d" " -f4)"  "TAR"
+  fi
+
+  # Check for minimum sudo version
+  SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)"
+  if [ -x $SUDO_LOC ]; then
+    sudoVer="$(sudo -V | head -n1 | cut -d" " -f3)"
+    check_version "1.6.8"  "${sudoVer}"      "SUDO"
+  else
+    echo "${nl_}\"${RED}sudo${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
+    exit 1
+  fi
+
+  # Check for minimum libxml2 and libxslt versions
+  xsltprocVer=$(xsltproc -V | head -n1 )
+  libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
+  libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)
+
+  # Version numbers are packed strings not xx.yy.zz format.
+  check_version "2.06.20"  "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}"     "LIBXML2"
+  check_version "1.01.14"  "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}"  "LIBXSLT"
+
+  # The next versions checks are required only when BLFS_TOOL is set and
+  # this dependencies has not be selected for installation
+  if [[ "$BLFS_TOOL" = "y" ]] ; then
+
+    if [[ -z "$DEP_TIDY" ]] ; then
+      tidyVer=$(tidy -V | cut -d " " -f9)
+      check_version "2004" "${tidyVer}" "TIDY"
+    fi
+
+    # Check if the proper DocBook-XML-DTD and DocBook-XSL are correctly installed
+XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
+<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
+<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'
+  'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd'>
+<article>
+  <title>Test file</title>
+  <sect1>
+    <title>Some title</title>
+    <para>Some text</para>
+  </sect1>
+</article>"
+
+    if [[ -z "$DEP_DBXML" ]] ; then
+      if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
+        check_version "4.4" "4.4" "DocBook XML DTD"
+      else
+        echo "Warning: not found a working DocBook XML DTD 4.4 installation"
+        exit 2
+      fi
+    fi
+
+    if [[ -z "$DEP_DBXSL" ]] ; then
+      if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
+        check_version "1.69.1" "1.69.1" "DocBook XSL"
+      else
+        echo "Warning: not found a working DocBook XSL 1.69.1 installation"
+        exit 2
+      fi
+    fi
+
+  fi # end BLFS_TOOL=Y
+
+}
\ No newline at end of file

Copied: jhalfs/trunk/common/libs/func_compare.sh (from rev 3214, jhalfs/trunk/common/func_compare.sh)
===================================================================
--- jhalfs/trunk/common/libs/func_compare.sh	                        (rev 0)
+++ jhalfs/trunk/common/libs/func_compare.sh	2006-11-11 17:20:27 UTC (rev 3216)
@@ -0,0 +1,127 @@
+# $Id$
+
+#----------------------------------#
+wrt_compare_targets() {            #
+#----------------------------------#
+
+  for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
+                                          # and "ITERATIONS" with no "$".
+    ITERATION=iteration-$N
+    if [ "$N" != "1" ] ; then
+      wrt_system_build "$N" "$PREV_IT"
+    fi
+    this_script=$ITERATION
+    CHROOT_wrt_target "$ITERATION" "$PREV"
+    wrt_compare_work "$ITERATION" "$PREV_IT"
+    wrt_logs "$N"
+    PREV_IT=$ITERATION
+    PREV=$ITERATION
+  done
+}
+
+#----------------------------------#
+wrt_system_build() {               #
+#----------------------------------#
+  local     RUN=$1
+  local PREV_IT=$2
+
+  if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "chroot" ]] ; then
+    chroot_final_system_Makefiles $RUN
+  elif [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
+    boot_final_system_Makefiles $RUN
+  else
+    chapter6_Makefiles $RUN
+  fi
+
+  if [[ "$PROGNAME" = "clfs" ]] ; then
+    basicsystem="$basicsystem $PREV_IT $system_build"
+  else
+    chapter6="$chapter6 $PREV_IT $system_build"
+  fi
+
+  if [[ "$RUN" = "$ITERATIONS" ]] ; then
+    if [[ "$PROGNAME" = "clfs" ]] ; then
+      basicsystem="$basicsystem iteration-$RUN"
+    else
+      chapter6="$chapter6 iteration-$RUN"
+    fi
+  fi
+
+  echo -e "\nsystem_build_$RUN: $PREV_IT $system_build" >> $MKFILE.tmp
+}
+
+#----------------------------------#
+wrt_compare_work() {               #
+#----------------------------------#
+  local ITERATION=$1
+  local   PREV_IT=$2
+  local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
+/sources /root /srv /sys /tmp /tools /usr/local /usr/src /var/log/paco"
+
+  local    ROOT_DIR=/
+  local DEST_TOPDIR=/${SCRIPT_ROOT}
+  local   ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
+  local FARCELOGDIR=/${SCRIPT_ROOT}/logs/farce
+
+  if [[ "$RUN_ICA" = "y" ]] ; then
+    local DEST_ICA=$DEST_TOPDIR/ICA && \
+(
+    cat << EOF
+	@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1 && \\
+	extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1
+EOF
+) >> $MKFILE.tmp
+    if [[ "$ITERATION" != "iteration-1" ]] ; then
+      wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
+    fi
+  fi
+
+  if [[ "$RUN_FARCE" = "y" ]] ; then
+    local DEST_FARCE=$DEST_TOPDIR/farce && \
+(
+    cat << EOF
+	@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION >>logs/$ITERATION.log 2>&1 && \\
+	extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/filelist-$ITERATION >>logs/$ITERATION.log 2>&1
+EOF
+) >> $MKFILE.tmp
+    if [[ "$ITERATION" != "iteration-1" ]] ; then
+      wrt_do_farce_work "$PREV_IT" "$ITERATION" "$DEST_FARCE"
+    fi
+  fi
+}
+
+#----------------------------------#
+wrt_do_ica_work() {                #
+#----------------------------------#
+  echo -e "\t at extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp
+}
+
+#----------------------------------#
+wrt_do_farce_work() {              #
+#----------------------------------#
+  local OUTPUT=$FARCELOGDIR/${1}_V_${2}
+  local PREDIR=$3/$1
+  local PREFILE=$3/filelist-$1
+  local ITEDIR=$3/$2
+  local ITEFILE=$3/filelist-$2
+  echo -e "\t at extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp
+}
+
+#----------------------------------#
+wrt_logs() {                       #
+#----------------------------------#
+  local ITERATION=iteration-$1
+
+(
+    cat << EOF
+	@pushd logs 1> /dev/null && \\
+	mkdir $ITERATION && \\
+	mv ${LOGS} $ITERATION && \\
+	popd 1> /dev/null
+	@touch \$@ && \\
+        sleep .25 && \\
+	echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
+	echo --------------------------------------------------------------------------------\$(WHITE)
+EOF
+) >> $MKFILE.tmp
+}

Copied: jhalfs/trunk/common/libs/func_validate_configs.sh (from rev 3214, jhalfs/trunk/common/func_validate_configs.sh)
===================================================================
--- jhalfs/trunk/common/libs/func_validate_configs.sh	                        (rev 0)
+++ jhalfs/trunk/common/libs/func_validate_configs.sh	2006-11-11 17:20:27 UTC (rev 3216)
@@ -0,0 +1,204 @@
+# $Id$
+
+declare -r dotSTR=".................."
+
+
+#----------------------------#
+validate_config() {          # Are the config values sane (within reason)
+#----------------------------#
+: <<inline_doc
+      Validates the configuration parameters. The global var PROGNAME selects the
+    parameter list.
+
+    input vars: none
+    externals:  color constants
+                PROGNAME (lfs,clfs,hlfs)
+    modifies:   none
+    returns:    nothing
+    on error:   write text to console and dies
+    on success: write text to console and returns
+inline_doc
+
+  # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
+  local -r  hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL  GRSECURITY_HOST      TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG GETKERNEL         PAGE TIMEZONE LANG LC_ALL LUSER LGROUP BLFS_TOOL              REBUILD_MAKEFILE"
+  local -r  clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG        LUSER LGROUP BLFS_TOOL              REBUILD_MAKEFILE"
+  local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE        ARCH TARGET                         OPTIMIZE REPORT                                      STRIP FSTAB             CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG        LUSER LGROUP BLFS_TOOL              REBUILD_MAKEFILE"
+  local -r clfs3_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE        ARCH TARGET                         OPTIMIZE REPORT                                      STRIP FSTAB             CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG        LUSER LGROUP BLFS_TOOL              REBUILD_MAKEFILE"
+  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 BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
+  local -r  blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
+
+  local -r  blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_UNZIP DEP_DBXML DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM"
+  local -r custom_tool_PARAM_LIST="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,'
+  local -r ERROR_MSG_pt2='rerun make and fix your configuration settings${OFF}'
+  local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
+
+  local    PARAM_LIST=
+  local config_param
+  local validation_str
+  local save_param
+
+  write_error_and_die() {
+    echo -e "\n${DD_BORDER}"
+    echo -e "`eval echo ${ERROR_MSG_pt1}`" >&2
+    echo -e "`eval echo ${ERROR_MSG_pt2}`" >&2
+    echo -e "${DD_BORDER}\n"
+    exit 1
+  }
+
+  validate_file() {
+     # For parameters ending with a '+' failure causes a warning message only
+     echo -n "`eval echo $PARAM_VALS`"
+     while test $# -gt 0 ; do
+       case $1 in
+        # Failures caused program exit
+        "-z")  [[   -z "${!config_param}" ]] && echo "${tab_}<-- NO file name given"  && write_error_and_die ;;
+        "-e")  [[ ! -e "${!config_param}" ]] && echo "${tab_}<-- file does not exist" && write_error_and_die ;;
+        "-s")  [[ ! -s "${!config_param}" ]] && echo "${tab_}<-- file has zero bytes" && write_error_and_die ;;
+        "-r")  [[ ! -r "${!config_param}" ]] && echo "${tab_}<-- no read permission " && write_error_and_die ;;
+        "-w")  [[ ! -w "${!config_param}" ]] && echo "${tab_}<-- no write permission" && write_error_and_die ;;
+        "-x")  [[ ! -x "${!config_param}" ]] && echo "${tab_}<-- file cannot be executed" && write_error_and_die ;;
+        # Warning messages only
+        "-z+") [[   -z "${!config_param}" ]] && echo && return ;;
+       esac
+       shift 1
+     done
+     echo
+  }
+
+  validate_dir() {
+     # For parameters ending with a '+' failure causes a warning message only
+     echo -n "`eval echo $PARAM_VALS`"
+     while test $# -gt 0 ; do
+       case $1 in
+        "-z") [[   -z "${!config_param}" ]] && echo "${tab_}NO directory name given" && write_error_and_die ;;
+        "-d") [[ ! -d "${!config_param}" ]] && echo "${tab_}This is NOT a directory" && write_error_and_die ;;
+        "-w") if [[ ! -w "${!config_param}" ]]; then
+                echo "${nl_}${DD_BORDER}"
+                echo "${tab_}${RED}You do not have ${L_arrow}write${R_arrow}${RED} access to the directory${OFF}"
+                echo "${tab_}${BOLD}${!config_param}${OFF}"
+                echo "${DD_BORDER}${nl_}"
+                exit 1
+              fi  ;;
+        # Warnings only
+        "-w+") if [[ ! -w "${!config_param}" ]]; then
+                 echo "${nl_}${DD_BORDER}"
+                 echo "${tab_}WARNING-- You do not have ${L_arrow}write${R_arrow} access to the directory${OFF}"
+                 echo "${tab_}       -- ${BOLD}${!config_param}${OFF}"
+                 echo "${DD_BORDER}"
+               fi  ;;
+        "-z+") [[ -z "${!config_param}" ]] && echo "${tab_}<-- NO directory name given" && return
+       esac
+       shift 1
+     done
+     echo
+  }
+
+  set +e
+  PARAM_GROUP=${PROGNAME}_PARAM_LIST
+  for config_param in ${!PARAM_GROUP}; do
+    case $config_param in
+      # Allways display this, if found in ${PROGNAME}_PARAM_LIST
+      GETPKG          | \
+      RUNMAKE         | \
+      TEST            | \
+      OPTIMIZE        | \
+      STRIP           | \
+      VIMLANG         | \
+      MODEL           | \
+      METHOD          | \
+      ARCH            | \
+      TARGET          | \
+      GRSECURITY_HOST | \
+      BLFS_TOOL       | \
+      CUSTOM_TOOLS    | \
+      TIMEZONE        | \
+      PAGE            | \
+      REBUILD_MAKEFILE ) echo -e "`eval echo $PARAM_VALS`" ;;
+
+      # Envvars that depend on other settings to be displayed
+      GETKERNEL ) if [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] ; then
+                    [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`"
+                  fi ;;
+      COMPARE)    [[ ! "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      RUN_ICA)    [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      RUN_FARCE)  [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      ITERATIONS) [[ "$COMPARE" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      BOMB_TEST)  [[ ! "$TEST" = "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;;
+      TARGET32)   [[ -n "${TARGET32}" ]] &&  echo -e "`eval echo $PARAM_VALS`" ;;
+
+      # Envars that requires some validation
+      LUSER)      echo -e "`eval echo $PARAM_VALS`"
+                  [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
+                  ;;
+      LGROUP)     echo -e "`eval echo $PARAM_VALS`"
+                  [[ "${!config_param}" = "**EDIT ME**" ]] && write_error_and_die
+                  ;;
+      REPORT)     echo -e "`eval echo $PARAM_VALS`"
+                  if [[ "${!config_param}" = "y" ]]; then
+                    if [[ `type -p bc` ]]; then
+                      continue
+                    else
+                      echo -e "  ${BOLD}The bc binary was not found${OFF}"
+                      echo -e "  The SBU and disk usage report creation will be skiped"
+                      REPORT=n
+                      continue
+                    fi
+                  fi ;;
+
+        # BOOK validation. Very ugly, need be fixed
+      BOOK)        if [[ "${WORKING_COPY}" = "y" ]] ; then
+                     validate_dir -z -d
+                   else
+                     echo -e "`eval echo $PARAM_VALS`"
+                   fi ;;
+
+        # Validate directories, testable states:
+        #  fatal   -z -d -w,
+        #  warning -z+   -w+
+      SRC_ARCHIVE) [[ "$GETPKG" = "y" ]] && validate_dir -z+ -d -w+ ;;
+        # The build directory/partition MUST exist and be writable by the user
+      BUILDDIR)   validate_dir -z -d -w
+                  [[ "xx x/x" =~ x${!config_param}x ]] && write_error_and_die ;;
+
+        # Validate files, testable states:
+        #  fatal   -z -e -s -w -x -r,
+        #  warning -z+
+      FSTAB)       validate_file -z+ -e -s ;;
+      CONFIG)      validate_file -z+ -e -s ;;
+      BOOT_CONFIG) [[ "${METHOD}" = "boot" ]] && validate_file -z -e -s ;;
+
+        # Treatment of 'special' parameters
+      LANG | \
+      LC_ALL)  # See it the locale values exist on this machine
+               echo -n "`eval echo $PARAM_VALS`"
+               [[ -z "${!config_param}" ]] &&
+                 echo " -- Variable $config_param cannot be empty!" &&
+                 write_error_and_die
+               echo
+               ;;
+
+      # BLFS params.
+      BRANCH_ID | BLFS_ROOT | BLFS_XML )  echo "`eval echo $PARAM_VALS`" ;;
+      TRACKING_DIR ) validate_dir -z -d -w ;;
+
+    esac
+  done
+
+  if [[ "${BLFS_TOOL}" = "y" ]] ; then
+    echo "${nl_}    ${BLUE}blfs-tool settings${OFF}"
+    for config_param in ${blfs_tool_PARAM_LIST}; do
+      echo -e "`eval echo $PARAM_VALS`"
+    done
+  fi
+
+  if [[ "${CUSTOM_TOOLS}" = "y" ]] && [[ "${BLFS_TOOL}" = "n" ]]  ; then
+    for config_param in ${custom_tool_PARAM_LIST}; do
+      echo -e "`eval echo $PARAM_VALS`"
+    done
+  fi
+
+  set -e
+  echo "${nl_}***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***${nl_}"
+}




More information about the alfs-log mailing list