Adjusting scripts to new structure. Added jhalfs trunk changes. Will now create a lfs makefile.

This commit is contained in:
George Boudreau 2006-03-10 01:44:55 +00:00
parent 6db1464904
commit 12a5707998
10 changed files with 101 additions and 235 deletions

View file

@ -5,6 +5,7 @@
# $Id$ # $Id$
# #
##### #####
declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/blfs/conglomeration
#--- Book's sources directory #--- Book's sources directory
# If you have previously checked out the book from the repository # If you have previously checked out the book from the repository
@ -27,6 +28,6 @@ TEST=0
# Don't edit it unless you know what you are doing # Don't edit it unless you know what you are doing
#--- Default stylesheet #--- Default stylesheet
XSL=dump-blfs-scripts.xsl XSL=blfs.xsl
MKFILE=$JHALFSDIR/blfs-Makefile MKFILE=$JHALFSDIR/blfs-Makefile

View file

@ -2,9 +2,10 @@
# #
# Configuration file for the CLFS module # Configuration file for the CLFS module
# #
# $Id$
#
##### #####
declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/lfs/conglomeration
declare -r HTTP=http://ftp.lfs-matrix.net/pub/clfs/conglomeration
#--- Which target architecture, #--- Which target architecture,
# used to select proper book and set TARGETS # used to select proper book and set TARGETS
@ -12,7 +13,7 @@ declare -r HTTP=http://ftp.lfs-matrix.net/pub/clfs/conglomeration
TARGET32="" TARGET32=""
TARGET= TARGET=
# >>>> 32-32 BUILD <<<< # >>>> 32-32 BUILD <<<<
# ARCH=x86 ; TARGET="i486-pc-linux-gnu" ARCH=x86 ; TARGET="i486-pc-linux-gnu"
# ARCH=x86 ; TARGET="i586-pc-linux-gnu" # ARCH=x86 ; TARGET="i586-pc-linux-gnu"
# ARCH=x86 ; TARGET="i686-pc-linux-gnu" # ARCH=x86 ; TARGET="i686-pc-linux-gnu"
# ARCH=ppc ; TARGET="powerpc-unknown-linux-gnu" # ARCH=ppc ; TARGET="powerpc-unknown-linux-gnu"
@ -22,7 +23,7 @@ TARGET=
# ARCH=sparcv8 ; TARGET="sparc-unknown-linux-gnu" # ARCH=sparcv8 ; TARGET="sparc-unknown-linux-gnu"
#-------------------------------- #--------------------------------
# >>>> 64-64 BUILD <<<< # >>>> 64-64 BUILD <<<<
ARCH=x86_64-64 ; TARGET="x86_64-unknown-linux-gnu" # ARCH=x86_64-64 ; TARGET="x86_64-unknown-linux-gnu"
# ARCH=mips64-64 ; TARGET="mipsel-unknown-linux-gnu" # ARCH=mips64-64 ; TARGET="mipsel-unknown-linux-gnu"
# ARCH=mips64-64 ; TARGET="mis-unknown-linux-gnu" # ARCH=mips64-64 ; TARGET="mis-unknown-linux-gnu"
# ARCH=sparc64-64 ; TARGET="sparc64-unknown-linux-gnu" # ARCH=sparc64-64 ; TARGET="sparc64-unknown-linux-gnu"
@ -39,11 +40,11 @@ TARGET=
BOOTMINIMAL=1 BOOTMINIMAL=1
#--- Location of fstab file (if empty, a template is created) #--- Location of fstab file (if empty, a template is created)
FSTAB=$BUILDDIR/sources/fstab FSTAB=
#--- Location of kernel config file (if the kernel is to be compiled) #--- Location of kernel config file (if the kernel is to be compiled)
#--- This file MUST reside in the sources directory #--- This file MUST reside in the sources directory
CONFIG=$BUILDDIR/sources/linux-2.6.15.1-x86_64.config CONFIG=
#--- Book's sources directory #--- Book's sources directory
# If you have previously checked out the book from the repository # If you have previously checked out the book from the repository
@ -56,7 +57,7 @@ BOOK=
FILES="" FILES=""
#--- Default stylesheet #--- Default stylesheet
XSL=dump-clfs-scripts.xsl XSL=clfs.xsl
#--- Book version #--- Book version
LFSVRS=development LFSVRS=development

View file

