diff --git a/common/common-functions b/common/common-functions index dd7f1d3..d63f79f 100644 --- a/common/common-functions +++ b/common/common-functions @@ -2,173 +2,7 @@ # $Id$ -set +e - -# VT100 colors -declare -r BLACK=$'\e[1;30m' -declare -r DK_GRAY=$'\e[0;30m' - -declare -r RED=$'\e[31m' -declare -r GREEN=$'\e[32m' -declare -r YELLOW=$'\e[33m' -declare -r BLUE=$'\e[34m' -declare -r MAGENTA=$'\e[35m' -declare -r CYAN=$'\e[36m' -declare -r WHITE=$'\e[37m' - -declare -r OFF=$'\e[0m' -declare -r BOLD=$'\e[1m' -declare -r REVERSE=$'\e[7m' -declare -r HIDDEN=$'\e[8m' - -declare -r tab_=$'\t' -declare -r nl_=$'\n' - -declare -r DD_BORDER="${BOLD}==============================================================================${OFF}" -declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}" -declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}" - -# bold yellow > < pair -declare -r R_arrow=$'\e[1;33m>\e[0m' -declare -r L_arrow=$'\e[1;33m<\e[0m' - - -usage() { -cat <<- -EOF- -${DD_BORDER} -${BOLD} - Usage: $0 ${BOLD}[OPTION] - -${RED}IMPORTANT:${OFF} Only supported command line switches are listed here. - For more fine-grained setups you must edit the relevant - configuration files placed under ${BOLD}common/${OFF} and ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])/${OFF} - -Options: -${BOLD} -h, --help${OFF} - print this help, then exit - -${BOLD} -V, --version${OFF} - print version information, then exit - -${BOLD} -B, --book VER${OFF} - use VER version of the book as the system to build. - Supported VER values are: - dev*, trunk, SVN = aliases for the Development version of {C,H}LFS - branch-NAME = a branch of name NAME - VERSION = the version of a stable released book - To know what branches and stable books work with this version of jhalfs - please see http://wiki.linuxfromscratch.org/alfs/wiki/SupportedBooks - -${BOLD} -D --directory DIR${OFF} - use DIR directory for building ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF}; all files jhalfs-X produces - will be in the directory DIR/${SCRIPT_ROOT}. - The current setting for BUILDDIR is "$BUILDDIR" - -${BOLD} -G, --get-packages${OFF} - download the packages and patches. This assumes that the server declared - in the configuration file has the proper packages and patches for the - book version being processed. - -${BOLD} -O, --optimize${OFF} - Optimize [0-2] - 0 = no optimization - 1 = optimize final system only - 2 = optimize both temporary tools and final system - Edit common/opt_config{,.d/*} and common/opt_override as desired. - -${BOLD} -T, --testsuites N ${OFF} - Run test suites [0-3] - 0 = none - 1 = only final system Glibc, GCC and Binutils testsuites - 2 = all final system testsuites - 3 = all temporary tools and final system testsuites - In CLFS and HLFS, 3 is an alias to 2 - -${BOLD} -W, --working-copy DIR${OFF} - use the local working copy placed in DIR as the $(echo $PROGNAME | tr [a-z] [A-Z]) book - -${BOLD} -C, --comparison TYPE${OFF} - do iterative comparison analysis. This extends the total build time - considerably because the entire final system will rebuild itself - the number of times specified by ITERATIONS in common/config. - Types allowed are: - ICA = do ICA as designed by Greg Schafer - farce = do the farce analysis designed by Ken Moffat - both = perform both ICA and farce analysis - -${BOLD} -F, --fstab FILE${OFF} - use FILE as the /etc/fstab file for the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} system. If not specified, - a default /etc/fstab file with dummy values is created. - -${BOLD} -K, --kernel-config FILE${OFF} - use the kernel configuration file specified in FILE to build the kernel. - if the file is not found, or if not specified, the kernel build is skipped. - -${BOLD} -M, --run-make${OFF} - run make on the generated Makefile - -${BOLD} -R --rebuild${OFF} - clean the build directory before performing any other task. The directory - is cleaned only if it was populated by a previous jhalfs-X run. --EOF- - -[[ ${PROGNAME} = "clfs" ]] && -cat <<- -EOF- - -${BOLD} -A, --arch ARCH ${OFF} - Select the TARGET architecture, valid selections are: - 32bit builds - x86, i486, i586, ppc, mips, mipsel, sparc - 64bit builds - x86_64-64, mips64-64, mipsel64-64, sparc64-64, alpha - 64bit multi-lib - x86_64, mips64, mipsel64, sparc64, ppc64 - -${BOLD} --boot-config FILE ${OFF} - The configuration file for the bootstrap kernel if method=boot - -${BOLD} --method BUILDMETHOD ${OFF} - Select the build method, chroot or boot --EOF- - -[[ ${PROGNAME} = "clfs2" ]] && -cat <<- -EOF- - -${BOLD} -A, --arch ARCH ${OFF} - Select the TARGET architecture, valid selections are: - 32bit builds - arm - 64bit builds - - 64bit multi-lib --EOF- - -[[ ${PROGNAME} = "hlfs" ]] && -cat <<- -EOF- - -${BOLD} --model STYLE ${OFF} - Select the library model for the HLFS system - Valid choices are: glibc or uclibc --EOF- - -cat <<- -EOF- -${DD_BORDER} --EOF- - exit -} - -version=" -${BOLD} \"jhalfs-X\"${OFF} builder tool (experimental) \$Rev$ -\$Date$ - -${BOLD} \"${PROGNAME}\"${OFF} script module - -Written by George Boudreau, - Manuel Canales Esparcia, - Jeremy Huntwork - -This program is published under the ${BOLD}Gnu General Public License, Version 2.${OFF} -" +set -e no_empty_builddir() { @@ -189,13 +23,6 @@ ${DD_BORDER} } -help="${nl_}Try '$0 --help' for more information." - -exit_missing_arg="\ -echo \"Option '\$1' requires an argument\" >&2 -echo \"\$help\" >&2 -exit 1" - HEADER="# This file is automatically generated by jhalfs-X # DO NOT EDIT THIS FILE MANUALLY # @@ -474,7 +301,7 @@ wrt_RunAsRoot() { # Some scripts must be run as root.. hlfs ) MOUNT_ENV="HLFS" ;; *) echo "undefined progname $PROGNAME"; exit 1 esac - + ( cat << EOF @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\ diff --git a/master.sh b/master.sh index 15661ed..b6e7c84 100755 --- a/master.sh +++ b/master.sh @@ -2,6 +2,34 @@ # $Id$ set -e +# VT100 colors +declare -r BLACK=$'\e[1;30m' +declare -r DK_GRAY=$'\e[0;30m' + +declare -r RED=$'\e[31m' +declare -r GREEN=$'\e[32m' +declare -r YELLOW=$'\e[33m' +declare -r BLUE=$'\e[34m' +declare -r MAGENTA=$'\e[35m' +declare -r CYAN=$'\e[36m' +declare -r WHITE=$'\e[37m' + +declare -r OFF=$'\e[0m' +declare -r BOLD=$'\e[1m' +declare -r REVERSE=$'\e[7m' +declare -r HIDDEN=$'\e[8m' + +declare -r tab_=$'\t' +declare -r nl_=$'\n' + +declare -r DD_BORDER="${BOLD}==============================================================================${OFF}" +declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}" +declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}" + +# bold yellow > < pair +declare -r R_arrow=$'\e[1;33m>\e[0m' +declare -r L_arrow=$'\e[1;33m<\e[0m' + #>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>> #-----------------------# @@ -33,8 +61,21 @@ trap simple_error ERR trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23 #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +version=" +${BOLD} \"jhalfs-X\"${OFF} builder tool (experimental) \$Rev$ + \$Date$ + + Written by George Boudreau and Manuel Canales Esparcia, + plus several contributions. + + Based on an idea from Jeremy Huntwork + + This set of files are published under the + ${BOLD}Gnu General Public License, Version 2.${OFF} +" if [ ! -L $0 ] ; then + echo "$version" echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}" exit 1 fi