diff --git a/CLFS/config b/CLFS/config deleted file mode 100644 index 7dc9430..0000000 --- a/CLFS/config +++ /dev/null @@ -1,79 +0,0 @@ -##### -# -# Configuration file for the CLFS module -# -# $Id$ -# -##### - -#--- Which target architecture you want to build for, -# used to select proper book and set TARGETS -#-------------------------------- -TARGET32="" -TARGET= -# >>>> 32-32 BUILD <<<< - ARCH=x86 ; TARGET="i486-pc-linux-gnu" -# ARCH=x86 ; TARGET="i586-pc-linux-gnu" -# ARCH=x86 ; TARGET="i686-pc-linux-gnu" -# ARCH=ppc ; TARGET="powerpc-unknown-linux-gnu" -# ARCH=mips ; TARGET="mipsel-unknown-linux-gnu" -# ARCH=mips ; TARGET="mips-unknown-linux-gnu" -# ARCH=sparc ; TARGET="sparcv9-unknown-linux-gnu" -#-------------------------------- -# >>>> 64-64 BUILD <<<< -# ARCH=x86_64-64 ; TARGET="x86_64-unknown-linux-gnu" -# ARCH=mips64-64 ; TARGET="mips64el-unknown-linux-gnu" -# ARCH=mips64-64 ; TARGET="mips64-unknown-linux-gnu" -# ARCH=sparc64-64 ; TARGET="sparc64-unknown-linux-gnu" -# ARCH=alpha ; TARGET="alpha-unknown-linux-gnu" -#-------------------------------- -# >>>> MULTILIB 32/64 <<<< -# ARCH=x86_64 ; TARGET="x86_64-unknown-linux-gnu" ; TARGET32="i686-pc-linux-gnu" -# ARCH=mips64 ; TARGET="mips64el-unknown-linux-gnu" ; TARGET32="mipsel-unknown-linux-gnu" -# ARCH=mips64 ; TARGET="mips64-unknown-linux-gnu" ; TARGET32="mips-unknown-linux-gnu" -# ARCH=sparc64 ; TARGET="sparc64-unknown-linux-gnu" ; TARGET32="sparc-unknown-linux-gnu" -# ARCH=ppc64 ; TARGET="powerpc64-unknown-linux-gnu" ; TARGET32="powerpc-unknown-linux-gnu" - -#--- What build method should be used chroot/boot -# NOTE: not all combinations are 'bootable' yet. -METHOD=chroot - -#--- Unprivileged user and group name -LUSER=clfs -LGROUP=clfs - -#--- Location of fstab file (if empty, a template is created) -FSTAB= - -#--- Fully qualified path to a kernel config file -# If no config file is specified the kernel is NOT compiled -CONFIG= - -#--- If METHOD=boot, location of boot-kernel config file -# NOTE: this setting is required -BOOT_CONFIG= - -# Get the kernel package and patches even if no configutation file -# has been supplied? n(no)/y(yes) -GETKERNEL=n - -#--- Book's sources directory -# If you have previously checked out the book from the repository -BOOK= - -#==== INTERNAL VARIABLES ==== -# Don't edit it unless you know what you are doing - -#--- Extra files that need be copied to $JHALFSDIR -FILES="" - -#--- Default stylesheet -XSL=clfs.xsl - -#--- Book version -LFSVRS=development -TREE=trunk/BOOK - -#--- Name of the makefile -MKFILE=$JHALFSDIR/Makefile - diff --git a/CLFS2/config b/CLFS2/config deleted file mode 100644 index 9715548..0000000 --- a/CLFS2/config +++ /dev/null @@ -1,58 +0,0 @@ -##### -# -# Configuration file for the CLFS module -# -# $Id$ -# -##### - -#--- Which target architecture you want to build for, -# used to select proper book and set TARGETS -#-------------------------------- -TARGET= -TARGET32= -# >>>> 32-32 BUILD <<<< - ARCH=x86 ; TARGET="i486-pc-linux-gnu" -# ARCH=x86 ; TARGET="i586-pc-linux-gnu" -# ARCH=x86 ; TARGET="i686-pc-linux-gnu" -# ARCH=arm ; TARGET="arm-unknown-linux-gnu" -#-------------------------------- -# >>>> 64-64 BUILD <<<< -#-------------------------------- -# >>>> MULTILIB 32/64 <<<< - -#--- Unprivileged user and group name -LUSER=clfs -LGROUP=clfs - -#--- Location of fstab file (if empty, a template is created) -FSTAB= - -#--- Fully qualified path to a kernel config file -# If no config file is specified the kernel is NOT compiled -CONFIG= - -# Get the kernel package and patches even if no configutation file -# has been supplied? n(no)/y(yes) -GETKERNEL=n - -#--- Book's sources directory -# If you have previously checked out the book from the repository -BOOK= - -#==== INTERNAL VARIABLES ==== -# Don't edit it unless you know what you are doing - -#--- Extra files that need be copied to $JHALFSDIR -FILES="" - -#--- Default stylesheet -XSL=clfs2.xsl - -#--- Book version -LFSVRS=development -TREE=branches/clfs-2.0/BOOK - -#--- Name of the makefile -MKFILE=$JHALFSDIR/Makefile - diff --git a/Config.in b/Config.in index 4f8a02b..3fabd8a 100644 --- a/Config.in +++ b/Config.in @@ -26,14 +26,19 @@ menu "--- BOOK Settings" bool "Beyond Linux From Scratch" endchoice + config PROGNAME + string + default "lfs" if BOOK_LFS + default "clfs" if BOOK_CLFS + default "clfs2" if BOOK_CLFS2 +# default "clfs3" if BOOK_CLFS3 + default "hlfs" if BOOK_HLFS + default "blfs" if BOOK_BLFS + config RUN_ME string - default "./lfs" if BOOK_LFS - default "./clfs" if BOOK_CLFS - default "./clfs2" if BOOK_CLFS2 -# default "./clfs3" if BOOK_CLFS3 - default "./hlfs" if BOOK_HLFS - default "./blfs" if BOOK_BLFS + default "./jhalfs run" if !BOOK_BLFS + default "./blfs-tool" if BOOK_BLFS #--- End BOOK/script #--- Book version @@ -386,6 +391,16 @@ menu "--- General Settings" # Any missing file will be downloaded and archived here, # if the user has the right priviledges. + config SERVER + string "FTP mirror" + default "ftp://ftp.lfs-matrix.net" + depends GETPKG + help + #-- FTP mirror to download packages and patches if not found + # in $SRC_ARCHIVE + # As a last resort, the files will dowloaded from upstream, + # if possible. + config GETKERNEL bool "Always retrieve kernel package" default n @@ -627,9 +642,9 @@ menu "--- Advanced Features" #-- Run farce testing #--- End ICA/farce - #-- Optimizations + #--- Optimizations config CONFIG_OPTIMIZE - bool "Use optimization " + bool "Use optimization (see help)" default n help #-- Actual optimzation flags MUST be defined in ./optimize/* @@ -663,18 +678,47 @@ menu "--- Advanced Features" default "2" if OPT_2 #--- End Optimizations + #-- Internal Settings + menu "--- Internal Settings (WARNING: for jhalfs developers only)" + + config SCRIPT_ROOT + string "Scripts root" + default "jhalfs" + + config JHALFSDIR + string "jhalfs directory" + default "$BUILDDIR/$SCRIPT_ROOT" + + config LOGDIR + string "Build logs directory" + default "$JHALFSDIR/logs" + + config TESTLOGDIR + string "Test suites logs directory" + default "$JHALFSDIR/test-logs" + + config ICALOGDIR + string "ICA logs directory" + default "$LOGDIR/ICA" + + config FARCELOGDIR + string "farce logs directory" + default "$LOGDIR/farce" + + config MKFILE + string "Makefile" + default "$JHALFSDIR/Makefile" + + config XSL + string "XSL stylesheet" + default "$PROGNAME.xsl" + + config PKG_LST + string "Package contents list" + default "unpacked" + + #--- End Internal Settings + endmenu + #--- End Advanced Features endmenu - -# config CONFIG_BLFS_CMDS -# bool "Add BLFS packages to current build" -# default n -# depends !BOOK_HLFS && XXX -# help -# #--- Select this option if you wish to install any BLFS packages -# # as part of your {c,h}lfs build. -# # Any needed packages will be downloaded to the /sources dir -# config BLFS_CMDLINE -# string "BLFS packages" -# default "none" -# depends CONFIG_BLFS_CMDS diff --git a/HLFS/config b/HLFS/config deleted file mode 100644 index e643b0c..0000000 --- a/HLFS/config +++ /dev/null @@ -1,48 +0,0 @@ -##### -# -# Configuration file for the HLFS module -# -# $Id$ -# -##### - -#--- Which library model to use uclibc/glibc -MODEL=glibc - -#--- The host system has grsecurity options enabled? n(no)/y(yes) -GRSECURITY_HOST=n - -#--- Unprivileged user and group name -LUSER=hlfs -LGROUP=hlfs - -#--- Location of fstab file (if empty, a template is created) -FSTAB= - -#--- Fully qualified path to a kernel config file -# If no config file is specified the kernel is NOT compiled -CONFIG= - -# Get the kernel package and patches even if no configutation file -# has been supplied? n(no)/y(yes) -GETKERNEL=n - -#--- Book's sources directory -# If you have previously checked out the book from the repository -BOOK= - -#==== INTERNAL VARIABLES ==== -# Don't edit it unless you know what you are doing - -#--- Extra files that need be copied to $JHALFSDIR -FILES="" - -#--- Default stylesheet -XSL=hlfs.xsl - -#--- Book version -LFSVRS=development -TREE=trunk/BOOK - -#--- Name of the makefile -MKFILE=$JHALFSDIR/Makefile diff --git a/LFS/config b/LFS/config deleted file mode 100644 index 84538be..0000000 --- a/LFS/config +++ /dev/null @@ -1,42 +0,0 @@ -##### -# -# Configuration file for the LFS module -# -# $Id$ -# -##### - -#--- Unprivileged user and group name -LUSER=lfs -LGROUP=lfs - -#--- Location of fstab file (if empty, a template is created) -FSTAB= - -#--- Fully qualified path to a kernel config file -# If no config file is specified the kernel is NOT compiled -CONFIG= - -# Get the kernel package and patches even if no configuration file -# has been supplied? n(no)/y(yes) -GETKERNEL=n - -#--- Book's sources directory -# If you have previously checked out the book from the repository -BOOK= - -#==== INTERNAL VARIABLES ==== -# Don't edit it unless you know what you are doing - -#--- Extra files that need be copied to $JHALFSDIR -FILES="" - -#--- Default stylesheet -XSL=lfs.xsl - -#--- Book version -LFSVRS=development -TREE=trunk/BOOK - -#--- Name of the makefile -MKFILE=$JHALFSDIR/Makefile diff --git a/Makefile b/Makefile index d73426a..d5ae127 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,8 @@ CONFIG_CONFIG_IN = Config.in CONFIG = menu all: menuconfig - @clear - @touch using_menuconfig - @`grep RUN_ME configuration | sed -e 's@RUN_ME=\"@@' -e 's@\"@@' ` || rm -f using_menuconfig - @rm -f using_menuconfig - +# @clear + @`grep RUN_ME configuration | sed -e 's@RUN_ME=\"@@' -e 's@\"@@' ` $(CONFIG)/conf: $(MAKE) -C $(CONFIG) conf diff --git a/blfs b/blfs-tool similarity index 97% rename from blfs rename to blfs-tool index f528f5b..f6d141f 100755 --- a/blfs +++ b/blfs-tool @@ -44,7 +44,7 @@ simple_error() { # Basic error trap.... JUST DIE } see_ya() { - echo -e "\n${L_arrow}${BOLD}jhalfs${R_arrow} exit${OFF}\n" + echo -e "\n${L_arrow}${BOLD}jhalfs-X${R_arrow} exit${OFF}\n" } ##### Simple error TRAPS # ctrl-c SIGINT @@ -64,9 +64,8 @@ trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # envars not sourced from configuration file - PROGNAME=$(basename $0) COMMON_DIR="common" - VERBOSITY=1 +VERBOSITY=1 [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from ..." source configuration diff --git a/clfs b/clfs deleted file mode 120000 index fba0373..0000000 --- a/clfs +++ /dev/null @@ -1 +0,0 @@ -master.sh \ No newline at end of file diff --git a/clfs2 b/clfs2 deleted file mode 120000 index fba0373..0000000 --- a/clfs2 +++ /dev/null @@ -1 +0,0 @@ -master.sh \ No newline at end of file diff --git a/common/common-functions b/common/common-functions index a03af8d..577853f 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 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 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\"${OFF} builder tool (development) \$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 # DO NOT EDIT THIS FILE MANUALLY # @@ -620,7 +447,7 @@ get_book() { # #----------------------------# cd $JHALFSDIR - if [ -z $WC ] ; then + if [ -z $WORKING_COPY ] ; then # Check for Subversion instead of just letting the script hit 'svn' and fail. test `type -p svn` || eval "echo \"This feature requires Subversion.\" exit 1" diff --git a/common/config b/common/config deleted file mode 100644 index 5e0d451..0000000 --- a/common/config +++ /dev/null @@ -1,110 +0,0 @@ -##### -# -# common configuration file -# -# $Id$ -##### - -declare -r SVN="svn://svn.linuxfromscratch.org" -declare -r LOG=000-masterscript.log - -#--- Mount point for the build -BUILDDIR=/mnt/build_dir - -# Create SBU and disk usage report n(no)/y(yes) -# NOTE: requires to have bc installed on the host -REPORT=y - -#=== Getting packages === -# Files will be retrieved from the local archive SRC_ARCHIVE -# (if defined) or the 'net and will be stored in $BUILDDIR/sources -#--- Download the source packages n(no)/y(yes) -GETPKG=n - -#--- The local repository for packages/file -# Used only if GETPKG = y -# Any missing file will be downloaded and archived here, -# if the user has the right priviledges. -SRC_ARCHIVE=$SRC_ARCHIVE - -# --- Server used if the file isn't found in SRC_ARCHIVE. -# As a last resort, the file will dowloaded from upstream, if possible. -SERVER=ftp://ftp.lfs-matrix.net - -#=== Build options === -#--- Automatically run the makefile once it has been created n(no)/y(yes) -RUNMAKE=n - -#--- Optimize the build [0-2] -# 0 = no optimization -# 1 = optimize final system only -# 2 = optimize both temporary tools and final system -# -# Optimization values are set in optimize/* files -OPTIMIZE=0 - -#--- Run test suites [0-3] -# 0 = none -# 1 = only chapter06 Glibc, GCC and Binutils testsuites -# 2 = all chapter06 testsuites -# 3 = all chapter05 and chapter06 testsuites -# (in CLFS and HLFS, alias to 2) -TEST=1 - -#--- Bomb on test suites failures? -# n = no, I want to build the full system and review the logs -# y = yes, bomb at the first test suite failure to can review the build dir -BOMB_TEST=n - -#--- Run the stripping phases n(no)/y(yes) -STRIP=y - -#--- page definition for groff letter/A4 -PAGE=letter - -#--- set default timezone. -TIMEZONE=${TZ:-GMT} - -#--- install the optional vim-lang package n(no)/y(yes) -VIMLANG=y - -#--- Language information in /etc/profile See for values -LANG=$LANG -LC_ALL=$LC_ALL # (not used in LFS) - -#--- Include the keymap in the kernel if defined. Path to the -# keymap file relative to /usr/share/kbd/keymaps/ -# (e.g., i386/qwerty/us.map.gz) or "none" -# Not used in LFS -KEYMAP=none - -#=== Variables needed by iterative comparison analysis === -#--- Should some iterative comparison analysis by made? n(no)/y(yes) -COMPARE=n - -#--- The number of final stage builds to create and compare, min. 2, max. 5 -ITERATIONS=3 - -#--- Run ICA testing n(no)/y(yes) -RUN_ICA=n - -#--- Run farce testing n(no)/y(yes) -RUN_FARCE=n - -#==== INTERNAL VARIABLES ==== -# Don't edit it unless you know what you are doing - -#--- Working directories -SCRIPT_ROOT=jhalfs - JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT - LOGDIR=$JHALFSDIR/logs - TESTLOGDIR=$JHALFSDIR/test-logs - -#--- File listing package contents (from where package sources dir is extracted) -PKG_LST=unpacked - -#--- ICA report log directory -ICALOGDIR=$LOGDIR/ICA - -#--- farce report log directory -FARCELOGDIR=$LOGDIR/farce diff --git a/common/func_validate_configs.sh b/common/func_validate_configs.sh index 81fd0e4..1557210 100644 --- a/common/func_validate_configs.sh +++ b/common/func_validate_configs.sh @@ -2,74 +2,6 @@ declare -r dotSTR=".................." -#----------------------------# -validate_target() { # -#----------------------------# - local -r ERROR_MSG_pt1='The variable \"${L_arrow}TARGET${R_arrow}\" value ${L_arrow}${BOLD}${TARGET}${R_arrow} is invalid for the ${L_arrow}${BOLD}${ARCH}${R_arrow} architecture' - local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \${OFF}' - - local -r PARAM_VALS='TARGET${dotSTR:6} ${L_arrow}${BOLD}${TARGET}${OFF}${R_arrow}' - local -r PARAM_VALS2='TARGET32${dotSTR:8} ${L_arrow}${BOLD}${TARGET32}${OFF}${R_arrow}' - - 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 - } - - if [[ ! "${TARGET32}" = "" ]]; then - echo -e "`eval echo $PARAM_VALS2`" - fi - echo -e "`eval echo $PARAM_VALS`" - - case "${ARCH}" in - "x86") [[ "${TARGET}" = "i486-pc-linux-gnu" ]] && return - [[ "${TARGET}" = "i586-pc-linux-gnu" ]] && return - [[ "${TARGET}" = "i686-pc-linux-gnu" ]] && return - ;; - "ppc") [[ "${TARGET}" = "powerpc-unknown-linux-gnu" ]] && return - ;; - "mips") [[ "${TARGET}" = "mipsel-unknown-linux-gnu" ]] && return - [[ "${TARGET}" = "mips-unknown-linux-gnu" ]] && return - ;; - "sparc") [[ "${TARGET}" = "sparcv9-unknown-linux-gnu" ]] && return - ;; - "x86_64-64") [[ "${TARGET}" = "x86_64-unknown-linux-gnu" ]] && return - ;; - "mips64-64") [[ "${TARGET}" = "mips64el-unknown-linux-gnu" ]] && return - [[ "${TARGET}" = "mips64-unknown-linux-gnu" ]] && return - ;; - "sparc64-64") [[ "${TARGET}" = "sparc64-unknown-linux-gnu" ]] && return - ;; - "alpha") [[ "${TARGET}" = "alpha-unknown-linux-gnu" ]] && return - ;; - "x86_64") [[ "${TARGET}" = "x86_64-unknown-linux-gnu" ]] && - [[ "${TARGET32}" = "i686-pc-linux-gnu" ]] && return - ;; - "mips64") [[ "${TARGET}" = "mips64el-unknown-linux-gnu" ]] && - [[ "${TARGET32}" = "mipsel-unknown-linux-gnu" ]] && return - - [[ "${TARGET}" = "mips64-unknown-linux-gnu" ]] && - [[ "${TARGET32}" = "mips-unknown-linux-gnu" ]] && return - ;; - "sparc64") [[ "${TARGET}" = "sparc64-unknown-linux-gnu" ]] && - [[ "${TARGET32}" = "sparc-unknown-linux-gnu" ]] && return - ;; - "ppc64") [[ "${TARGET}" = "powerpc64-unknown-linux-gnu" ]] && - [[ "${TARGET32}" = "powerpc-unknown-linux-gnu" ]] && return - ;; - "arm") [[ "${TARGET}" = "arm-unknown-linux-gnu" ]] && return - ;; - *) write_error_and_die - ;; - esac - - # If you end up here then there was an error SO... - write_error_and_die -} - #----------------------------# validate_config() { # Are the config values sane (within reason) @@ -88,10 +20,10 @@ validate_config() { # Are the config values sane (within reason) 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 KEYMAP PAGE TIMEZONE LANG LC_ALL LUSER LGROUP" - local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP" - 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 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 KEYMAP PAGE TIMEZONE LANG LC_ALL LUSER LGROUP" + 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 KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP" + 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 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,' @@ -111,16 +43,6 @@ inline_doc exit 1 } - validate_against_str() { - # This is the 'regexp' test available in bash-3.0.. - # using it as a poor man's test for substring - echo -e "`eval echo $PARAM_VALS`" - if [[ ! "$1" =~ "x${!config_param}x" ]] ; then - # parameter value entered is no good - write_error_and_die - fi - } - validate_file() { # For parameters ending with a '+' failure causes a warning message only echo -n "`eval echo $PARAM_VALS`" @@ -172,17 +94,41 @@ inline_doc set +e PARAM_GROUP=${PROGNAME}_PARAM_LIST for config_param in ${!PARAM_GROUP}; do - # This is a tricky little piece of code.. executes a cmd string. case $config_param in - TIMEZONE) echo -e "`eval echo $PARAM_VALS`" ;; + # Allways display this, if found in ${PROGNAME}_PARAM_LIST + GETPKG | \ + RUNMAKE | \ + TEST | \ + OPTIMIZE | \ + STRIP | \ + VIMLANG | \ + MODEL | \ + METHOD | \ + ARCH | \ + TARGET | \ + GRSECURITY_HOST | \ + TIMEZONE | \ + PAGE) echo -e "`eval echo $PARAM_VALS`" ;; - # Validate general parameters.. - GETPKG) validate_against_str "xnx xyx" ;; + # Envvars that depend on other settings to be displayed GETKERNEL ) if [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] ; then - [[ "$GETPKG" = "y" ]] && validate_against_str "xnx xyx" + [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" fi ;; - RUNMAKE) validate_against_str "xnx xyx" ;; - REPORT) validate_against_str "xnx xyx" + 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 @@ -193,63 +139,30 @@ inline_doc continue fi fi ;; - COMPARE) if [[ ! "$COMPARE" = "y" ]]; then - validate_against_str "xnx xyx" - else - if [[ ! "${RUN_ICA}" = "y" ]] && [[ ! "${RUN_FARCE}" = "y" ]]; then - echo "${nl_}${DD_BORDER}" - echo "You have elected to analyse your build but have failed to select a tool." >&2 - echo "Edit /common/config and set ${L_arrow}${BOLD}RUN_ICA${R_arrow} and/or ${L_arrow}${BOLD}RUN_FARCE${R_arrow} to the required values" >&2 - echo "${DD_BORDER}${nl_}" - exit 1 - fi - fi ;; - RUN_ICA) [[ "$COMPARE" = "y" ]] && validate_against_str "xnx xyx" ;; - RUN_FARCE) [[ "$COMPARE" = "y" ]] && validate_against_str "xnx xyx" ;; - ITERATIONS) [[ "$COMPARE" = "y" ]] && validate_against_str "x2x x3x x4x x5x" ;; - TEST) validate_against_str "x0x x1x x2x x3x" ;; - BOMB_TEST) [[ ! "$TEST" = "0" ]] && validate_against_str "xnx xyx" ;; - OPTIMIZE) validate_against_str "x0x x1x x2x" ;; - STRIP) validate_against_str "xnx xyx" ;; - VIMLANG) validate_against_str "xnx xyx" ;; - MODEL) validate_against_str "xglibcx xuclibcx" ;; - PAGE) validate_against_str "xletterx xA4x" ;; - METHOD) validate_against_str "xchrootx xbootx" ;; - ARCH) validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax xarmx" ;; - TARGET) validate_target ;; - 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 - ;; - GRSECURITY_HOST) validate_against_str "xnx xyx" ;; - # BOOK validation. Very ugly, need be fixed + # BOOK validation. Very ugly, need be fixed BOOK) if [[ "${WC}" = "1" ]] ; then validate_dir -z -d else - validate_against_str "x${PROGNAME}-${LFSVRS}x" + echo -e "`eval echo $PARAM_VALS`" fi ;; - # Validate directories, testable states: - # fatal -z -d -w, - # warning -z+ -w+ + # Validate directories, testable states: + # fatal -z -d -w, + # warning -z+ -w+ SRC_ARCHIVE) [[ "$GETPKG" = "y" ]] && validate_dir -z+ -d -w+ ;; - BUILDDIR) # The build directory/partition MUST exist and be writable by the user - validate_dir -z -d -w - [[ "xx x/x" =~ "x${!config_param}x" ]] && - write_error_and_die - ;; + # 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+ + # 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 + # Treatment of 'special' parameters LANG | \ LC_ALL) # See it the locale values exist on this machine echo -n "`eval echo $PARAM_VALS`" @@ -266,7 +179,7 @@ inline_doc KEYMAP=${save_param} ;; - # BLFS params. No validation is required/allowed, IMHO + # BLFS params. BRANCH_ID | BLFS_ROOT | BLFS_XML ) echo "`eval echo $PARAM_VALS`" ;; TRACKING_DIR ) validate_dir -z -d -w ;; diff --git a/hlfs b/hlfs deleted file mode 120000 index fba0373..0000000 --- a/hlfs +++ /dev/null @@ -1 +0,0 @@ -master.sh \ No newline at end of file diff --git a/jhalfs b/jhalfs new file mode 100755 index 0000000..d0488f6 --- /dev/null +++ b/jhalfs @@ -0,0 +1,294 @@ +#!/bin/bash +# $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 >>>>>>>>>>>>>>>>>>>> +#-----------------------# +simple_error() { # Basic error trap.... JUST DIE +#-----------------------# + # If +e then disable text output + if [[ "$-" =~ "e" ]]; then + echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2 + fi +} + +see_ya() { + echo -e "\n${L_arrow}${BOLD}jhalfs-X${R_arrow} exit${OFF}\n" +} +##### Simple error TRAPS +# ctrl-c SIGINT +# ctrl-y +# ctrl-z SIGTSTP +# SIGHUP 1 HANGUP +# SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C +# SIGQUIT 3 +# SIGKILL 9 KILL +# SIGTERM 15 TERMINATION +# SIGSTOP 17,18,23 STOP THE PROCESS +##### +set -e +trap see_ya 0 +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} +" + +case $1 in + -v ) echo "$version" && exit 1 ;; + run ) : ;; + * ) + echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}" + exit 1 + ;; +esac + +VERBOSITY=1 + +[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from ..." +source configuration +[[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1 +[[ $VERBOSITY > 0 ]] && echo "OK" + + #--- Envars not sourced from configuration (yet) +declare -r SVN="svn://svn.linuxfromscratch.org" +declare -r LOG=000-masterscript.log + +case $PROGNAME in + clfs2) LFSVRS=development; TREE=branches/clfs-2.0/BOOK ;; + *) LFSVRS=development; TREE=trunk/BOOK ;; +esac + +if [[ ! -z ${BRANCH_ID} ]]; then + case $BRANCH_ID in + dev* | SVN | trunk ) + case $PROGNAME in + clfs2 ) TREE=branches/clfs-2.0/BOOK ;; + *) TREE=trunk/BOOK ;; + esac + LFSVRS=development + ;; + branch-* ) + LFSVRS=${BRANCH_ID} + TREE=branches/${BRANCH_ID#branch-}/BOOK + ;; + * ) + case $PROGNAME in + lfs | hlfs ) + LFSVRS=${BRANCH_ID} + TREE=tags/${BRANCH_ID}/BOOK + ;; + clfs | clfs2 ) + LFSVRS=${BRANCH_ID} + TREE=tags/${BRANCH_ID} + ;; + esac + ;; + esac +fi + +# These are boolean vars generated from Config.in. +# ISSUE: If a boolean parameter is not set that +# variable is not defined by the menu app. This can +# cause a headache if you are not careful. +# The following parameters MUST be created and have a +# default value. +RUNMAKE=${RUNMAKE:-n} +GETPKG=${GETPKG:-n} +GETKERNEL=${GETKERNEL:-n} +COMPARE=${COMPARE:-n} +RUN_FARCE=${RUN_FARCE:-n} +RUN_ICA=${RUN_ICA:-n} +BOMB_TEST=${BOMB_TEST:-n} +STRIP=${STRIP:=n} +REPORT=${REPORT:=n} +VIMLANG=${VIMLANG:-n} +KEYMAP=${KEYMAP:=none} +GRSECURITY_HOST=${GRSECURITY_HOST:-n} + +# Set the document location... +BOOK=${BOOK:=$PROGNAME-$LFSVRS} + +# Set true internal variables +COMMON_DIR="common" +PACKAGE_DIR=$(echo $PROGNAME | tr [a-z] [A-Z]) +MODULE=$PACKAGE_DIR/master.sh + + +[[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..." +source $COMMON_DIR/common-functions +[[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit +[[ $VERBOSITY > 0 ]] && echo "OK" +[[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..." +source $MODULE +[[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2 +[[ $VERBOSITY > 0 ]] && echo "OK" +# +[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" + + +#*******************************************************************# +[[ $VERBOSITY > 0 ]] && echo -n "Loading function ..." +source $COMMON_DIR/func_check_version.sh +[[ $? > 0 ]] && echo " function module did not load.." && exit 2 +[[ $VERBOSITY > 0 ]] && echo "OK" + +[[ $VERBOSITY > 0 ]] && echo -n "Loading function ..." +source $COMMON_DIR/func_validate_configs.sh +[[ $? > 0 ]] && echo " function module did not load.." && exit 2 +[[ $VERBOSITY > 0 ]] && echo "OK" +[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" + + +################################### +### MAIN ### +################################### + +# Check for minimum bash,tar,gcc and kernel versions +echo +check_version "2.6.2" "`uname -r`" "KERNEL" +check_version "3.0" "$BASH_VERSION" "BASH" +check_version "3.0" "`gcc -dumpversion`" "GCC" +tarVer=`tar --version | head -n1 | cut -d " " -f4` +check_version "1.15.0" "${tarVer}" "TAR" +echo "${SD_BORDER}${nl_}" + +validate_config +echo "${SD_BORDER}${nl_}" +echo -n "Are you happy with these settings? yes/no (no): " +read ANSWER +if [ x$ANSWER != "xyes" ] ; then + echo "${nl_}Fix the configuration options and rerun the script.${nl_}" + exit 1 +fi +echo "${nl_}${SD_BORDER}${nl_}" + +# Load additional modules or configuration files based on global settings +# compare module +if [[ "$COMPARE" = "y" ]]; then + [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..." + source $COMMON_DIR/func_compare.sh + [[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit + [[ $VERBOSITY > 0 ]] && echo "OK" +fi +# +# optimize module +if [[ "$OPTIMIZE" != "0" ]]; then + [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..." + source optimize/optimize_functions + [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit + [[ $VERBOSITY > 0 ]] && echo "OK" + # + # optimize configurations + [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..." + source optimize/opt_config + [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit + [[ $VERBOSITY > 0 ]] && echo "OK" + # Validate optimize settings, if required + validate_opt_settings +fi +# + +# If $BUILDDIR has subdirectories like tools/ or bin/, stop the run +# and notify the user about that. +if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then + eval "$no_empty_builddir" +fi + +# If requested, clean the build directory +clean_builddir + +if [[ ! -d $JHALFSDIR ]]; then + mkdir -p $JHALFSDIR +fi +# +# Create $BUILDDIR/sources even though it could be created by get_sources() +if [[ ! -d $BUILDDIR/sources ]]; then + mkdir -p $BUILDDIR/sources +fi +# +# Create the log directory +if [[ ! -d $LOGDIR ]]; then + mkdir $LOGDIR +fi +>$LOGDIR/$LOG +# +[[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR +# +cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/ +# +[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/ +# +if [[ "$COMPARE" = "y" ]]; then + mkdir -p $JHALFSDIR/extras + cp extras/* $JHALFSDIR/extras +fi +# +if [[ -n "$FILES" ]]; then + # pushd/popd necessary to deal with multiple files + pushd $PACKAGE_DIR 1> /dev/null + cp $FILES $JHALFSDIR/ + popd 1> /dev/null +fi +# +if [[ "$REPORT" = "y" ]]; then + cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/ + # After being sure that all looks sane, dump the settings to a file + # This file will be used to create the REPORT header + validate_config > $JHALFSDIR/jhalfs.config +fi +# +[[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ +# +cp $COMMON_DIR/packages.xsl $JHALFSDIR/ +# +sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} +export XSL=$JHALFSDIR/${XSL} + +get_book +echo "${SD_BORDER}${nl_}" + +build_Makefile +echo "${SD_BORDER}${nl_}" + +run_make diff --git a/lfs b/lfs deleted file mode 120000 index fba0373..0000000 --- a/lfs +++ /dev/null @@ -1 +0,0 @@ -master.sh \ No newline at end of file diff --git a/master.sh b/master.sh deleted file mode 100755 index 9bce411..0000000 --- a/master.sh +++ /dev/null @@ -1,552 +0,0 @@ -#!/bin/bash -# $Id$ -set -e - - -#>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>> -#-----------------------# -simple_error() { # Basic error trap.... JUST DIE -#-----------------------# - # If +e then disable text output - if [[ "$-" =~ "e" ]]; then - echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2 - fi -} - -see_ya() { - echo -e "\n${L_arrow}${BOLD}jhalfs${R_arrow} exit${OFF}\n" -} -##### Simple error TRAPS -# ctrl-c SIGINT -# ctrl-y -# ctrl-z SIGTSTP -# SIGHUP 1 HANGUP -# SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C -# SIGQUIT 3 -# SIGKILL 9 KILL -# SIGTERM 15 TERMINATION -# SIGSTOP 17,18,23 STOP THE PROCESS -##### -set -e -trap see_ya 0 -trap simple_error ERR -trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23 -#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - - -if [ ! -L $0 ] ; then - echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}" - exit 1 -fi - - PROGNAME=$(basename $0) - COMMON_DIR="common" - PACKAGE_DIR=$(echo $PROGNAME | tr [a-z] [A-Z]) - MODULE=$PACKAGE_DIR/master.sh -MODULE_CONFIG=$PACKAGE_DIR/config - VERBOSITY=0 - - -if [[ -e using_menuconfig ]]; then - [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from ..." - source configuration - [[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1 - [[ $VERBOSITY > 0 ]] && echo "OK" - - #--- CONSTANTS - declare -r SVN="svn://svn.linuxfromscratch.org" - declare -r LOG=000-masterscript.log - # --- Server used if the file isn't found in SRC_ARCHIVE. - # As a last resort, the file will dowloaded from upstream, if possible. - SERVER=ftp://ftp.lfs-matrix.net - #--- Working directories - SCRIPT_ROOT=jhalfs - JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT - LOGDIR=$JHALFSDIR/logs - TESTLOGDIR=$JHALFSDIR/test-logs - MKFILE=$JHALFSDIR/Makefile - #--- ICA report log directory - ICALOGDIR=$LOGDIR/ICA - #--- farce report log directory - FARCELOGDIR=$LOGDIR/farce - XSL=$PROGNAME.xsl - PKG_LST=unpacked - - case $PROGNAME in - clfs2) LFSVRS=development; TREE=branches/clfs-2.0/BOOK ;; - *) LFSVRS=development; TREE=trunk/BOOK ;; - esac - - if [[ ! -z ${BRANCH_ID} ]]; then - case $BRANCH_ID in - dev* | SVN | trunk ) - case $PROGNAME in - clfs2 ) TREE=branches/clfs-2.0/BOOK ;; - *) TREE=trunk/BOOK ;; - esac - LFSVRS=development - ;; - branch-* ) - LFSVRS=${BRANCH_ID} - TREE=branches/${BRANCH_ID#branch-}/BOOK - ;; - * ) - case $PROGNAME in - lfs | hlfs ) - LFSVRS=${BRANCH_ID} - TREE=tags/${BRANCH_ID}/BOOK - ;; - clfs | clfs2 ) - LFSVRS=${BRANCH_ID} - TREE=tags/${BRANCH_ID} - ;; - esac - ;; - esac - fi - # These are boolean vars generated from Config.in. - # ISSUE: If a boolean parameter is not set that - # variable is not defined by the menu app. This can - # cause a headache if you are not careful. - # The following parameters MUST be created and have a - # default value. - RUNMAKE=${RUNMAKE:-n} - GETPKG=${GETPKG:-n} - GETKERNEL=${GETKERNEL:-n} - COMPARE=${COMPARE:-n} - RUN_FARCE=${RUN_FARCE:-n} - RUN_ICA=${RUN_ICA:-n} - BOMB_TEST=${BOMB_TEST:-n} - STRIP=${STRIP:=n} - REPORT=${REPORT:=n} - VIMLANG=${VIMLANG:-n} - KEYMAP=${KEYMAP:=none} - GRSECURITY_HOST=${GRSECURITY_HOST:-n} - -else - # - [[ $VERBOSITY > 0 ]] && echo -n "Loading masterscript conf..." - source $COMMON_DIR/config - [[ $? > 0 ]] && echo "$COMMON_DIR/conf did not load.." && exit - [[ $VERBOSITY > 0 ]] && echo "OK" - # - [[ $VERBOSITY > 0 ]] && echo -n "Loading config module <$MODULE_CONFIG>..." - source $MODULE_CONFIG - [[ $? > 0 ]] && echo "$MODULE_CONFIG did not load.." && exit 1 - [[ $VERBOSITY > 0 ]] && echo "OK" - # -fi - - -[[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..." -source $COMMON_DIR/common-functions -[[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit -[[ $VERBOSITY > 0 ]] && echo "OK" -[[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..." -source $MODULE -[[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2 -[[ $VERBOSITY > 0 ]] && echo "OK" -# -[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" - - -#=========================================================== -# If the var BOOK contains something then, maybe, it points -# to a working doc.. set WC=1, else 'null' -#=========================================================== -WC=${BOOK:+1} -#=========================================================== - - -#*******************************************************************# -[[ $VERBOSITY > 0 ]] && echo -n "Loading function ..." -source $COMMON_DIR/func_check_version.sh -[[ $? > 0 ]] && echo " function module did not load.." && exit 2 -[[ $VERBOSITY > 0 ]] && echo "OK" - -[[ $VERBOSITY > 0 ]] && echo -n "Loading function ..." -source $COMMON_DIR/func_validate_configs.sh -[[ $? > 0 ]] && echo " function module did not load.." && exit 2 -[[ $VERBOSITY > 0 ]] && echo "OK" -[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" - - -################################### -### MAIN ### -################################### - -# Evaluate any command line switches - -while test $# -gt 0 ; do - case $1 in - # Common options for {C,H}LFS books - --book | -B ) - test $# = 1 && eval "$exit_missing_arg" - shift - case $1 in - dev* | SVN | trunk ) - LFSVRS=development - TREE=trunk/BOOK - ;; - branch-* ) - LFSVRS=$1 - TREE=branches/${1#branch-}/BOOK - ;; - * ) - case $PROGNAME in - lfs | hlfs ) - LFSVRS=$1 - TREE=tags/$1/BOOK - ;; - clfs ) - LFSVRS=$1 - TREE=tags/$1 - ;; - esac - ;; - esac - ;; - - --directory | -D ) - test $# = 1 && eval "$exit_missing_arg" - shift - case $1 in - -* ) - echo -e "\n$1 isn't a valid build directory." - echo -e "Directory names can't start with - .\n" - exit 1 - ;; - * ) - BUILDDIR=$1 - JHALFSDIR=$BUILDDIR/${SCRIPT_ROOT} - LOGDIR=$JHALFSDIR/logs - TESTLOGDIR=$JHALFSDIR/test-logs - MKFILE=$JHALFSDIR/Makefile - ;; - esac - ;; - - --get-packages | -G ) GETPKG=y ;; - - --help | -h ) usage | more && exit ;; - - --optimize | -O ) - test $# = 1 && eval "$exit_missing_arg" - shift - case $1 in - 0 | 1 | 2 ) - OPTIMIZE=$1 - ;; - * ) - echo -e "\n$1 isn't a valid optimize level value." - echo -e "You must use 0, 1, or 2.\n" - exit 1 - ;; - esac - ;; - - --testsuites | -T ) - test $# = 1 && eval "$exit_missing_arg" - shift - case $1 in - 0 | 1 | 2 | 3 ) - TEST=$1 - ;; - * ) - echo -e "\n$1 isn't a valid testsuites level value." - echo -e "You must to use 0, 1, 2, or 3.\n" - exit 1 - ;; - esac - ;; - - --version | -V ) - echo "$version" - exit 0 - ;; - - --working-copy | -W ) - test $# = 1 && eval "$exit_missing_arg" - shift - case $PROGNAME in # Poor checks. We should find better ones. - lfs) - if [ -d $1/chapter09 ] ; then - WC=1 - BOOK=$1 - else - echo -e "\nLooks like $1 isn't an LFS working copy." - exit 1 - fi - ;; - clfs) - if [ -d $1/cross-tools ] ; then - WC=1 - BOOK=$1 - else - echo -e "\nLooks like $1 isn't a CLFS working copy." - exit 1 - fi - ;; - hlfs) - if [ -f $1/template.xml ] ; then - WC=1 - BOOK=$1 - else - echo -e "\nLooks like $1 isn't an HLFS working copy." - exit 1 - fi - ;; - esac - ;; - - --comparison | -C ) - test $# = 1 && eval "$exit_missing_arg" - shift - case $1 in - ICA) RUN_ICA=y; RUN_FARCE=n; COMPARE=y ;; - farce) RUN_ICA=n; RUN_FARCE=y; COMPARE=y ;; - both) RUN_ICA=y; RUN_FARCE=y; COMPARE=y ;; - *) - echo -e "\n$1 is an unknown analysis method." - exit 1 - ;; - esac - ;; - - --fstab | -F ) - test $# = 1 && eval "$exit_missing_arg" - shift - if [ -f $1 ] ; then - FSTAB=$1 - else - echo -e "\nFile $1 not found. Verify your command line.\n" - exit 1 - fi - ;; - - --kernel-config | -K ) - test $# = 1 && eval "$exit_missing_arg" - shift - if [ -f $1 ] ; then - CONFIG=$1 - else - echo -e "\nFile $1 not found. Verify your command line.\n" - exit 1 - fi - ;; - - --run-make | -M ) RUNMAKE=y ;; - - --rebuild | -R ) CLEAN=y ;; - - # CLFS options - --arch | -A ) - test $# = 1 && eval "$exit_missing_arg" - shift - case $PROGNAME in - CLFS2) - case $1 in - arm) ARCH=arm; TARGET="arm-unknown-linux-gnu" ;; - x86) ARCH=x86; TARGET="i686-pc-linux-gnu" ;; - *) echo -e "\n$1 is an unknown or unsupported arch."; exit 1 - esac - ;; - CLFS) - case $1 in - arm ) ARCH=arm; TARGET="arm-unknown-linux-gnu" ;; - x86 ) ARCH=x86; TARGET="i686-pc-linux-gnu" ;; - i486 ) ARCH=x86; TARGET="i486-pc-linux-gnu" ;; - i586 ) ARCH=x86; TARGET="i586-pc-linux-gnu" ;; - ppc ) ARCH=ppc; TARGET="powerpc-unknown-linux-gnu" ;; - mips ) ARCH=mips; TARGET="mips-unknown-linux-gnu" ;; - mipsel ) ARCH=mips; TARGET="mipsel-unknown-linux-gnu" ;; - sparc ) ARCH=sparc; TARGET="sparcv9-unknown-linux-gnu" ;; - - x86_64-64 ) ARCH=x86_64-64; TARGET="x86_64-unknown-linux-gnu" ;; - mips64-64 ) ARCH=mips64-64; TARGET="mips-unknown-linux-gnu" ;; - mipsel64-64 ) ARCH=mips64-64; TARGET="mipsel-unknown-linux-gnu" ;; - sparc64-64 ) ARCH=sparc64-64; TARGET="sparc64-unknown-linux-gnu" ;; - alpha ) ARCH=alpha; TARGET="alpha-unknown-linux-gnu" ;; - - x86_64 ) ARCH=x86_64; TARGET="x86_64-unknown-linux-gnu"; TARGET32="i686-pc-linux-gnu" ;; - mips64 ) ARCH=mips64; TARGET="mips-unknown-linux-gnu"; TARGET32="mips-unknown-linux-gnu" ;; - mipsel64 ) ARCH=mips64; TARGET="mipsel-unknown-linux-gnu"; TARGET32="mipsel-unknown-linux-gnu" ;; - sparc64 ) ARCH=sparc64; TARGET="sparc64-unknown-linux-gnu"; TARGET32="sparcv9-unknown-linux-gnu" ;; - ppc64 ) ARCH=ppc64; TARGET="powerpc64-unknown-linux-gnu"; TARGET32="powerpc-unknown-linux-gnu" ;; - - * ) echo -e "\n$1 is an unknown or unsupported arch."; exit 1 ;; - esac - ;; - esac - ;; - - --boot-config ) - test $# = 1 && eval "$exit_missing_arg" - shift - if [ -f $1 ] ; then - BOOT_CONFIG=$1 - else - echo -e "\nFile $1 not found. Verify your command line.\n" - exit 1 - fi - ;; - - --method ) - test $# = 1 && eval "$exit_missing_arg" - shift - case $1 in - chroot | boot ) - METHOD=$1 - ;; - * ) - echo -e "\n$1 isn't a valid build method." - exit 1 - ;; - esac - ;; - - # HLFS options - --model ) - test $# = 1 && eval "$exit_missing_arg" - shift - case $1 in - glibc | uclibc ) - MODEL=$1 - ;; - * ) - echo -e "\n$1 isn't a valid libc model." - exit 1 - ;; - esac - ;; - - # Unknown options - * ) usage ;; - esac - shift -done - - -#=================================================== -# Set the document location... -# BOOK is either defined in -# xxx.config -# comand line -# default -# If set by conf file or cmd line leave it -# alone otherwise load the default version -#=================================================== -BOOK=${BOOK:=$PROGNAME-$LFSVRS} -#=================================================== - - -# Check for minimum bash,tar,gcc and kernel versions -echo -check_version "2.6.2" "`uname -r`" "KERNEL" -check_version "3.0" "$BASH_VERSION" "BASH" -check_version "3.0" "`gcc -dumpversion`" "GCC" -tarVer=`tar --version | head -n1 | cut -d " " -f4` -check_version "1.15.0" "${tarVer}" "TAR" -echo "${SD_BORDER}${nl_}" - -validate_config -echo "${SD_BORDER}${nl_}" -echo -n "Are you happy with these settings? yes/no (no): " -read ANSWER -if [ x$ANSWER != "xyes" ] ; then - echo "${nl_}Fix the configuration options and rerun the script.${nl_}" - exit 1 -fi -echo "${nl_}${SD_BORDER}${nl_}" - -# Load additional modules or configuration files based on global settings -# compare module -if [[ "$COMPARE" = "y" ]]; then - [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..." - source $COMMON_DIR/func_compare.sh - [[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit - [[ $VERBOSITY > 0 ]] && echo "OK" -fi -# -# optimize module -if [[ "$OPTIMIZE" != "0" ]]; then - [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..." - source optimize/optimize_functions - [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit - [[ $VERBOSITY > 0 ]] && echo "OK" - # - # optimize configurations - [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..." - source optimize/opt_config - [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit - [[ $VERBOSITY > 0 ]] && echo "OK" - # Validate optimize settings, if required - validate_opt_settings -fi -# - -# If $BUILDDIR has subdirectories like tools/ or bin/, stop the run -# and notify the user about that. -if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then - eval "$no_empty_builddir" -fi - -# If requested, clean the build directory -clean_builddir - -if [[ ! -d $JHALFSDIR ]]; then - mkdir -p $JHALFSDIR -fi -# -# Create $BUILDDIR/sources even though it could be created by get_sources() -if [[ ! -d $BUILDDIR/sources ]]; then - mkdir -p $BUILDDIR/sources -fi -# -# Create the log directory -if [[ ! -d $LOGDIR ]]; then - mkdir $LOGDIR -fi ->$LOGDIR/$LOG -# -[[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR -# -if [[ "$PWD" != "$JHALFSDIR" ]]; then - cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/ - # - [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/ - # - if [[ "$COMPARE" = "y" ]]; then - mkdir -p $JHALFSDIR/extras - cp extras/* $JHALFSDIR/extras - fi - # - if [[ -n "$FILES" ]]; then - # pushd/popd necessary to deal with multiple files - pushd $PACKAGE_DIR 1> /dev/null - cp $FILES $JHALFSDIR/ - popd 1> /dev/null - fi - # - if [[ "$REPORT" = "y" ]]; then - cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/ - # After being sure that all looks sane, dump the settings to a file - # This file will be used to create the REPORT header - validate_config > $JHALFSDIR/jhalfs.config - fi - # - [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ - # - cp $COMMON_DIR/packages.xsl $JHALFSDIR/ - # - sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} - export XSL=$JHALFSDIR/${XSL} -fi - -get_book -echo "${SD_BORDER}${nl_}" - -build_Makefile -echo "${SD_BORDER}${nl_}" - -run_make