@ -2,8 +2,10 @@
# #
# Configuration file for the HLFS module # Configuration file for the HLFS module
# #
# $Id$
#
##### #####
declare -r HTTP=http://ftp.lfs-matrix.net/pub/hlfs/conglomeration declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/lfs/conglomeration
#--- Which library model to use uclibc/glibc #--- Which library model to use uclibc/glibc
MODEL=glibc MODEL=glibc
@ -12,10 +14,10 @@ MODEL=glibc
GRSECURITY_HOST=0 GRSECURITY_HOST=0
#--- Location of fstab file (if empty, a template is created) #--- Location of fstab file (if empty, a template is created)
FSTAB=$BUILDDIR/sources/fstab FSTAB=
#--- Location of kernel config file (if the kernel is to be compiled) #--- Location of kernel config file (if the kernel is to be compiled)
CONFIG=$BUILDDIR/sources/linux-2.6.14.6-HLFS.config CONFIG=
#--- Book's sources directory #--- Book's sources directory
# If you have previously checked out the book from the repository # If you have previously checked out the book from the repository
@ -25,10 +27,10 @@ BOOK=
# Don't edit it unless you know what you are doing # Don't edit it unless you know what you are doing
#--- Files that will be copied to $JHAHLFSDIR #--- Files that will be copied to $JHAHLFSDIR
FILES="dump-hlfs-scripts.xsl hlfs-patcheslist_.xsl" FILES="hlfs-patcheslist_.xsl"
#--- Default stylesheet #--- Default stylesheet
XSL=dump-hlfs-scripts.xsl XSL=hlfs.xsl
#--- Book version #--- Book version
LFSVRS=development LFSVRS=development

View file

@ -5,13 +5,13 @@
# $Id$ # $Id$
# #
##### #####
declare -r HTTP=http://ftp.lfs-matrix.net/pub/lfs/conglomeration declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/lfs/conglomeration
#--- Location of fstab file (if empty, a template is created) #--- Location of fstab file (if empty, a template is created)
FSTAB=$BUILDDIR/sources/fstab FSTAB=
#--- Location of kernel config file (if the kernel is to be compiled) #--- Location of kernel config file (if the kernel is to be compiled)
CONFIG=$PWD/config_files/linux-2.6.15.1-LFS.config CONFIG=
#--- Book's sources directory #--- Book's sources directory
# If you have previously checked out the book from the repository # If you have previously checked out the book from the repository
@ -24,7 +24,7 @@ BOOK=
FILES="" FILES=""
#--- Default stylesheet #--- Default stylesheet
XSL=dump-lfs-scripts.xsl XSL=lfs.xsl
#--- Book version #--- Book version
LFSVRS=development LFSVRS=development

View file

@ -11,6 +11,7 @@
#----------------------------# #----------------------------#
chapter4_Makefiles() { chapter4_Makefiles() {
#----------------------------# #----------------------------#
echo -e "\n${tab_}${GREEN}Processing... ${L_arrow}Chapter4${R_arrow}"
# If /home/lfs is already present in the host, we asume that the # If /home/lfs is already present in the host, we asume that the
# lfs user and group are also presents in the host, and a backup # lfs user and group are also presents in the host, and a backup
@ -61,12 +62,14 @@ EOF
#----------------------------# #----------------------------#
chapter5_Makefiles() { chapter5_Makefiles() {
#----------------------------# #----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5${R_arrow}"
for file in chapter05/* ; do for file in chapter05/* ; do
# Keep the script file name # Keep the script file name
this_script=`basename $file` this_script=`basename $file`
# If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
if [ "$TOOLCHAINTEST" = "0" ]; then if [ "$TEST" = "0" ]; then
if [[ `_IS_ ${this_script} tcl` ]] || [[ `_IS_ ${this_script} expect` ]] || [[ `_IS_ ${this_script} dejagnu` ]] ; then if [[ `_IS_ ${this_script} tcl` ]] || [[ `_IS_ ${this_script} expect` ]] || [[ `_IS_ ${this_script} dejagnu` ]] ; then
continue continue
fi fi
@ -77,11 +80,6 @@ chapter5_Makefiles() {
continue continue
fi fi
# NOTE Replace with xsl work...
if [[ `_IS_ $this_script adjusting` ]]; then
sed '/cd $PKGDIR/d' -i chapter05/$this_script
fi
# First append each name of the script files to a list (this will become # First append each name of the script files to a list (this will become
# the names of the targets in the Makefile # the names of the targets in the Makefile
chapter5="$chapter5 ${this_script}" chapter5="$chapter5 ${this_script}"
@ -137,6 +135,7 @@ chapter5_Makefiles() {
#----------------------------# #----------------------------#
chapter6_Makefiles() { chapter6_Makefiles() {
#----------------------------# #----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6${R_arrow}"
for file in chapter06/* ; do for file in chapter06/* ; do
# Keep the script file name # Keep the script file name
this_script=`basename $file` this_script=`basename $file`
@ -152,11 +151,6 @@ chapter6_Makefiles() {
continue continue
fi fi
# NOTE Replace with xsl work...
if [[ `_IS_ $this_script adjusting` ]]; then
sed '/cd $PKGDIR/d' -i chapter06/$this_script
fi
# First append each name of the script files to a list (this will become # First append each name of the script files to a list (this will become
# the names of the targets in the Makefile # the names of the targets in the Makefile
chapter6="$chapter6 ${this_script}" chapter6="$chapter6 ${this_script}"
@ -210,6 +204,7 @@ chapter6_Makefiles() {
#----------------------------# #----------------------------#
chapter789_Makefiles() { chapter789_Makefiles() {
#----------------------------# #----------------------------#
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6/7/8${R_arrow}"
for file in chapter0{7,8,9}/* ; do for file in chapter0{7,8,9}/* ; do
# Keep the script file name # Keep the script file name
this_script=`basename $file` this_script=`basename $file`

View file

@ -637,7 +637,6 @@ extract_commands() { #
--xinclude \ --xinclude \
--stringparam model $MODEL \ --stringparam model $MODEL \
--stringparam testsuite $TEST \ --stringparam testsuite $TEST \
--stringparam toolchaintest $TOOLCHAINTEST \
--stringparam vim-lang $VIMLANG \ --stringparam vim-lang $VIMLANG \
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
;; ;;
@ -646,7 +645,6 @@ extract_commands() { #
xsltproc --nonet \ xsltproc --nonet \
--xinclude \ --xinclude \
--stringparam testsuite $TEST \ --stringparam testsuite $TEST \
--stringparam toolchaintest $TOOLCHAINTEST \
--stringparam vim-lang $VIMLANG \ --stringparam vim-lang $VIMLANG \
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
;; ;;
@ -700,9 +698,8 @@ download() { # Download file, write name to MISSING_FILES.DMP if
#----------------------------# #----------------------------#
cd $BUILDDIR/sources cd $BUILDDIR/sources
# Hackish fix for the bash-doc, glibc-{linuxthreads,libidn} and # Hackish fix for the bash-doc, glibc-{linuxthreads,libidn}
# module-init-tools-testsuite packages that don't conform to # that don't conform to norms in the URL scheme.
# norms in the URL scheme.
DIR=`echo $1 | sed 's@-doc@@;s@-linuxthreads@@;s@-libidn@@;s@-testsuite@@'` DIR=`echo $1 | sed 's@-doc@@;s@-linuxthreads@@;s@-libidn@@;s@-testsuite@@'`
# Find the md5 sum for this package. # Find the md5 sum for this package.
@ -720,14 +717,14 @@ download() { # Download file, write name to MISSING_FILES.DMP if
if [ ! -f $2 ] ; then if [ ! -f $2 ] ; then
case $DL in case $DL in
wget ) wget $HTTP/$DIR/$2 ;; wget ) wget --passive $FTP/$DIR/$2 ;;
curl ) `curl -# $HTTP/$DIR/$2 -o $2` ;; curl ) `curl -# $FTP/$DIR/$2 -o $2` ;;
* ) echo "$DL not supported at this time." ;; * ) echo "$DL not supported at this time." ;;
esac esac
elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
case $DL in case $DL in
wget ) wget -c $HTTP/$DIR/$2 ;; wget ) wget --passive -c $FTP/$DIR/$2 ;;
curl ) `curl -# -C - $HTTP/$DIR/$2 -o $2` ;; curl ) `curl -# -C - $FTP/$DIR/$2 -o $2` ;;
* ) echo "$DL not supported at this time." ;; * ) echo "$DL not supported at this time." ;;
esac esac
fi fi
@ -766,7 +763,7 @@ get_sources() {
PKG=`echo $i | sed -e 's/-version.*//' -e 's/-file.*//'` PKG=`echo $i | sed -e 's/-version.*//' -e 's/-file.*//'`
# There are some entities that aren't valid packages. # There are some entities that aren't valid packages.
if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" -o "$PKG" = "groff-patchlevel" ] ; then continue ; fi if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi
VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'` VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
case $PKG in case $PKG in

View file

@ -1,7 +1,8 @@
##### #####
# #
# Masterscript configuration file # common configuration file
# #
# $Id$
##### #####
declare -r SVN="svn://svn.linuxfromscratch.org" declare -r SVN="svn://svn.linuxfromscratch.org"
@ -16,12 +17,13 @@ HPKG=0
#--- Run the makefile at the end 0(no)/1(yes) #--- Run the makefile at the end 0(no)/1(yes)
RUNMAKE=0 RUNMAKE=0
#--- Run test suites 0(no)/1(yes) #--- 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
TEST=1 TEST=1
#--- Run the toolchain tests 0(no)/1(yes)
TOOLCHAINTEST=1
#--- Run the stripping phases 0(no)/1(yes) #--- Run the stripping phases 0(no)/1(yes)
STRIP=1 STRIP=1
@ -41,6 +43,16 @@ LANG=en_CA
#--- Include the keymap in the kernel if defined #--- Include the keymap in the kernel if defined
KEYMAP=/usr/share/kbd/keymaps/i386/qwerty/us.map.gz KEYMAP=/usr/share/kbd/keymaps/i386/qwerty/us.map.gz
#=== Variables needed by ICA ===
#--- Run ICA testing 0/1 0(no)/1(yes)
RUN_ICA=0
#--- The number of final stage builds to create and compare
ITERATIONS=
#--- ICA report log directory
ICALOGDIR=$JHALFSDIR/logs/ICA
#==== INTERNAL VARIABLES ==== #==== INTERNAL VARIABLES ====
# Don't edit it unless you know what you are doing # Don't edit it unless you know what you are doing

View file

@ -27,11 +27,14 @@ inline_doc
tst_version=$2 tst_version=$2
TXT=$3 TXT=$3
if echo $ref_version | grep [[:alpha:]] 2>&1 >/dev/null || # This saves us the save/restore hassle of the system IFS value
echo $tst_version | grep [[:alpha:]] 2>&1 >/dev/null ;then local IFS
echo "Cannot test for text, 0.0.0a, version types, assuming 'success' "
return # if echo $ref_version | grep [[:alpha:]] 2>&1 >/dev/null ||
fi # echo $tst_version | grep [[:alpha:]] 2>&1 >/dev/null ;then
# echo "Cannot test for text, 0.0.0a, version types, assuming 'success' "
# return
# fi
write_error_and_die() { write_error_and_die() {
echo -e "\n\t\t$TXT version -->${tst_version}<-- is too old. echo -e "\n\t\t$TXT version -->${tst_version}<-- is too old.

View file

@ -17,12 +17,11 @@ validate_config() { # Are the config values sane (within reason)
on success: write text to console and returns on success: write text to console and returns
inline_doc inline_doc
local svn_tracking='$Id$' local -r lfs_PARAM_LIST="BUILDDIR HPKG TEST STRIP VIMLANG PAGE RUNMAKE"
local -r lfs_PARAM_LIST="BUILDDIR HPKG TEST TOOLCHAINTEST STRIP VIMLANG PAGE RUNMAKE"
local -r blfs_PARAM_LIST="BUILDDIR TEST DEPEND" local -r blfs_PARAM_LIST="BUILDDIR TEST DEPEND"
local -r hlfs_PARAM_LIST="BUILDDIR HPKG MODEL TEST TOOLCHAINTEST STRIP VIMLANG PAGE GRSECURITY_HOST RUNMAKE TIMEZONE" local -r hlfs_PARAM_LIST="BUILDDIR HPKG MODEL TEST STRIP VIMLANG PAGE GRSECURITY_HOST RUNMAKE TIMEZONE"
local -r clfs_PARAM_LIST="ARCH BOOTMINIMAL RUNMAKE MKFILE" local -r clfs_PARAM_LIST="ARCH BOOTMINIMAL RUNMAKE MKFILE"
local -r global_PARAM_LIST="BUILDDIR HPKG RUNMAKE TEST TOOLCHAINTEST STRIP PAGE TIMEZONE VIMLANG" local -r global_PARAM_LIST="BUILDDIR HPKG RUNMAKE TEST STRIP PAGE TIMEZONE VIMLANG"
local -r ERROR_MSG='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid, ${nl_}check the config file ${BOLD}${GREEN}\<$PROGNAME.conf\>${OFF}' local -r ERROR_MSG='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid, ${nl_}check the config file ${BOLD}${GREEN}\<$PROGNAME.conf\>${OFF}'
local -r PARAM_VALS='${config_param}: ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}' local -r PARAM_VALS='${config_param}: ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
@ -54,14 +53,13 @@ inline_doc
MKFILE) continue;; MKFILE) continue;;
HPKG) validation_str="x0x x1x" ;; HPKG) validation_str="x0x x1x" ;;
RUNMAKE) validation_str="x0x x1x" ;; RUNMAKE) validation_str="x0x x1x" ;;
TEST) validation_str="x0x x1x" ;; TEST) validation_str="x0x x1x x2x x3x" ;;
STRIP) validation_str="x0x x1x" ;; STRIP) validation_str="x0x x1x" ;;
VIMLANG) validation_str="x0x x1x" ;; VIMLANG) validation_str="x0x x1x" ;;
DEPEND) validation_str="x0x x1x x2x" ;; DEPEND) validation_str="x0x x1x x2x" ;;
MODEL) validation_str="xglibcx xuclibcx" ;; MODEL) validation_str="xglibcx xuclibcx" ;;
PAGE) validation_str="xletterx xA4x" ;; PAGE) validation_str="xletterx xA4x" ;;
ARCH) validation_str="xx86x xx86_64x xx86_64-64x xsparcx xsparcv8x xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xalphax" ;; ARCH) validation_str="xx86x xx86_64x xx86_64-64x xsparcx xsparcv8x xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xalphax" ;;
TOOLCHAINTEST) validation_str="x0x x1x" ;;
GRSECURITY_HOST) validation_str="x0x x1x" ;; GRSECURITY_HOST) validation_str="x0x x1x" ;;
BOOTMINIMAL) validation_str="x0x x1x";; BOOTMINIMAL) validation_str="x0x x1x";;
*) *)

219
master.sh
View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# $Id$
set -e set -e
@ -33,25 +34,27 @@ trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
PROGNAME=$(basename $0)
VERSION="0.0.1"
MODULE=$PROGNAME.module
MODULE_CONFIG=$PROGNAME.conf
echo -n "Loading common-func.module..."
source common-func.module
[[ $? > 0 ]] && echo "common-func.module did not load.." && exit
echo "OK"
#
if [ ! -L $0 ] ; then if [ ! -L $0 ] ; then
echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}" echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}"
exit 1 exit 1
fi fi
echo -n "Loading masterscript.conf..." PROGNAME=$(basename $0)
source masterscript.conf VERSION="0.0.1"
[[ $? > 0 ]] && echo "masterscript.conf did not load.." && exit COMMON_DIR="common"
PACKAGE_DIR=$(echo $PROGNAME | tr [a-z] [A-Z])
MODULE=$PACKAGE_DIR/master.sh
MODULE_CONFIG=$PACKAGE_DIR/config
echo -n "Loading common-functions module..."
source $COMMON_DIR/common-functions
[[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
echo "OK"
#
echo -n "Loading masterscript conf..."
source $COMMON_DIR/config
[[ $? > 0 ]] && echo "$COMMON_DIR/conf did not load.." && exit
echo "OK" echo "OK"
# #
echo -n "Loading config module <$MODULE_CONFIG>..." echo -n "Loading config module <$MODULE_CONFIG>..."
@ -61,10 +64,7 @@ echo "OK"
# #
echo -n "Loading code module <$MODULE>..." echo -n "Loading code module <$MODULE>..."
source $MODULE source $MODULE
if [[ $? > 0 ]]; then [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
echo "$MODULE did not load.."
exit 2
fi
echo "OK" echo "OK"
# #
echo "---------------${nl_}" echo "---------------${nl_}"
@ -79,166 +79,16 @@ WC=${BOOK:+1}
#*******************************************************************# #*******************************************************************#
echo -n "Loading function <func_check_version.sh>..."
source $COMMON_DIR/func_check_version.sh
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
echo "OK"
echo -n "Loading function <func_validate_configs.sh>..."
#----------------------------# source $COMMON_DIR/func_validate_configs.sh
check_requirements() { # Simple routine to validate gcc and kernel versions against requirements [[ $? > 0 ]] && echo " function module did not load.." && exit 2
#----------------------------# echo "OK"
# Minimum values acceptable echo "---------------${nl_}"
# bash 3.0>
# gcc 3.0>
# kernel 2.6.2>
[[ $1 = "1" ]] && echo "${nl_}BASH: ${L_arrow}${BOLD}${BASH_VERSION}${R_arrow}"
case $BASH_VERSION in
[3-9].*) ;;
*) 'clear'
echo -e "
$DD_BORDER
\t\t${OFF}${RED}BASH version ${BOLD}${YELLOW}-->${WHITE} $BASH_VERSION ${YELLOW}<--${OFF}${RED} is too old.
\t\t This script requires 3.0${OFF}${RED} or greater
$DD_BORDER"
exit 1
;;
esac
[[ $1 = "1" ]] && echo "GCC: ${L_arrow}${BOLD}`gcc -dumpversion`${R_arrow}"
case `gcc -dumpversion` in
[3-9].[0-9].* ) ;;
*) 'clear'
echo -e "
$DD_BORDER
\t\t${OFF}${RED}GCC version ${BOLD}${YELLOW}-->${WHITE} $(gcc -dumpversion) ${YELLOW}<--${OFF}${RED} is too old.
\t\t This script requires ${BOLD}${WHITE}3.0${OFF}${RED} or greater
$DD_BORDER"
exit 1
;;
esac
#
# >>>> Check kernel version against the minimum acceptable level <<<<
#
[[ $1 = "1" ]] && echo "LINUX: ${L_arrow}${BOLD}`uname -r`${R_arrow}"
local IFS
declare -i major minor revision change
min_kernel_vers=2.6.2
IFS=".-" # Split up w.x.y.z as well as w.x.y-rc (catch release candidates)
set -- $min_kernel_vers # set postional parameters to minimum ver values
major=$1; minor=$2; revision=$3
#
set -- `uname -r` # Set postional parameters to user kernel version
#Compare against minimum acceptable kernel version..
(( $1 > major )) && return
(( $1 == major )) && ((( $2 > minor )) ||
((( $2 == minor )) && (( $3 >= revision )))) && return
# oops.. write error msg and die
echo -e "
$DD_BORDER
\t\t${OFF}${RED}The kernel version ${BOLD}${YELLOW}-->${WHITE} $(uname -r) ${YELLOW}<--${OFF}${RED} is too old.
\t\tThis script requires version ${BOLD}${WHITE}$min_kernel_vers${OFF}${RED} or greater
$DD_BORDER"
exit 1
}
#----------------------------#
validate_config() { # Are the config values sane (within reason)
#----------------------------#
local -r lfs_PARAM_LIST="BUILDDIR HPKG TEST TOOLCHAINTEST STRIP VIMLANG PAGE RUNMAKE"
local -r blfs_PARAM_LIST="BUILDDIR TEST DEPEND"
local -r hlfs_PARAM_LIST="BUILDDIR HPKG MODEL TEST TOOLCHAINTEST STRIP VIMLANG PAGE GRSECURITY_HOST RUNMAKE TIMEZONE"
local -r clfs_PARAM_LIST="ARCH BOOTMINIMAL RUNMAKE MKFILE"
local -r global_PARAM_LIST="BUILDDIR HPKG RUNMAKE TEST TOOLCHAINTEST STRIP PAGE TIMEZONE VIMLANG"
local PARAM_LIST=
local -r ERROR_MSG='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid, ${nl_}check the config file ${BOLD}${GREEN}\<$PROGNAME.conf\>${OFF}'
local -r PARAM_VALS='${config_param}: ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
local config_param
local validation_str
write_error_and_die() {
echo -e "\n${DD_BORDER}"
echo -e "`eval echo ${ERROR_MSG}`" >&2
echo -e "${DD_BORDER}\n"
exit 1
}
set +e
for PARAM_GROUP in global_PARAM_LIST ${PROGNAME}_PARAM_LIST; do
for config_param in ${!PARAM_GROUP}; do
# This is a tricky little piece of code.. executes a cmd string.
[[ $1 = "1" ]] && echo -e "`eval echo $PARAM_VALS`"
case $config_param in
BUILDDIR) # We cannot have an <empty> or </> root mount point
if [[ "xx x/x" =~ "x${!config_param}x" ]]; then
write_error_and_die
fi
continue ;;
TIMEZONE) continue;;
MKFILE) continue;;
HPKG) validation_str="x0x x1x" ;;
RUNMAKE) validation_str="x0x x1x" ;;
TEST) validation_str="x0x x1x" ;;
STRIP) validation_str="x0x x1x" ;;
VIMLANG) validation_str="x0x x1x" ;;
DEPEND) validation_str="x0x x1x x2x" ;;
MODEL) validation_str="xglibcx xuclibcx" ;;
PAGE) validation_str="xletterx xA4x" ;;
ARCH) validation_str="xx86x xx86_64x xx86_64-64x xsparcx xsparcv8x xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xalphax" ;;
TOOLCHAINTEST) validation_str="x0x x1x" ;;
GRSECURITY_HOST) validation_str="x0x x1x" ;;
BOOTMINIMAL) validation_str="x0x x1x";;
*)
echo "WHAT PARAMETER IS THIS.. <<${config_param}>>"
exit
;;
esac
#
# This is the 'regexp' test available in bash-3.0..
# using it as a poor man's test for substring
if [[ ! "${validation_str}" =~ "x${!config_param}x" ]] ; then
# parameter value entered is no good
write_error_and_die
fi
done # for loop
# Not further tests needed on globals
if [[ "$PARAM_GROUP" = "global_PARAM_LIST" ]]; then
echo " ${BOLD}${GREEN}${PARAM_GROUP%%_*T} parameters are valid${OFF}"
continue
fi
for config_param in LC_ALL LANG; do
[[ $1 = "1" ]] && echo "`eval echo $PARAM_VALS`"
[[ -z "${!config_param}" ]] && continue
# See it the locale values exist on this machine
[[ "`locale -a | grep -c ${!config_param}`" > 0 ]] && continue
# If you make it this far then there is a problem
write_error_and_die
done
for config_param in FSTAB CONFIG KEYMAP BOOK; do
[[ $1 = "1" ]] && echo "`eval echo $PARAM_VALS`"
if [[ $config_param = BOOK ]]; then
[[ ! "${WC}" = 1 ]] && continue
fi
[[ -z "${!config_param}" ]] && continue
[[ -e "${!config_param}" ]] && [[ -s "${!config_param}" ]] && continue
# If you make it this far then there is a problem
write_error_and_die
done
echo " ${BOLD}${GREEN}${PARAM_GROUP%%_*T} parameters are valid${OFF}"
done
set -e
echo "$tab_***${BOLD}${GREEN}Config parameters look good${OFF}***"
}
################################### ###################################
@ -429,11 +279,11 @@ if [[ ! -d $JHALFSDIR ]]; then
fi fi
if [[ "$PWD" != "$JHALFSDIR" ]]; then if [[ "$PWD" != "$JHALFSDIR" ]]; then
cp -v makefile-functions $JHALFSDIR/ cp -v $COMMON_DIR/makefile-functions $JHALFSDIR/
if [[ -n "$FILES" ]]; then if [[ -n "$FILES" ]]; then
cp -v $FILES $JHALFSDIR/ cp -v $PACKAGE_DIR/$FILES $JHALFSDIR/
fi fi
sed 's,FAKEDIR,'$BOOK',' $XSL > $JHALFSDIR/${XSL} sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
export XSL=$JHALFSDIR/${XSL} export XSL=$JHALFSDIR/${XSL}
fi fi
@ -445,13 +295,20 @@ echo "---------------${nl_}"
# Check for minumum gcc and kernel versions # Check for minumum gcc and kernel versions
check_requirements 1 # 0/1 0-do not display values. #check_requirements 1 # 0/1 0-do not display values.
check_version "2.6.2" "`uname -r`" "KERNEL"
check_version "3.0" "$BASH_VERSION" "BASH"
check_version "3.0" "`gcc -dumpversion`" "GCC"
echo "---------------${nl_}" echo "---------------${nl_}"
validate_config 1 # 0/1 0-do not display values validate_config 1 # 0/1 0-do not display values
echo "---------------${nl_}" echo "---------------${nl_}"
get_book get_book
echo "---------------${nl_}" echo "---------------${nl_}"
build_Makefile build_Makefile
echo "---------------${nl_}" echo "---------------${nl_}"
#run_make #run_make