diff --git a/BLFS/dump-blfs-scripts.xsl b/BLFS/blfs.xsl
similarity index 99%
rename from BLFS/dump-blfs-scripts.xsl
rename to BLFS/blfs.xsl
index 6f7e28c..71fc5c8 100644
--- a/BLFS/dump-blfs-scripts.xsl
+++ b/BLFS/blfs.xsl
@@ -5,6 +5,8 @@
extension-element-prefixes="exsl"
version="1.0">
+
+
diff --git a/BLFS/jhablfs.conf b/BLFS/config
similarity index 50%
rename from BLFS/jhablfs.conf
rename to BLFS/config
index 5614069..5bf002f 100644
--- a/BLFS/jhablfs.conf
+++ b/BLFS/config
@@ -1,19 +1,18 @@
#####
#
-# Configuration file for the jhablfs build script
+# Configuration file for the blfs module
+#
+# $Id$
#
#####
+declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/blfs/conglomeration
-declare -r SVN="svn://svn.linuxfromscratch.org"
-declare -r LOG=000-jhablfs.log
-
-#--- Working directories
-JHABLFSDIR=~/jhablfs
- LOGDIR=$JHABLFSDIR/logs
- MKFILE=$JHABLFSDIR/Makefile
+#--- Book's sources directory
+# If you have previously checked out the book from the repository
+BOOK=
#--- Book version
-BLFSVRS=development
+LFSVRS=development
#--- FTP/HTTP mirror used as fallback (full path)
SERVER=ftp://anduin.linuxfromscratch.org/BLFS/conglomeration
@@ -25,12 +24,10 @@ DEPEND=1
TEST=0
-
#==== INTERNAL VARIABLES ====
# Don't edit it unless you know what you are doing
#--- Default stylesheet
-XSL=dump-blfs-scripts.xsl
+ XSL=blfs.xsl
+MKFILE=$JHALFSDIR/Makefile
-#--- Files that will be copied to $JHABLFSDIR
-FILES="functions dump-blfs-scripts.xsl"
diff --git a/BLFS/functions b/BLFS/functions
deleted file mode 100644
index ff3ed59..0000000
--- a/BLFS/functions
+++ /dev/null
@@ -1,59 +0,0 @@
-BOLD= "[0;1m"
-RED= "[1;31m"
-GREEN= "[0;32m"
-ORANGE= "[0;33m"
-BLUE= "[1;34m"
-WHITE= "[00m"
-
-define echo_message
- @echo $(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$(WHITE)
-endef
-
-define unpack
- @if [ -f $(LFS)$(SRC)/$(1).bz2 ] ; then \
- cd $(LFS)$(SRC) ; tar -xvjf $(1).bz2 > /tmp/unpacked ; \
- else \
- cd $(LFS)$(SRC) ; tar -xvzf $(1).gz > /tmp/unpacked ; \
- fi ;
-endef
-
-define unpack2
- @cd $(LFS)$(SRC) ; /tools/bin/tar -xvf $(1) > /tmp/unpacked
-endef
-
-define echo_finished
- @echo $(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @echo $(BOLD) Finished the build of $(BLUE)LFS-$(1)$(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @echo -e \\t\\t$(RED)W A R N I N G$(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @echo
- @echo To be able to boot your new LFS system you need to follow
- @echo the next steps:$(WHITE)
- @echo
- @echo -e \\t- Enter to the chroot using the command found
- @echo -e \\tin chapter06/revisedchroot.html
- @echo
- @echo -e \\t- Set a password for the root user
- @echo
- @echo -e \\t- Edit /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
- @echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network,
- @echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
- @echo -e \\tany other configuration file required to suit your needs.
- @echo
- @echo -e \\t- Set-up Grub. See chapter08/grub.html
- @echo
- @echo -e \\t- Unmount the filesystems. See chapter09/reboot.html
- @echo
- @echo If you are an experienced LFS user, several of those steps can be
- @echo skipped or done in a different way. But then, that is something
- @echo that you already know and there is no need to discuss it here.
- @echo $(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$(WHITE)
-endef
diff --git a/BLFS/jhablfs b/BLFS/jhablfs
deleted file mode 100755
index 8578eca..0000000
--- a/BLFS/jhablfs
+++ /dev/null
@@ -1,341 +0,0 @@
-#!/bin/sh
-
-#
-# Load the configuration file
-#
-source jhablfs.conf
-
-
-version="
-jhablfs development \$Date: 2005-12-04 13:24:26 +0100 (dom, 04 dic 2005) $
-
-Written by Jeremy Huntwork and Manuel Canales Esparcia.
-
-This program is published under the \
-Gnu General Public License, Version 2.
-"
-
-usage="\
-Usage: $0 [OPTION]
-
-Options:
- -h, --help print this help, then exit
-
- -V, --version print version number, then exit
-
- -B, --BLFS-version VER checkout VER version of the BLFS book.
- If not set, the development version
- is used.
-
- Supported versions at this time are:
-
- dev* | trunk | SVN aliases for Development BLFS
-
- -W, --working-copy DIR use the local working copy placed in DIR
- as the BLFS book
-
- -D, --dependencies TYPE add dependencies of type TYPE to the build tree.
- If not set, both required a recommended are used.
-
- Possible values are:
-
- required only required dependecies are used
- recommended both required a recommended dependencies are used
- optional all dependencies are used
-
- -S, --server SERVER set the FTP/HTTP server used as fallback to
- download the packages. If not specified, the one
- set in jhablfs.conf is used.
-
- -T, --testsuites add support to run the optional testsuites
-
-"
-
-help="\
-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 jhablfs
-# EDIT THIS FILE MANUALLY TO SUIT YOUR NEEDS
-#
-# Generated on `date \"+%F %X %Z\"`"
-
-
-###################################
-### FUNCTIONS ###
-###################################
-
-
-#----------------------------#
-get_book() {
-#----------------------------#
- # 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"
- cd $JHABLFSDIR
-
- if [ -z $WC ] ; then
- echo -n "Downloading the BLFS Book, version $BLFSVRS... "
-
- # Grab the BLFS book fresh if it's missing, otherwise, update it from the
- # repo. If we've already extracted the commands, move on.
- if [ -d blfs-$BLFSVRS ] ; then
- cd blfs-$BLFSVRS
- if LC_ALL=C svn up | grep -q At && test -d $JHABLFSDIR/commands ; then
- echo -ne "done\n"
- # Set the canonical book version
- cd $JHABLFSDIR
- VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
- else
- echo -ne "done\n"
- # Set the canonical book version
- cd $JHABLFSDIR
- VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
- extract_commands
- fi
- else
- case $BLFSVRS in
- development)
- svn co $SVN/BLFS/trunk/BOOK blfs-$BLFSVRS >>$LOGDIR/$LOG 2>&1 ;;
- esac
- echo -ne "done\n"
- # Set the canonical book version
- cd $JHABLFSDIR
- VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
- extract_commands
- fi
- else
- echo -ne "Using $BOOK as book's sources ...\n"
- # Set the canonical book version
- cd $JHABLFSDIR
- VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
- extract_commands
- fi
-}
-
-#----------------------------#
-extract_commands() {
-#----------------------------#
- # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
- test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
- exit 1"
- cd $JHABLFSDIR
-
- # Start clean
- if [ -d commands ] ; then rm -rf commands ; fi && mkdir commands
- echo -n "Extracting commands... "
-
- # Dump the commands in shell script form from the BLFS book.
- xsltproc --nonet --xinclude --stringparam testsuite $TEST \
- --stringparam server $SERVER -o ./commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
-
- # Make the scripts executable.
- chmod -R +x $JHABLFSDIR/commands
-
- # Done. Moving on...
- echo -ne "done\n"
-}
-
-
-#----------------------------#
-build_Makefile() {
-#----------------------------#
- echo -n "Creating Makefile... "
- cd $JHABLFSDIR/commands
-
- # Start with a clean Makefile file
- >$MKFILE
-
-
- # Add a header, some variables and include the function file
- # to the top of the real Makefile.
-(
- cat << EOF
-$HEADER
-
-include functions
-
-EOF
-) > $MKFILE
-
- # Drop in a dummy target 'all:'.
-(
- cat << EOF
-all:
- @echo -e "\nThere is no default target predefined"
- @echo -e "You must to tell what package(s) you want to install"
- @echo -e "or edit the \"all\" Makefile target to create your own"
- @echo -e "defualt target.\n"
- @exit
-EOF
-) >> $MKFILE
-
- # Bring over the build targets.
- for file in */* ; do
- # Keep the script file name
- case $file in
- gnome/config )
- i=config-gnome
- ;;
- gnome/pre-install-config )
- i=pre-intall-config-gnome
- ;;
- kde/config )
- i=config-kde
- ;;
- kde/pre-install-config )
- i=pre-intall-config-kde
- ;;
- * )
- i=`basename $file`
- ;;
- esac
-
- # Dump the package dependencies.
- REQUIRED=`grep "REQUIRED" $file | sed 's/# REQUIRED://' | tr -d '\n'`
- if [ "$DEPEND" != "0" ] ; then
- RECOMMENDED=`grep "RECOMMENDED" $file | sed 's/# RECOMMENDED://' | tr -d '\n'`
- fi
- if [ "$DEPEND" = "2" ] ; then
- OPTIONAL=`grep "OPTIONAL" $file | sed 's/# OPTIONAL://' | tr -d '\n'`
- fi
-
- # Drop in the name of the target on a new line plus its dependencies
- # and call the echo_message function.
-(
- cat << EOF
-
-$i: $REQUIRED $RECOMMENDED $OPTIONAL
- @\$(call echo_message, Building)
-EOF
-) >> $MKFILE
-
- # Insert date and disk usage at the top of the log file, the script run
- # and date and disk usage again at the bottom of the log file.
-(
- cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" >logs/$i && \\
- $JHABLFSDIR/commands/$file >>logs/$i 2>&1 && \\
- echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" >>logs/$i
-EOF
-) >> $MKFILE
-
- # Include a touch of the target name so make can check
- # if it's already been made.
-(
- cat << EOF
- @touch \$@
-EOF
-) >> $MKFILE
-
- done
- echo -ne "done\n"
-}
-
-
-
-###################################
-### MAIN ###
-###################################
-
-# Evaluate any command line switches
-
-while test $# -gt 0 ; do
- case $1 in
- --version | -V )
- echo "$version"
- exit 0
- ;;
-
- --help | -h )
- echo "$usage"
- exit 0
- ;;
-
- --BLFS-version | -B )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- case $1 in
- dev* | SVN | trunk )
- BLFSVRS=development
- ;;
- * )
- echo "$1 is an unsupported version at this time."
- exit 1
- ;;
- esac
- ;;
-
- --working-copy | -W )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- if [ -f $1/use-unzip.xml ] ; then
- WC=1
- BOOK=$1
- else
- echo -e "\nLook like $1 isn't a proper BLFS working copy."
- echo -e "Verify your selection and the command line.\n"
- exit 1
- fi
- ;;
-
- --dependencies | -D )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- case $1 in
- required )
- DEPEND=0
- ;;
- recommended )
- DEPEND=1
- ;;
- optional )
- DEPEND=2
- ;;
- * )
- echo "$1 is not a proper dependencies type."
- exit 1
- ;;
- esac
- ;;
-
- --testsuites | -T ) TEST=1 ;;
-
- --server | -S )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- case $1 in
- *conglomeration )
- SERVER=$1
- ;;
- * )
- echo "$1 is not a proper HTTP/FTP path to the BLFS packages."
- exit 1
- ;;
- esac
- ;;
-
- * )
- echo "$usage"
- exit 1
- ;;
- esac
- shift
-done
-
-if [ -z $BOOK ] ; then
- BOOK=blfs-$BLFSVRS
-fi
-
-[[ ! -d $JHABLFSDIR ]] && mkdir -pv $JHABLFSDIR
-[[ "$PWD" != "$JHABLFSDIR" ]] && cp -v $FILES $JHABLFSDIR
-[[ ! -d $LOGDIR ]] && mkdir -v $LOGDIR
->$LOGDIR/$LOG
-
-get_book
-build_Makefile
-
diff --git a/BLFS/master.sh b/BLFS/master.sh
new file mode 100755
index 0000000..3afba9e
--- /dev/null
+++ b/BLFS/master.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+# $Id$
+
+#----------------------------#
+build_Makefile() {
+#----------------------------#
+ echo -n "Creating Makefile... "
+ cd $JHALFSDIR/${PROGNAME}-commands
+
+ # Start with a clean Makefile file
+ >$MKFILE
+
+
+ # Add a header, some variables and include the function file
+ # to the top of the real Makefile.
+(
+ cat << EOF
+$HEADER
+
+include makefile-functions
+
+EOF
+) > $MKFILE
+
+ # Drop in a dummy target 'all:'.
+(
+ cat << EOF
+all:
+ @echo -e "\nThere is no default target predefined"
+ @echo -e "You must to tell what package(s) you want to install"
+ @echo -e "or edit the \"all\" Makefile target to create your own"
+ @echo -e "defualt target.\n"
+ @exit
+EOF
+) >> $MKFILE
+
+ # Bring over the build targets.
+ for file in */* ; do
+ # Keep the script file name
+ case $file in
+ gnome/config )
+ this_script=config-gnome
+ ;;
+ gnome/pre-install-config )
+ this_script=pre-intall-config-gnome
+ ;;
+ kde/config )
+ this_script=config-kde
+ ;;
+ kde/pre-install-config )
+ this_script=pre-intall-config-kde
+ ;;
+ * )
+ this_script=`basename $file`
+ ;;
+ esac
+
+ # Dump the package dependencies.
+ REQUIRED=`grep "REQUIRED" $file | sed 's/# REQUIRED://' | tr -d '\n'`
+ if [ "$DEPEND" != "0" ] ; then
+ RECOMMENDED=`grep "RECOMMENDED" $file | sed 's/# RECOMMENDED://' | tr -d '\n'`
+ fi
+ if [ "$DEPEND" = "2" ] ; then
+ OPTIONAL=`grep "OPTIONAL" $file | sed 's/# OPTIONAL://' | tr -d '\n'`
+ fi
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line plus its dependencies
+ # and call the echo_message function.
+(
+ cat << EOF
+
+$this_script: $REQUIRED $RECOMMENDED $OPTIONAL
+ @\$(call echo_message, Building)
+EOF
+) >> $MKFILE
+
+ # Insert date and disk usage at the top of the log file, the script run
+ # and date and disk usage again at the bottom of the log file.
+(
+ cat << EOF
+ @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" >logs/$this_script && \\
+ $JHALFSDIR/${PROGNAME}-commands/$file >>logs/$this_script 2>&1 && \\
+ echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=logs/* /\`\n" >>logs/$this_script
+EOF
+) >> $MKFILE
+
+ # Include a touch of the target name so make can check
+ # if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+
+ done
+ echo -ne "done\n"
+}
+
+
+
diff --git a/CLFS/clfs.xsl b/CLFS/clfs.xsl
new file mode 100644
index 0000000..dabbe35
--- /dev/null
+++ b/CLFS/clfs.xsl
@@ -0,0 +1,230 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 00
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ #!/tools/bin/bash
set -e
+
+
+ #!/bin/sh
+
+
+ #!/bin/sh
set -e
+
+
+
+ cd $PKGDIR
+
+ tar -xvf ../vim-&vim-version;-lang.* --strip-components=1
+
+
+
+ exit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ make -k
+
+ || true
+
+
+
+
+
+
+
+
+ tar.*
+
+
+
+
+
+
+ patch -Z
+
+
+
+
+
+
+ export LANG=
+
+
+
+
+
+
+
+
+ make mrproper
+
+ cp -v ../bootkernel-config .config
+
+
+ cp -v ../kernel-config .config
+
+
+
+
+
+
+
+
+
+
+ make -k check || true
+
+
+
+
+
+
+
+ || true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ || true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ **EDITME
+
+ EDITME**
+
+
+
+
+
diff --git a/CLFS/config b/CLFS/config
new file mode 100644
index 0000000..0dc5274
--- /dev/null
+++ b/CLFS/config
@@ -0,0 +1,74 @@
+#####
+#
+# Configuration file for the CLFS module
+#
+# $Id$
+#
+#####
+declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/lfs/conglomeration
+
+#--- 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"
+# ARCH=sparcv8 ; TARGET="sparc-unknown-linux-gnu"
+#--------------------------------
+# >>>> 64-64 BUILD <<<<
+# ARCH=x86_64-64 ; TARGET="x86_64-unknown-linux-gnu"
+# ARCH=mips64-64 ; TARGET="mipsel-unknown-linux-gnu"
+# ARCH=mips64-64 ; TARGET="mips-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="mipsel-unknown-linux-gnu" ; TARGET32="mipsel-unknown-linux-gnu"
+# ARCH=mips64 ; TARGET="mips-unknown-linux-gnu" ; TARGET32="mips-unknown-linux-gnu"
+# ARCH=sparc64 ; TARGET="sparc64-unknown-linux-gnu" ; TARGET32="sparcv9-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
+
+#--- 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=
+
+#--- 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="patcheslist.xsl packageslist.xsl"
+
+#--- Default stylesheet
+XSL=clfs.xsl
+
+#--- Book version
+LFSVRS=development
+
+#--- Name of the makefile
+MKFILE=$JHALFSDIR/Makefile
+
+#--- FTP/HTTP mirror used as fallback (full path)
+SERVER=ftp://anduin.linuxfromscratch.org/LFS/conglomeration
diff --git a/CLFS/master.sh b/CLFS/master.sh
new file mode 100755
index 0000000..a1dcc80
--- /dev/null
+++ b/CLFS/master.sh
@@ -0,0 +1,1077 @@
+#!/bin/sh
+# $Id$
+
+###################################
+### FUNCTIONS ###
+###################################
+
+
+
+#----------------------------#
+host_prep_Makefiles() { # Initialization of the system
+#----------------------------#
+ local LFS_HOST
+
+ echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
+
+ # defined here, only for ease of reading
+ LFS_HOST="`echo ${MACHTYPE} | sed -e 's/unknown/cross/g' -e 's/-pc-/-cross-/g'`"
+(
+cat << EOF
+023-creatingtoolsdir:
+ @\$(call echo_message, Building)
+ @mkdir -v \$(MOUNT_PT)/tools && \\
+ rm -fv /tools && \\
+ ln -sv \$(MOUNT_PT)/tools /
+ @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
+ mkdir \$(MOUNT_PT)/sources; \\
+ fi;
+ @chmod a+wt \$(MOUNT_PT)/sources && \\
+ touch \$@
+
+024-creatingcrossdir: 023-creatingtoolsdir
+ @mkdir -v \$(MOUNT_PT)/cross-tools && \\
+ rm -fv /cross-tools && \\
+ ln -sv \$(MOUNT_PT)/cross-tools /
+ @touch \$@
+
+025-addinguser: 024-creatingcrossdir
+ @\$(call echo_message, Building)
+ @if [ ! -d /home/lfs ]; then \\
+ groupadd lfs; \\
+ useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
+ else \\
+ touch user-lfs-exist; \\
+ fi;
+ @chown lfs \$(MOUNT_PT) && \\
+ chown lfs \$(MOUNT_PT)/tools && \\
+ chown lfs \$(MOUNT_PT)/cross-tools && \\
+ chown lfs \$(MOUNT_PT)/sources && \\
+ touch \$@
+
+026-settingenvironment: 025-addinguser
+ @\$(call echo_message, Building)
+ @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
+ mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
+ fi;
+ @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
+ mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
+ fi;
+ @echo "set +h" > /home/lfs/.bashrc && \\
+ echo "umask 022" >> /home/lfs/.bashrc && \\
+ echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
+ echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
+ echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
+ echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
+ echo "" >> /home/lfs/.bashrc && \\
+ echo "unset CFLAGS" >> /home/lfs/.bashrc && \\
+ echo "unset CXXFLAGS" >> /home/lfs/.bashrc && \\
+ echo "" >> /home/lfs/.bashrc && \\
+ echo "export LFS_HOST=\"${LFS_HOST}\"" >> /home/lfs/.bashrc && \\
+ echo "export LFS_TARGET=\"${TARGET}\"" >> /home/lfs/.bashrc && \\
+ echo "export LFS_TARGET32=\"${TARGET32}\"" >> /home/lfs/.bashrc && \\
+ echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc
+ @chown lfs:lfs /home/lfs/.bashrc && \\
+ touch envars && \\
+ touch \$@
+EOF
+) >> $MKFILE.tmp
+
+}
+
+
+
+#-----------------------------#
+cross_tools_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
+
+ for file in cross-tools/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+ #
+ # Skip this script...
+ case $this_script in
+ *cflags* | *variables* ) # work done in host_prep_Makefiles
+ continue; ;;
+ *) ;;
+ esac
+ #
+ # Set the dependency for the first target.
+ if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ cross_tools="$cross_tools $this_script"
+
+ # Grab the name of the target (minus the -headers or -cross in the case of gcc
+ # and binutils in chapter 5)
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
+ -e 's@-static@@' \
+ -e 's@-final@@' \
+ -e 's@-headers@@' \
+ -e 's@-64@@' \
+ -e 's@-n32@@'`
+ # Adjust 'name' and patch a few scripts on the fly..
+ case $name in
+ linux-libc) name=linux-libc-headers ;;
+ esac
+ #
+ # Find the version of the command files, if it corresponds with the building of a specific package
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+ #
+ # If $vrs isn't empty, we've got a package...
+ #
+ [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
+ #
+ wrt_run_as_su "${this_script}" "${file}"
+ #
+ [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done # for file in ....
+}
+
+
+#-----------------------------#
+temptools_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}temp system${R_arrow}"
+
+ for file in temp-system/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+ #
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ temptools="$temptools $this_script"
+
+ #
+ # Grab the name of the target, strip id number, XXX-script
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
+ #
+ # Find the version of the command files, if it corresponds with the building of a specific package
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+ #
+ # If $vrs isn't empty, we've got a package...
+ # Insert instructions for unpacking the package and to set the PKGDIR variable.
+ #
+ [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
+ #
+ wrt_run_as_su "${this_script}" "${file}"
+ #
+ [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+ done # for file in ....
+}
+
+
+#-----------------------------#
+boot_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}boot${R_arrow}"
+
+ for file in boot/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # A little housekeeping on the scripts
+ case $this_script in
+ *grub | *aboot | *colo | *silo | *arcload | *lilo ) continue ;;
+ *whatnext*) continue ;;
+ *kernel) # if there is no kernel config file do not build the kernel
+ [[ -z $CONFIG ]] && continue
+ # Copy the config file to /sources with a standardized name
+ cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
+ ;;
+ esac
+ #
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ boottools="$boottools $this_script"
+ #
+ # Grab the name of the target, strip id number and misc words.
+ case $this_script in
+ *kernel) name=linux ;;
+ *bootscripts) name="bootscripts-cross-lfs" ;;
+ *udev-rules) name="udev-cross-lfs" ;;
+ *grub-build) name=grub ;;
+ *-aboot-build) name=aboot ;;
+ *yaboot-build) name=yaboot ;;
+ *colo-build) name=colo ;;
+ *silo-build) name=silo ;;
+ *arcload-build) name=arcload ;;
+ *lilo-build) name=lilo ;;
+ *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
+ esac
+
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+ #
+ # If $vrs isn't empty, we've got a package...
+ # Insert instructions for unpacking the package and changing directories
+ #
+ [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
+ #
+ # Select a script execution method
+ case $this_script in
+ *changingowner*) wrt_run_as_root "${this_script}" "${file}" ;;
+ *devices*) wrt_run_as_root "${this_script}" "${file}" ;;
+ *fstab*) if [[ -n "$FSTAB" ]]; then
+ wrt_copy_fstab "${this_script}"
+ else
+ wrt_run_as_su "${this_script}" "${file}"
+ fi
+ ;;
+ *) wrt_run_as_su "${this_script}" "${file}" ;;
+ esac
+ #
+ # Housekeeping...remove any build directory(ies) except if the package build fails.
+ [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done
+}
+
+
+#-----------------------------#
+chroot_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}chroot${R_arrow}"
+
+ for file in chroot/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+ #
+ # Skipping scripts is done now and not included in the build tree.
+ case $this_script in
+ *chroot*) continue ;;
+ esac
+
+ #
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ chroottools="$chroottools $this_script"
+
+ # Grab the name of the target, strip id number, XXX-script
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+ #
+ # If $vrs isn't empty, we've got a package...
+ # Insert instructions for unpacking the package and changing directories
+ #
+ if [ "$vrs" != "" ] ; then
+ case $this_script in
+ *util-linux) wrt_unpack "$name-$vrs.tar.*"
+ echo -e '\ttrue' >> $MKFILE.tmp
+ ;;
+ *) wrt_unpack2 "$name-$vrs.tar.*"
+ ;;
+ esac
+ fi
+ #
+ # Select a script execution method
+ case $this_script in
+ *kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
+ *util-linux) wrt_run_as_su "${this_script}" "${file}" ;;
+ *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
+ esac
+ #
+ # Housekeeping...remove the build directory(ies), except if the package build fails.
+ [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done # for file in...
+}
+
+
+#-----------------------------#
+testsuite_tools_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools${R_arrow}"
+
+ for file in testsuite-tools/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ testsuitetools="$testsuitetools $this_script"
+
+ # Grab the name of the target, strip id number, XXX-script
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
+ -e 's@-64bit@@' \
+ -e 's@-64@@' \
+ -e 's@64@@' \
+ -e 's@n32@@'`
+
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+ #
+ case $name in
+ tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
+ *) wrt_unpack2 "$name-$vrs.tar.*" ;;
+ esac
+ #
+ wrt_run_as_chroot1 "${this_script}" "${file}"
+ #
+ wrt_remove_build_dirs "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done
+}
+
+
+#--------------------------------#
+bm_testsuite_tools_Makefiles() { #
+#--------------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools${R_arrow}"
+
+ for file in testsuite-tools/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ PREV=
+ testsuitetools="$testsuitetools $this_script"
+
+ # Grab the name of the target, strip id number, XXX-script
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
+ -e 's@-64bit@@' \
+ -e 's@-64@@' \
+ -e 's@64@@' \
+ -e 's@n32@@'`
+
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+ #
+ case $name in
+ tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
+ *) wrt_unpack3 "$name-$vrs.tar.*" ;;
+ esac
+ #
+ wrt_run_as_root2 "${this_script}" "${file}"
+ #
+ wrt_remove_build_dirs2 "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done
+}
+
+
+#-----------------------------#
+final_system_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system${R_arrow}"
+
+ for file in final-system/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # Test if the stripping phase must be skipped
+ case $this_script in
+ *stripping*) [[ "$STRIP" = "0" ]] && continue
+ ;;
+ esac
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ basicsystem="$basicsystem $this_script"
+
+ # Grab the name of the target, strip id number, XXX-script
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
+ -e 's@temp-@@' \
+ -e 's@-64bit@@' \
+ -e 's@-64@@' \
+ -e 's@64@@' \
+ -e 's@n32@@'`
+
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+
+ # If $vrs isn't empty, we've got a package...
+ if [ "$vrs" != "" ] ; then
+ case $name in
+ temp-perl) wrt_unpack2 "perl-$vrs.tar.*" ;;
+ *) wrt_unpack2 "$name-$vrs.tar.*" ;;
+ esac
+ fi
+ #
+ wrt_run_as_chroot1 "${this_script}" "${file}"
+ #
+ [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done # for file in final-system/* ...
+}
+
+
+#-----------------------------#
+bm_final_system_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system${R_arrow}"
+
+ # The makesys phase was initiated in bm_testsuite_tools_makefile
+ [[ "$TEST" = 0 ]] && PREV=""
+
+ for file in final-system/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # Test if the stripping phase must be skipped
+ case $this_script in
+ *stripping*) [[ "$STRIP" = "0" ]] && continue
+ ;;
+ esac
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ basicsystem="$basicsystem $this_script"
+
+ # Grab the name of the target, strip id number, XXX-script
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
+ -e 's@temp-@@' \
+ -e 's@-64bit@@' \
+ -e 's@-64@@' \
+ -e 's@64@@' \
+ -e 's@n32@@'`
+
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+
+ # If $vrs isn't empty, we've got a package...
+ if [ "$vrs" != "" ] ; then
+ case $name in
+ temp-perl) wrt_unpack3 "perl-$vrs.tar.*" ;;
+ *) wrt_unpack3 "$name-$vrs.tar.*" ;;
+ esac
+ fi
+ #
+ wrt_run_as_root2 "${this_script}" "${file}"
+ #
+ [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done # for file in final-system/* ...
+}
+
+
+#-----------------------------#
+bootscripts_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts${R_arrow}"
+
+ for file in bootscripts/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ case $this_script in
+ *udev) continue ;; # This is not a script but a commentary, we want udev-rules
+ *console*) continue ;; # Use the files that came with the bootscripts
+ *) ;;
+ esac
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ bootscripttools="$bootscripttools $this_script"
+
+ # Grab the name of the target, strip id number, XXX-script
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
+ -e 's@-64bit@@' \
+ -e 's@-64@@' \
+ -e 's@64@@' \
+ -e 's@n32@@'`
+ case $name in
+ *bootscripts*) name=bootscripts-cross-lfs ;;
+ *udev-rules) name=udev-cross-lfs ;;
+ esac
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+ #
+ # If $vrs isn't empty, we've got a package...
+ #
+ [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
+ #
+ wrt_run_as_chroot1 "${this_script}" "${file}"
+ #
+ [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done # for file in bootscripts/* ...
+
+}
+
+#-----------------------------#
+bm_bootscripts_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts${R_arrow}"
+
+ for file in bootscripts/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ case $this_script in
+ *udev*) continue ;; # This is not a script but a commentary
+ *console*) continue ;; # Use the files that came with the bootscripts
+ *) ;;
+ esac
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ bootscripttools="$bootscripttools $this_script"
+
+ # Grab the name of the target, strip id number, XXX-script
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
+ -e 's@-64bit@@' \
+ -e 's@-64@@' \
+ -e 's@64@@' \
+ -e 's@n32@@'`
+ case $name in
+ *bootscripts*) name=bootscripts-cross-lfs
+ ;;
+ esac
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+ #
+ # If $vrs isn't empty, we've got a package...
+ #
+ [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
+ #
+ wrt_run_as_root2 "${this_script}" "${file}"
+ #
+ [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done # for file in bootscripts/* ...
+
+}
+
+
+
+#-----------------------------#
+bootable_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable${R_arrow}"
+
+ for file in {bootable,the-end}/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # A little housekeeping on the scripts
+ case $this_script in
+ *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
+ *kernel) # if there is no kernel config file do not build the kernel
+ [[ -z $CONFIG ]] && continue
+ # Copy the config file to /sources with a standardized name
+ cp $CONFIG $BUILDDIR/sources/kernel-config
+ ;;
+ esac
+ #
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ bootabletools="$bootabletools $this_script"
+ #
+ # Grab the name of the target, strip id number and misc words.
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
+ case $this_script in
+ *kernel*) name=linux
+ ;;
+ esac
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+ #
+ # If $vrs isn't empty, we've got a package...
+ # Insert instructions for unpacking the package and changing directories
+ #
+ [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
+ #
+ # Select a script execution method
+ case $this_script in
+ *fstab*) if [[ -n "$FSTAB" ]]; then
+ wrt_copy_fstab "${this_script}"
+ else
+ wrt_run_as_chroot1 "${this_script}" "${file}"
+ fi
+ ;;
+ *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
+ esac
+ #
+ # Housekeeping...remove any build directory(ies) except if the package build fails.
+ [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done
+
+}
+
+
+
+#-----------------------------#
+bm_bootable_Makefiles() { #
+#-----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable${R_arrow}"
+
+ for file in {bootable,the-end}/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # A little housekeeping on the scripts
+ case $this_script in
+ *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
+ *kernel) # if there is no kernel config file do not build the kernel
+ [[ -z $CONFIG ]] && continue
+ # Copy the named config file to /sources with a standardized name
+ cp $CONFIG $BUILDDIR/sources/kernel-config
+ ;;
+ esac
+ #
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ bootabletools="$bootabletools $this_script"
+ #
+ # Grab the name of the target, strip id number and misc words.
+ case $this_script in
+ *kernel) name=linux
+ ;;
+ *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
+ esac
+
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
+ #
+ # If $vrs isn't empty, we've got a package...
+ # Insert instructions for unpacking the package and changing directories
+ #
+ [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
+ #
+ # Select a script execution method
+ case $this_script in
+ *fstab*) if [[ -n "$FSTAB" ]]; then
+ # Minimal boot mode has no access to original file, store in /sources
+ cp $FSTAB $BUILDDIR/sources/fstab
+ wrt_copy_fstab2 "${this_script}"
+ else
+ wrt_run_as_root2 "${this_script}" "${file}"
+ fi
+ ;;
+ *) wrt_run_as_root2 "${this_script}" "${file}" ;;
+ esac
+ #
+ # Housekeeping...remove any build directory(ies) except if the package build fails.
+ [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
+ #
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+
+ done
+
+}
+
+
+#-----------------------------#
+build_Makefile() { # Construct a Makefile from the book scripts
+#-----------------------------#
+ echo "Creating Makefile... ${BOLD}START${OFF}"
+
+ cd $JHALFSDIR/${PROGNAME}-commands
+ # Start with a clean Makefile.tmp file
+ >$MKFILE.tmp
+
+ host_prep_Makefiles
+ cross_tools_Makefiles # $cross_tools
+ temptools_Makefiles # $temptools
+ if [[ $METHOD = "chroot" ]]; then
+ chroot_Makefiles # $chroottools
+ if [[ ! $TEST = "0" ]]; then
+ testsuite_tools_Makefiles # $testsuitetools
+ fi
+ final_system_Makefiles # $basicsystem
+ bootscripts_Makefiles # $bootscripttools
+ bootable_Makefiles # $bootabletools
+ else
+ boot_Makefiles # $boottools
+ if [[ ! $TEST = "0" ]]; then
+ bm_testsuite_tools_Makefiles # $testsuitetools
+ fi
+ bm_final_system_Makefiles # $basicsystem
+ bm_bootscripts_Makefiles # $bootscipttools
+ bm_bootable_Makefiles # $bootabletoosl
+ fi
+# the_end_Makefiles
+
+
+ # Add a header, some variables and include the function file
+ # to the top of the real Makefile.
+(
+ cat << EOF
+$HEADER
+
+SRC= /sources
+MOUNT_PT= $BUILDDIR
+
+include makefile-functions
+
+EOF
+) > $MKFILE
+
+ # Add chroot commands
+ if [ "$METHOD" = "chroot" ] ; then
+ chroot=`cat chroot/*chroot* | sed -e '/#!\/tools\/bin\/bash/d' \
+ -e '/^export/d' \
+ -e '/^logout/d' \
+ -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
+ -e 's|\\$|&&|g' \
+ -e 's|exit||g' \
+ -e 's|$| -c|' \
+ -e 's|"$$LFS"|$(MOUNT_PT)|'\
+ -e 's|set -e||'`
+ echo -e "CHROOT1= $chroot\n" >> $MKFILE
+ fi
+
+ # Drop in the main target 'all:' and the chapter targets with each sub-target
+ # as a dependency.
+if [[ "${METHOD}" = "chroot" ]]; then
+(
+ cat << EOF
+all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8
+ @\$(call echo_finished,$VERSION)
+
+chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
+
+chapter3: chapter2 $cross_tools
+
+chapter4: chapter3 $temptools
+
+chapter5: chapter4 $chroottools $testsuitetools
+
+chapter6: chapter5 $basicsystem
+
+chapter7: chapter6 $bootscripttools
+
+chapter8: chapter7 $bootabletools
+
+clean-all: clean
+ rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
+
+clean: clean-chapter4 clean-chapter3 clean-chapter2
+
+clean-chapter2:
+ -if [ ! -f user-lfs-exist ]; then \\
+ userdel lfs; \\
+ rm -rf /home/lfs; \\
+ fi;
+ rm -rf \$(MOUNT_PT)/tools
+ rm -f /tools
+ rm -rf \$(MOUNT_PT)/cross-tools
+ rm -f /cross-tools
+ rm -f envars user-lfs-exist
+ rm -f 02* logs/02*.log
+
+clean-chapter3:
+ rm -rf \$(MOUNT_PT)/tools/*
+ rm -f $cross_tools restore-lfs-env sources-dir
+ cd logs && rm -f $cross_tools && cd ..
+
+clean-chapter4:
+ -umount \$(MOUNT_PT)/sys
+ -umount \$(MOUNT_PT)/proc
+ -umount \$(MOUNT_PT)/dev/shm
+ -umount \$(MOUNT_PT)/dev/pts
+ -umount \$(MOUNT_PT)/dev
+ rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
+ rm -f $temptools
+ cd logs && rm -f $temptools && cd ..
+
+
+restore-lfs-env:
+ @\$(call echo_message, Building)
+ @if [ -f /home/lfs/.bashrc.XXX ]; then \\
+ mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
+ fi;
+ @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
+ mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
+ fi;
+ @chown lfs:lfs /home/lfs/.bash* && \\
+ touch \$@
+
+EOF
+) >> $MKFILE
+fi
+
+
+if [[ "${METHOD}" = "boot" ]]; then
+(
+ cat << EOF
+
+all: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment \
+ $cross_tools \
+ $temptools \
+ $chroottools \
+ $boottools
+ @\$(call echo_boot_finished,$VERSION)
+
+makeboot: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment \
+ $cross_tools\
+ $temptools \
+ $chroottools \
+ $boottools
+ @\$(call echo_boot_finished,$VERSION)
+
+makesys: $testsuitetools $basicsystem $bootscripttools $bootabletools
+ @\$(call echo_finished,$VERSION)
+
+
+clean-all: clean
+ rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
+
+clean: clean-makesys clean-makeboot clean-jhalfs
+
+clean-jhalfs:
+ -if [ ! -f user-lfs-exist ]; then \\
+ userdel lfs; \\
+ rm -rf /home/lfs; \\
+ fi;
+ rm -rf \$(MOUNT_PT)/tools
+ rm -f /tools
+ rm -rf \$(MOUNT_PT)/cross-tools
+ rm -f /cross-tools
+ rm -f envars user-lfs-exist
+ rm -f 02* logs/02*.log
+
+clean-makeboot:
+ rm -rf /tools/*
+ rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
+ rm -f restore-lfs-env sources-dir
+ cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd ..
+
+clean-makesys:
+ -umount \$(MOUNT_PT)/sys
+ -umount \$(MOUNT_PT)/proc
+ -umount \$(MOUNT_PT)/dev/shm
+ -umount \$(MOUNT_PT)/dev/pts
+ -umount \$(MOUNT_PT)/dev
+ rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
+ rm -f $basicsystem
+ rm -f $bootscripttools
+ rm -f $bootabletools
+ cd logs && rm -f $basicsystem && rm -f $bootscripttools && rm -f $bootabletools && cd ..
+
+
+restore-lfs-env:
+ @\$(call echo_message, Building)
+ @if [ -f /home/lfs/.bashrc.XXX ]; then \\
+ mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
+ fi;
+ @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
+ mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
+ fi;
+ @chown lfs:lfs /home/lfs/.bash* && \\
+ touch \$@
+
+EOF
+) >> $MKFILE
+fi
+
+ # Bring over the items from the Makefile.tmp
+ cat $MKFILE.tmp >> $MKFILE
+ rm $MKFILE.tmp
+ echo "Creating Makefile... ${BOLD}DONE${OFF}"
+
+}
+
diff --git a/CLFS/packageslist.xsl b/CLFS/packageslist.xsl
new file mode 100644
index 0000000..0d8ccfb
--- /dev/null
+++ b/CLFS/packageslist.xsl
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CLFS/patcheslist.xsl b/CLFS/patcheslist.xsl
new file mode 100644
index 0000000..e5412e3
--- /dev/null
+++ b/CLFS/patcheslist.xsl
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HLFS/config b/HLFS/config
new file mode 100644
index 0000000..6b6d80a
--- /dev/null
+++ b/HLFS/config
@@ -0,0 +1,43 @@
+#####
+#
+# Configuration file for the HLFS module
+#
+# $Id$
+#
+#####
+declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/lfs/conglomeration
+
+#--- Which library model to use uclibc/glibc
+MODEL=glibc
+
+#--- The host system has grsecurity options enabled? 0(no)/1(yes)
+GRSECURITY_HOST=0
+
+#--- 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=
+
+#--- 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="patcheslist.xsl"
+
+#--- Default stylesheet
+XSL=hlfs.xsl
+
+#--- Book version
+LFSVRS=development
+
+#--- Name of the makefile
+MKFILE=$JHALFSDIR/Makefile
+
+#--- FTP/HTTP mirror used as fallback (full path)
+SERVER=ftp://anduin.linuxfromscratch.org/HLFS/conglomeration
diff --git a/HLFS/dump-hlfs-scripts.xsl b/HLFS/dump-hlfs-scripts.xsl
deleted file mode 100644
index c137965..0000000
--- a/HLFS/dump-hlfs-scripts.xsl
+++ /dev/null
@@ -1,230 +0,0 @@
-
-
- %general-entities;
-]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 00
-
-
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
- #!/tools/bin/bash
set -e
-
-
-
- #!/bin/sh
-
-
-
- #!/bin/sh
set -e
-
-
-
-
- cd $PKGDIR
-
- tar -xvf ../vim-&vim-version;-lang.* --strip-components=1
-
-
- pushd ../; tar -xvf gettext-&gettext-version;.*; popd;
-
-
- pushd ../; tar -xvf gettext-&gettext-version;.*; popd;
-
-
- tar -xvf ../glibc-libidn-&glibc-version;.*
-
-
- tar -xvf ../glibc-libidn-&glibc-version;.*
-
-
- pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd;
-
-
- pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd;
-
-
- pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd;
-
-
-
- exit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- make -k
-
- || true
-
-
-
-
-
-
-
-
- tar.*
-
-
-
-
-
-
- patch -Z
-
-
-
-
-
-
- make mrproper
- cp -v /sources/kernel-config .config
-
-
-
-
-
-
-
-
-
-
- make -k check || true
-
-
-
-
-
-
-
-
-
- || true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- || true
-
-
-
-
-
-
-
-
-
-
-
-
-
- $TIMEZONE
-
-
- $TIMEZONE
-
-
- $PAGE
-
-
- **EDITME
-
- EDITME**
-
-
-
-
-
-
diff --git a/HLFS/hlfs-functions b/HLFS/hlfs-functions
deleted file mode 100644
index b4683a0..0000000
--- a/HLFS/hlfs-functions
+++ /dev/null
@@ -1,59 +0,0 @@
-BOLD= "[0;1m"
-RED= "[1;31m"
-GREEN= "[0;32m"
-ORANGE= "[0;33m"
-BLUE= "[1;34m"
-WHITE= "[00m"
-
-define echo_message
- @echo $(BOLD)
- @echo --------------------------------------------------------------------------------
- @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)
- @echo --------------------------------------------------------------------------------$(WHITE)
-endef
-
-define unpack
- @if [ -f $(HLFS)$(SRC)/$(1).bz2 ] ; then \
- cd $(HLFS)$(SRC) ; tar -xvjf $(1).bz2 > /tmp/unpacked ; \
- else \
- cd $(HLFS)$(SRC) ; tar -xvzf $(1).gz > /tmp/unpacked ; \
- fi ;
-endef
-
-define unpack2
- @cd $(HLFS)$(SRC) ; /tools/bin/tar -xvf $(1) > /tmp/unpacked
-endef
-
-define echo_finished
- @echo $(BOLD)
- @echo --------------------------------------------------------------------------------
- @echo $(BOLD) Finished the build of $(BLUE)HLFS-$(1)$(BOLD)
- @echo --------------------------------------------------------------------------------
- @echo -e \\t\\t$(RED)W A R N I N G$(BOLD)
- @echo --------------------------------------------------------------------------------
- @echo
- @echo To be able to boot your new HLFS system you need to follow
- @echo the next steps:$(WHITE)
- @echo
- @echo -e \\t- Enter to the chroot using the command found
- @echo -e \\tin chapter06/revisedchroot.html
- @echo
- @echo -e \\t- Set a password for the root user
- @echo
- @echo -e \\t- Edit /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
- @echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network,
- @echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
- @echo -e \\tany other configuration file required to suit your needs.
- @echo
- @echo -e \\t- Set-up Grub. See chapter08/grub.html
- @echo
- @echo -e \\t- Unmount the filesystems.
- @echo
- @echo If you are an experienced HLFS user, several of those steps can be
- @echo skipped or done in a different way. But then, that is something
- @echo that you already know and there is no need to discuss it here.
- @echo $(BOLD)
- @echo --------------------------------------------------------------------------------
- @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
- @echo --------------------------------------------------------------------------------$(WHITE)
-endef
diff --git a/HLFS/hlfs-patcheslist_.xsl b/HLFS/hlfs-patcheslist_.xsl
deleted file mode 100644
index 025a9f9..0000000
--- a/HLFS/hlfs-patcheslist_.xsl
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/HLFS/hlfs.xsl b/HLFS/hlfs.xsl
new file mode 100644
index 0000000..3ed19a5
--- /dev/null
+++ b/HLFS/hlfs.xsl
@@ -0,0 +1,279 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 00
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ #!/tools/bin/bash
set -e
+
+
+ #!/bin/sh
+
+
+ #!/bin/sh
set -e
+
+
+
+ cd $PKGDIR
+
+ pushd ../; tar -xvf gettext-&gettext-version;.*; popd;
+
+
+ tar -xvf ../glibc-libidn-&glibc-version;.*
+
+
+ pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd;
+
+
+ pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd;
+
+
+ pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd;
+
+
+ pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd;
+
+
+
+ export HLFS=$LFS
+
+
+ exit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ make -k check || true
+
+
+
+ make -k
+
+ || true
+
+
+
+
+
+
+
+
+
+
+ tar.*
+
+
+
+
+
+
+ patch -Z
+
+
+
+
+
+
+
+
+ export LC_ALL=
+
+
export LANG=
+
+
export INPUTRC
+
+
+
+
+
+ make install
+ cd ../blfs-bootscripts-&blfs-bootscripts-version;
+
+
+
+
+
+ make mrproper
+ cp -v /sources/kernel-config .config
+
+
+
+
+
+ cd ../gettext-*/gettext-runtime
+
+
+
+
+
+
+
+
+
+ make -k check || true
+
+
+
+
+
+
+
+
+ make -k check || true
+
+
+
+
+
+
+
+ || true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ **EDITME
+
+ EDITME**
+
+
+
+
+
diff --git a/HLFS/jhahlfs b/HLFS/jhahlfs
deleted file mode 100755
index 3bb5403..0000000
--- a/HLFS/jhahlfs
+++ /dev/null
@@ -1,1426 +0,0 @@
-#!/bin/sh
-set -e # Enable error trapping
-set -u # Trap undefined variables.. Forces the programmer
- # to define a variable before using it
-
-#
-# Load the configuration file
-#
-source jhahlfs.conf
-
-# 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}${WHITE}==============================================================================${OFF}"
-declare -r SD_BORDER="${BOLD}${WHITE}------------------------------------------------------------------------------${OFF}"
-declare -r STAR_BORDER="${BOLD}${WHITE}******************************************************************************${OFF}"
-
-# bold yellow > < pair
-declare -r R_arrow=$'\e[1;33m>\e[0m'
-declare -r L_arrow=$'\e[1;33m<\e[0m'
-
-
-# START predefine some internal vars.. proper programming style
-
- # If the var BOOK contains something then, maybe, it points
- # to a working doc.. set WC=1, else 'null'
-WC=${BOOK:+1}
-
-CLEAN=0 # Clean out build dir?
-DL= # The download app to use
-PREV= # name of previous script processed
-chapter5=
-chapter6=
-chapter7=
-
-# END predefined vars section
-
-_inline_doc="
- This script, jhahlfs, strives to create an accurate makefile
- directly from the xml files used to generate the Hardened Linux From
- Scratch document.
- The usage of this script assumes you have read and are familiar with
- the book and therefore the configuration variables found in jhahlfs.conf
- will have meaning to you. There are a limited number of command line
- switches which, if used, will override the config file settings.
-
- NOTES::
- *. The resulting Makefile takes considerable time to run to completion,
- lay in a supply of caffeine beverages.
-
- *. The document, Hardened Linux From Scratch, specifies a Linux kernel
- >=2.6.2 and GCC >=3.0 for proper compilation.
-
- *. It is recommended that you temporarily unpack your linux kernel and
- run and configure the kernal as per the book and save
- the resulting .config file.
-
- *. Chapter07 contains numerous command files which require customizing
- before you start 129-console, 131-profile, 133-hosts, 134-network,
- 135-fstab, 136-kernel.
-"
-
-version="
-jhahlfs development \$Date$
-
-Written by George Boudreau
-
-Based on the jhalfs code written by Jeremy Huntwork and Manuel Canales Esparcia.
-
-This program is published under the ${WHITE}Gnu General Public License, Version 2.${OFF}
-"
-
-usage() {
- 'clear'
-cat <<- -EOF-
-${DD_BORDER}
-${BOLD}
- Usage: $0 ${BOLD}[OPTION]
-
-Options:
-${BOLD} -h, --help
-${OFF} print this help, then exit
-${BOLD} --readme
-${OFF} print a small readme file, then exit
-${BOLD} -V, --version
-${OFF} print version number, then exit
-${BOLD} -d --directory DIR
-${OFF} use DIR directory for building HLFS; all files jhahlfs produces will be
- in the directory DIR/jhahlfs. Default is \"/mnt/lfs\".
-${BOLD} --rebuild
-${OFF} clean the build directory before to perfom any other task. The directory
- is cleaned only if it was populated by a previous jhahlfs run.
-${BOLD} -P, --get-packages
-${OFF} download the packages and patches. This assumes that the server declared in the
- jhahlfs.conf file has the proper packages and patches for the book version being
- processed.
-${BOLD} -W, --working-copy DIR
-${OFF} use the local working copy placed in DIR as the HLFS book
-${BOLD} -L, --HLFS-version VER
-${OFF} checkout VER version of the HLFS book. Supported versions at this time are:
- dev* | trunk | SVN aliases for Development HLFS
-${BOLD} --fstab FILE
-${OFF} use FILE as the /etc/fstab file for the HLFS system. If not specified,
- a default /etc/fstab file with dummy values is created.
-${BOLD} -C, --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
-${DD_BORDER}
--EOF-
- exit
-}
-
-
-help="\
-Try '$0 --help' for more information."
-
-no_empty_builddir() {
- 'clear'
-cat <<- -EOF-
-${DD_BORDER}
-
-${tab_}${tab_}${RED}W A R N I N G${OFF}
-${GREEN}
- Looks like the \$BUILDDIR directory contains subdirectories
- from a previous HLFS build.
-
- Please format the partition mounted on \$BUILDDIR or set
- a different build directory before running jhahlfs.
-${OFF}
-${DD_BORDER}
--EOF-
- exit
-}
-
-exit_missing_arg="\
-echo \"Option '\$1' requires an argument\" >&2
-echo \"\$help\" >&2
-exit 1"
-
-no_dl_client="\
-echo \"Could not find a way to download the HLFS sources.\" >&2
-echo \"Attempting to continue.\" >&2"
-
-HEADER="# This file is automatically generated by jhahlfs
-# DO NOT EDIT THIS FILE MANUALLY
-#
-# Generated on `date \"+%F %X %Z\"`"
-
-#>>>>>>>>>>>>>>>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\t${BOLD}Goodbye and thank you for choosing ${YELLOW}JHAHLFS\n${OFF}"
-}
-##### 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
-#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-###################################
-### FUNCTIONS ###
-###################################
-
-#----------------------------#
-check_requirements() { # Simple routine to validate gcc and kernel versions against requirements
-#----------------------------#
- # Minimum values acceptable
- # 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 PARAM_LIST="BUILDDIR HPKG MODEL TEST TOOLCHAINTEST STRIP VIMLANG PAGE GRSECURITY_HOST RUNMAKE"
- local -r ERROR_MSG='${OFF}${RED}The variable \"${GREEN}${config_param}${RED}\" value ${BOLD}${YELLOW}--\>${WHITE}${!config_param}${YELLOW}\<--${OFF}${RED} is invalid, check the config file ${GREEN}\${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 "`eval echo ${ERROR_MSG}`" >&2
- echo -e "${DD_BORDER}\n"
- exit 1
- }
-
- set +e
-
- for config_param in $PARAM_LIST; do
- [[ $1 = "1" ]] && echo -e "`eval echo $PARAM_VALS`"
- case $config_param in
- BUILDDIR) # We cannot have an or > root mount point
- if [[ "xx x/x" =~ "x${!config_param}x" ]]; then
- write_error_and_die
- fi
- 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" ;;
- TOOLCHAINTEST) validation_str="x0x x1x" ;;
- GRSECURITY_HOST) validation_str="x0x x1x" ;;
-
- MODEL) validation_str="xglibcx xuclibcx" ;;
- PAGE) validation_str="xletterx xA4x" ;;
- *)
- 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
-
- 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 this is not a working copy, ie the default book, then skip
- [[ -z $WC ]] && continue
- [[ -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
-
- set -e
- echo "$tab_${BOLD}${YELLOW} Config parameters look good${OFF}${nl_}"
-}
-
-
-#----------------------------#
-build_patches_file() { # Supply a suitably formated list of patches.
-#----------------------------#
- local saveIFS=$IFS
-
- LOC_add_patches_entry() {
- for f in `grep "/$1-" patcheslist_.wget`; do
- basename $f | sed "s|${2}|\&${1}-version;|" >> patches
- done
- }
-
- xsltproc --nonet \
- --xinclude \
- -o patcheslist_.wget \
- hlfs-patcheslist_.xsl \
- $BOOK/index.xml > /dev/null 2>&1
-
- rm -f patches
-
- IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
- for f in `cat packages`; do
- IFS=$saveIFS
- LOC_add_patches_entry \
- `echo $f | sed -e 's/-version//' \
- -e 's/-file.*//' \
- -e 's/"//g' \
- -e 's/uclibc/uClibc/'`
- done
-
- # .... U G L Y .... what to do with the grsecurity patch to the kernel..
- for f in `grep "/grsecurity-" patcheslist_.wget`; do
- basename $f >> patches
- done
-
- IFS=$saveIFS
- rm -f patcheslist_.wget
-}
-
-
-#----------------------------#
-clean_builddir() { #
-#----------------------------#
- # Test if the clean must be done.
- if [ "$CLEAN" = "1" ] ; then
- # Test to make sure we're running the clean as root
- if [ "$UID" != "0" ] ; then
- echo "You must be logged in as root to clean the build directory."
- exit 1
- fi
- # Test to make sure that the build directory was populated by jhahlfs
- if [ ! -d $JHAHLFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
- echo "Looks like $BUILDDIR was not populated by a previous jhahlfs run."
- exit 1
- else
- # Clean the build directory
- echo -ne "Cleaning $BUILDDIR...\n"
- rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,usr,var}
- echo -ne "Cleaning $JHAHLFSDIR...\n"
- rm -rf $JHAHLFSDIR/{0*,1*,envars,sources-dir,commands,logs,Makefile,dump-hlfs-scripts.xsl,hlfs-functions,packages,patches}
- echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n"
- rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
- echo -ne "done\n"
- fi
- fi
-}
-
-#----------------------------#
-get_book() { #
-#----------------------------#
- cd $JHAHLFSDIR
-
- if [ -z $WC ] ; 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"
-
- echo -n "Downloading the HLFS Book, version $HLFSVRS... "
- # Grab a fresh HLFS book if it's missing, otherwise, update it from the
- # repo. If we've already extracted the commands, move on to getting the
- # sources.
- if [ -d hlfs-$HLFSVRS ] ; then
- cd hlfs-$HLFSVRS
- if LC_ALL=C svn up | grep -q At && \
- test -d $JHAHLFSDIR/commands && \
- test -f $JHAHLFSDIR/packages && \
- test -f $JHAHLFSDIR/patches ; then
- echo -ne "done\n"
- # Set the canonical book version
- cd $JHAHLFSDIR
- VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
- get_sources
- else
- echo -ne "${BOLD}done\n"
- extract_commands
- fi
- else
- case $HLFSVRS in
- development)
- svn co $SVN/HLFS/trunk/BOOK hlfs-$HLFSVRS >>$LOGDIR/$LOG 2>&1
- ;;
- *) echo -e "${RED}Invalid document version selected${OFF}"
- ;;
- esac
- echo -ne "${BOLD}done\n"
- extract_commands
- fi
- else
- echo -ne "Using $BOOK as book's sources ...\n"
- extract_commands
- fi
-}
-
-#----------------------------#
-extract_commands() { #
-#----------------------------#
- # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
- test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
- exit 1"
-
- cd $JHAHLFSDIR
- VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
-
- # Start clean
- if [ -d commands ]; then
- rm -rf commands
- mkdir -v commands
- fi
- echo -n "Extracting commands..."
-
- # Dump the commands in shell script form from the HLFS book.
- xsltproc --nonet \
- --xinclude \
- --stringparam model $MODEL \
- --stringparam testsuite $TEST \
- --stringparam toolchaintest $TOOLCHAINTEST \
- --stringparam vim-lang $VIMLANG \
- -o ./commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
-
- # Make the scripts executable.
- chmod -R +x $JHAHLFSDIR/commands
-
- # Grab the patches and package names.
- cd $JHAHLFSDIR
- for i in patches packages ; do rm -f $i ; done
- grep "\-version" $BOOK/general.ent | sed -e 's@@"@' \
- -e '/generic/d' >> packages
-
- # Download the vim-lang package if it must be installed
- if [ "$VIMLANG" = "1" ] ; then
- echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages
- fi
- echo `grep "udev-config-file" $BOOK/general.ent | sed -e 's@@"@'` >> packages
-
- # There is no HLFS patches.ent file so we will create one.
- build_patches_file
-
- # Done. Moving on...
- echo -ne "${BOLD}done\n"
- get_sources
-}
-
-#----------------------------#
-download() { # Download file, write name to MISSING_FILES.DMP if an error
-#----------------------------#
- cd $BUILDDIR/sources
-
- # Hackish fix for the bash-doc, glibc-{linuxthreads,libidn} and
- # module-init-tools-testsuite packages that don't conform to
- # norms in the URL scheme.
- DIR=`echo $1 | sed 's@-doc@@;s@-linuxthreads@@;s@-libidn@@;s@-testsuite@@'`
-
- # Find the md5 sum for this package.
- if [ $2 != MD5SUMS ] ; then
- set +e
- MD5=`grep " $2" MD5SUMS`
- if [ $? -ne 0 ]; then
- set -e
- echo "${RED}$2 not found in MD5SUMS${OFF}"
- echo "$2 not found in MD5SUMS" >> MISSING_FILES.DMP
- return
- fi
- set -e
- fi
-
- if [ ! -f $2 ] ; then
- case $DL in
- wget ) wget --passive $FTP/$DIR/$2 ;;
- curl ) `curl -# $FTP/$DIR/$2 -o $2` ;;
- * ) echo "$DL not supported at this time." ;;
- esac
- elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
- case $DL in
- wget ) wget --passive -c $FTP/$DIR/$2 ;;
- curl ) `curl -# -C - $FTP/$DIR/$2 -o $2` ;;
- * ) echo "$DL not supported at this time." ;;
- esac
- fi
-
- if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then
- exit 1
- fi
- if [ $2 != MD5SUMS ] ; then
- echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION
- fi
-}
-
-
-#----------------------------#
-get_sources() { #
-#----------------------------#
- local IFS
-
- # Test if the packages must be downloaded
- if [ ! "$HPKG" = "1" ] ; then
- return
- fi
-
- # Modify the 'internal field separator' to break on 'LF' only
- IFS=$'\x0A'
-
- if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
- cd $BUILDDIR/sources
-
- > MISSING_FILES.DMP # Files not in md5sum end up here
-
- if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
- if [ -f MD5SUMS-$VERSION ] ; then rm MD5SUMS-$VERSION ; fi
-
- # Retrieve the master md5sum file
- download "" MD5SUMS
-
- # Iterate through each package and grab it, along with any patches it needs.
- for i in `cat $JHAHLFSDIR/packages` ; do
- PKG=`echo $i | sed -e 's/-version.*//' \
- -e 's/-file.*//' \
- -e 's/uclibc/uClibc/' `
-
- # Needed for Groff patchlevel patch on UTF-8 branch
- GROFFLEVEL=`grep "groff-patchlevel" $JHAHLFSDIR/packages | sed -e 's/groff-patchlevel //' -e 's/"//g'`
-
- #
- # How to deal with orphan packages..??
- #
- VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
- case "$PKG" in
- "expect-lib" ) continue ;; # not valid packages
- "linux-dl" ) continue ;;
- "groff-patchlevel" ) continue ;;
- "uClibc-patch" ) continue ;;
-
- "tcl" ) FILE="$PKG$VRS-src.tar.bz2" ; download $PKG $FILE ;;
- "vim-lang" ) FILE="vim-$VRS-lang.tar.bz2"; PKG="vim" ; download $PKG $FILE ;;
- "udev-config" ) FILE="$VRS" ; PKG="udev" ; download $PKG $FILE ;;
-
- "uClibc-locale" ) FILE="$PKG-$VRS.tar.bz2" ; PKG="uClibc"
- download $PKG $FILE
- # There can be no patches for this file
- continue ;;
-
- "gcc" ) download $PKG "gcc-core-$VRS.tar.bz2"
- download $PKG "gcc-g++-$VRS.tar.bz2"
- ;;
- "glibc") download $PKG "$PKG-$VRS.tar.bz2"
- download $PKG "$PKG-libidn-$VRS.tar.bz2"
- ;;
- * ) FILE="$PKG-$VRS.tar.bz2"
- download $PKG $FILE
- ;;
- esac
-
- for patch in `grep "$PKG-&$PKG" $JHAHLFSDIR/patches` ; do
- PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
- download $PKG $PATCH
- done
-
- done
-
- # .... U G L Y .... what to do with the grsecurity patch to the kernel..
- download grsecurity `grep grsecurity $JHAHLFSDIR/patches`
-
- # .... U G L Y .... deal with uClibc-locale-xxxxx.tar.bz2 format issue.
- bzcat uClibc-locale-030818.tar.bz2 | gzip > uClibc-locale-030818.tgz
-
- if [[ -s $BUILDDIR/sources/MISSING_FILES.DMP ]]; then
- echo -e "\n\n${tab_}${RED} One or more files were not retrieved.\n${tab_} Check for names ${OFF}\n\n"
- fi
-}
-
-
-#----------------------------#
-_IS_() { # Function to test build scripts names
-#----------------------------#
- # Returns substr $2 or null str
- # Must use string testing
- case $1 in
- *$2*) echo "$2" ;;
- *) echo "" ;;
- esac
-}
-
-#----------------------------#
-chapter4_Makefiles() { # Initialization of the system
-#----------------------------#
- local TARGET LOADER
-
- echo " Processing Chapter-4 scripts "
-
- # Define a few model dependant variables
- if [[ ${MODEL} = "uclibc" ]]; then
- TARGET="tools-linux-uclibc"; LOADER="ld-uClibc.so.0"
- else
- TARGET="tools-linux-gnu"; LOADER="ld-linux.so.2"
- fi
-
- # 022-
- # If /home/hlfs is already present in the host, we asume that the
- # hlfs user and group are also presents in the host, and a backup
- # of their bash init files is made.
-(
-cat << EOF
-020-creatingtoolsdir:
- @\$(call echo_message, Building)
- @mkdir -v \$(HLFS)/tools && \\
- rm -fv /tools && \\
- ln -sv \$(HLFS)/tools /
- @if [ ! -d \$(HLFS)/sources ]; then \\
- mkdir \$(HLFS)/sources; \\
- fi;
- @chmod a+wt \$(HLFS)/sources && \\
- touch \$@
-
-021-addinguser: 020-creatingtoolsdir
- @\$(call echo_message, Building)
- @if [ ! -d /home/hlfs ]; then \\
- groupadd hlfs; \\
- useradd -s /bin/bash -g hlfs -m -k /dev/null hlfs; \\
- else \\
- touch user-hlfs-exist; \\
- fi;
- @chown hlfs \$(HLFS)/tools && \\
- chown hlfs \$(HLFS)/sources && \\
- touch \$@
-
-022-settingenvironment: 021-addinguser
- @\$(call echo_message, Building)
- @if [ -f /home/hlfs/.bashrc -a ! -f /home/hlfs/.bashrc.XXX ]; then \\
- mv -v /home/hlfs/.bashrc /home/hlfs/.bashrc.XXX; \\
- fi;
- @if [ -f /home/hlfs/.bash_profile -a ! -f /home/hlfs/.bash_profile.XXX ]; then \\
- mv -v /home/hlfs/.bash_profile /home/hlfs/.bash_profile.XXX; \\
- fi;
- @echo "set +h" > /home/hlfs/.bashrc && \\
- echo "umask 022" >> /home/hlfs/.bashrc && \\
- echo "HLFS=\$(HLFS)" >> /home/hlfs/.bashrc && \\
- echo "LC_ALL=POSIX" >> /home/hlfs/.bashrc && \\
- echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/hlfs/.bashrc && \\
- echo "export HLFS LC_ALL PATH" >> /home/hlfs/.bashrc && \\
- echo "" >> /home/hlfs/.bashrc && \\
- echo "target=$(uname -m)-${TARGET}" >> /home/hlfs/.bashrc && \\
- echo "ldso=/tools/lib/${LOADER}" >> /home/hlfs/.bashrc && \\
- echo "export target ldso" >> /home/hlfs/.bashrc && \\
- echo "source $JHAHLFSDIR/envars" >> /home/hlfs/.bashrc && \\
- chown hlfs:hlfs /home/hlfs/.bashrc && \\
- touch envars && \\
- touch \$@
-EOF
-) >> $MKFILE.tmp
-
-}
-
-#----------------------------#
-chapter5_Makefiles() { # Bootstrap or temptools phase
-#----------------------------#
-
- echo " Processing Chapter-5 scripts"
-
- for file in chapter05/* ; do
- # Keep the script file name
- this_script=`basename $file`
-
- # Skip this script depending on jhahlfs.conf flags set.
- case $this_script in
- # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
- *tcl* ) [[ "$TOOLCHAINTEST" = "0" ]] && continue; ;;
- *expect* ) [[ "$TOOLCHAINTEST" = "0" ]] && continue; ;;
- *dejagnu* ) [[ "$TOOLCHAINTEST" = "0" ]] && continue; ;;
- # Test if the stripping phase must be skipped
- *stripping* ) [[ "$STRIP" = "0" ]] && continue ;;
- # Select the appropriate library
- *glibc*) [[ ${MODEL} = "uclibc" ]] && continue ;;
- *uclibc*) [[ ${MODEL} = "glibc" ]] && continue ;;
- *) ;;
- esac
-
- # First append each name of the script files to a list (this will become
- # the names of the targets in the Makefile
- chapter5="$chapter5 $this_script"
-
- # Grab the name of the target (minus the -headers or -cross in the case of gcc
- # and binutils in chapter 5)
- name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-cross@@' -e 's@-headers@@'`
-
- # >>>>>>>>>> U G L Y <<<<<<<<<
- # Adjust 'name' and patch a few scripts on the fly..
- case $name in
- linux-libc) name=linux-libc-headers
- ;;
- uclibc) # this sucks as method to deal with gettext/libint inside uClibc
- sed 's@^cd gettext-runtime@cd ../gettext-*/gettext-runtime@' -i chapter05/$this_script
- ;;
- gcc) # to compensate for the compiler test inside gcc (which fails), disable error trap
- sed 's@^gcc -o test test.c@set +e; gcc -o test test.c@' -i chapter05/$this_script
- ;;
- esac
-
- # Set the dependency for the first target.
- if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
-
-
- #--------------------------------------------------------------------#
- # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
- #--------------------------------------------------------------------#
- #
- # Drop in the name of the target on a new line, and the previous target
- # as a dependency. Also call the echo_message function.
- echo -e "\n$this_script: $PREV
- @\$(call echo_message, Building)" >> $MKFILE.tmp
-
- # Find the version of the command files, if it corresponds with the building of
- # a specific package
- vrs=`grep "^$name-version" $JHAHLFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
- # If $vrs isn't empty, we've got a package...
- if [ "$vrs" != "" ] ; then
- # Deal with non-standard names
- case $name in
- tcl) FILE="$name$vrs-src.tar" ;;
- uclibc) FILE="uClibc-$vrs.tar" ;;
- gcc) FILE=gcc-core-$vrs.tar ;;
- *) FILE="$name-$vrs.tar" ;;
- esac
- # Insert instructions for unpacking the package and to set the PKGDIR variable.
-(
-cat << EOF
- @\$(call unpack,$FILE)
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- chown -R hlfs \$(HLFS)\$(SRC)/\$\$ROOT && \\
- echo "export PKGDIR=\$(HLFS)\$(SRC)/\$\$ROOT" > envars && \\
-EOF
-) >> $MKFILE.tmp
- fi
-
- case $this_script in
- *binutils* ) # Dump the path to sources directory for later removal
- echo -e '\techo "$(HLFS)$(SRC)/$$ROOT" >> sources-dir' >> $MKFILE.tmp
- ;;
- *adjusting* ) # For the Adjusting phase we must to cd to the binutils-build directory.
- echo -e '\t@echo "export PKGDIR=$(HLFS)$(SRC)/binutils-build" > envars' >> $MKFILE.tmp
- ;;
- * ) # Everything else, add a true statment so we don't confuse make
- echo -e '\ttrue' >> $MKFILE.tmp
- ;;
- esac
-
- # Insert date and disk usage at the top of the log file, the script run
- # and date and disk usage again at the bottom of the log file.
-(
-cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(HLFS)\`\n" >logs/$this_script && \\
- su - hlfs -c "source /home/hlfs/.bashrc && $JHAHLFSDIR/commands/$file" >>logs/$this_script 2>&1 && \\
- echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(HLFS)\`\n" >>logs/$this_script
-EOF
-) >> $MKFILE.tmp
-
- # Remove the build directory(ies) except if the package build fails
- # (so we can review config.cache, config.log, etc.)
- # For Binutils the sources must be retained for some time.
- if [ "$vrs" != "" ] ; then
- if [[ ! `_IS_ $this_script binutils` ]]; then
-(
-cat << EOF
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- rm -r \$(HLFS)\$(SRC)/\$\$ROOT && \\
- if [ -e \$(HLFS)\$(SRC)/$name-build ]; then \\
- rm -r \$(HLFS)\$(SRC)/$name-build; \\
- fi;
-EOF
-) >> $MKFILE.tmp
- fi
- fi
-
- # Remove the Binutils pass 1 sources after a successful Adjusting phase.
- if [[ `_IS_ $this_script adjusting` ]] ; then
-(
-cat << EOF
- @rm -r \`cat sources-dir\` && \\
- rm -r \$(HLFS)\$(SRC)/binutils-build && \\
- rm sources-dir
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Include a touch of the target name so make can check if it's already been made.
- echo -e '\t@touch $@' >> $MKFILE.tmp
- #
- #--------------------------------------------------------------------#
- # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
- #--------------------------------------------------------------------#
-
- # Keep the script file name for Makefile dependencies.
- PREV=$this_script
- done # end for file in chapter05/*
-}
-
-
-#----------------------------#
-chapter6_Makefiles() { # sysroot or chroot build phase
-#----------------------------#
- local TARGET LOADER
-
- #
- # Set these definitions early and only once
- #
- if [[ ${MODEL} = "uclibc" ]]; then
- TARGET="pc-linux-uclibc"; LOADER="ld-uClibc.so.0"
- else
- TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
- fi
-
- echo -e " Processing Chapter-6 scripts "
- for file in chapter06/* ; do
- # Keep the script file name
- this_script=`basename $file`
-
- # Skip this script depending on jhahlfs.conf flags set.
- case $this_script in
- # We'll run the chroot commands differently than the others, so skip them in the
- # dependencies and target creation.
- *chroot* ) continue ;;
- # Test if the stripping phase must be skipped
- *-stripping* ) [[ "$STRIP" = "0" ]] && continue ;;
- # Select the appropriate library
- *glibc*) [[ ${MODEL} = "uclibc" ]] && continue ;;
- *uclibc*) [[ ${MODEL} = "glibc" ]] && continue ;;
- *) ;;
- esac
-
- # First append each name of the script files to a list (this will become
- # the names of the targets in the Makefile
- chapter6="$chapter6 $this_script"
-
- # Grab the name of the target
- name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
-
- #
- # Sed replacement for 'nodump' tag in xml scripts until Manuel has a chance to fix them
- #
- case $name in
- kernfs) # Remove sysctl code if host does not have grsecurity enabled
- if [[ "$GRSECURITY_HOST" = "0" ]]; then
- sed '/sysctl/d' -i chapter06/$this_script
- fi
- ;;
- module-init-tools)
- if [[ "$TEST" = "0" ]]; then # This needs rework....
- sed '/make distclean/d' -i chapter06/$this_script
- fi
- ;;
- glibc) # PATCH.. Turn off error trapping for the remainder of the script.
- sed 's|^make install|make install; set +e|' -i chapter06/$this_script
- ;;
- uclibc) # PATCH..
- sed 's/EST5EDT/${TIMEZONE}/' -i chapter06/$this_script
- # PATCH.. Cannot use interactive programs/scripts.
- sed 's/make menuconfig/make oldconfig/' -i chapter06/$this_script
- sed 's@^cd gettext-runtime@cd ../gettext-*/gettext-runtime@' -i chapter06/$this_script
- ;;
- gcc) # PATCH..
- sed 's/rm /rm -f /' -i chapter06/$this_script
- ;;
- esac
-
- #--------------------------------------------------------------------#
- # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
- #--------------------------------------------------------------------#
- #
- # Drop in the name of the target on a new line, and the previous target
- # as a dependency. Also call the echo_message function.
- echo -e "\n$this_script: $PREV
- @\$(call echo_message, Building)" >> $MKFILE.tmp
-
- # Find the version of the command files, if it corresponds with the building of
- # a specific package
- vrs=`grep "^$name-version" $JHAHLFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
- # If $vrs isn't empty, we've got a package...
- # Insert instructions for unpacking the package and changing directories
- if [ "$vrs" != "" ] ; then
- # Deal with non-standard names
- case $name in
- tcl) FILE="$name$vrs-src.tar.*" ;;
- uclibc) FILE="uClibc-$vrs.tar.*" ;;
- gcc) FILE="gcc-core-$vrs.tar.*" ;;
- *) FILE="$name-$vrs.tar.*" ;;
- esac
-(
-cat << EOF
- @\$(call unpack2,$FILE)
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
- echo "export target=$(uname -m)-${TARGET}" >> envars && \\
- echo "export ldso=/lib/${LOADER}" >> envars
-EOF
-) >> $MKFILE.tmp
- fi
-
- case $this_script in
- *readjusting*) # For the Re-Adjusting phase we must to cd to the binutils-build directory.
- echo -e '\t@echo "export PKGDIR=$(SRC)/binutils-build" > envars' >> $MKFILE.tmp
- ;;
- *glibc* | *uclibc* ) # For glibc and uClibc we need to set TIMEZONE envar.
- echo -e '\t@echo "export TIMEZONE=$(TIMEZONE)" >> envars' >> $MKFILE.tmp
- ;;
- *groff* ) # For Groff we need to set PAGE envar.
- echo -e '\t@echo "export PAGE=$(PAGE)" >> envars' >> $MKFILE.tmp
- ;;
- esac
-
-
- # In the mount of kernel filesystems we need to set HLFS and not to use chroot.
- if [[ `_IS_ $this_script kernfs` ]] ; then
-(
-cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(HLFS)\`\n" >logs/$this_script && \\
- export HLFS=\$(HLFS) && commands/$file >>logs/$this_script 2>&1 && \\
- echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(HLFS)\`\n" >>logs/$this_script
-EOF
-) >> $MKFILE.tmp
-
- # The rest of Chapter06
- else
-(
-cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(HLFS)\`\n" >logs/$this_script && \\
- \$(CHROOT1) 'cd /jhahlfs && source envars && /jhahlfs/commands/$file >>/jhahlfs/logs/$this_script 2>&1' && \\
- echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(HLFS)\`\n" >>logs/$this_script
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Remove the build directory(ies) except if the package build fails.
- if [ "$vrs" != "" ] ; then
-(
-cat << EOF
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- rm -r \$(HLFS)\$(SRC)/\$\$ROOT && \\
- if [ -e \$(HLFS)\$(SRC)/$name-build ]; then \\
- rm -r \$(HLFS)\$(SRC)/$name-build; \\
- fi;
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Remove the Binutils pass 2 sources after a successful Re-Adjusting phase.
- if [[ `_IS_ $this_script readjusting` ]] ; then
-(
-cat << EOF
- @rm -r \`cat sources-dir\` && \\
- rm -r \$(HLFS)\$(SRC)/binutils-build && \\
- rm sources-dir
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Include a touch of the target name so make can check if it's already been made.
- echo -e '\t@touch $@' >> $MKFILE.tmp
- #
- #--------------------------------------------------------------------#
- # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
- #--------------------------------------------------------------------#
-
- # Keep the script file name for Makefile dependencies.
- PREV=$this_script
- done # end for file in chapter06/*
-
-}
-
-#----------------------------#
-chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..etc
-#----------------------------#
-
- echo " Processing Chapter-7 scripts "
- for file in chapter07/*; do
- # Keep the script file name
- this_script=`basename $file`
-
- # Grub must be configured manually.
- # The filesystems can't be unmounted via Makefile and the user
- # should enter the chroot environment to create the root
- # password, edit several files and setup Grub.
- case $this_script in
- *grub) continue ;;
- *reboot) continue ;;
- *console) continue ;; # Use the file generated by lfs-bootscripts
-
- *kernel) # How does Manuel add this string to the file..
- sed 's|cd \$PKGDIR.*||' -i chapter07/$this_script
- # You cannot run menuconfig from within the makefile
- sed 's|make menuconfig|make oldconfig|' -i chapter07/$this_script
- # The files in the conglomeration dir are xxx.bz2
- sed 's|.patch.gz|.patch.bz2|' -i chapter07/$this_script
- sed 's|gunzip|bunzip2|' -i chapter07/$this_script
- # If defined include the keymap in the kernel
- if [[ -n "$KEYMAP" ]]; then
- sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i chapter07/$this_script
- else
- sed '/loadkeys -m/d' -i chapter07/$this_script
- sed '/drivers\/char/d' -i chapter07/$this_script
- fi
- # If no .config file is supplied, the kernel build is skipped
- [[ -z $CONFIG ]] && continue
- ;;
- *usage) # The script bombs, disable error trapping
- sed 's|set -e|set +e|' -i chapter07/$this_script
- ;;
- *profile) # Add the config values to the script
- sed "s|LC_ALL=\*\*EDITME.*EDITME\*\*|LC_ALL=$LC_ALL|" -i chapter07/$this_script
- sed "s|LANG=\*\*EDITME.*EDITME\*\*|LANG=$LANG|" -i chapter07/$this_script
- ;;
- esac
-
- # First append then name of the script file to a list (this will become
- # the names of the targets in the Makefile
- chapter7="$chapter7 $this_script"
-
- #--------------------------------------------------------------------#
- # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
- #--------------------------------------------------------------------#
- #
- # Drop in the name of the target on a new line, and the previous target
- # as a dependency. Also call the echo_message function.
- echo -e "\n$this_script: $PREV
- @\$(call echo_message, Building)" >> $MKFILE.tmp
-
- if [[ `_IS_ $this_script bootscripts` ]] ; then
- vrs=`grep "^lfs-bootscripts-version" $JHAHLFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
- FILE="lfs-bootscripts-$vrs.tar.*"
- # The bootscript pkg references both lfs AND blfs bootscripts...
- # see XML script for other additions to bootscripts file
- # PATCH
- vrs=`grep "^blfs-bootscripts-version" $JHAHLFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
- sed "s|make install$|make install; cd ../blfs-bootscripts-$vrs|" -i chapter07/$this_script
-(
-cat << EOF
- @\$(call unpack2,$FILE)
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
- echo "\$(HLFS)\$(SRC)/blfs-bootscripts-$vrs" > sources-dir
-EOF
-) >> $MKFILE.tmp
- fi
-
- if [[ `_IS_ $this_script kernel` ]] ; then
- # not much really, script does everything..
- echo -e "\t@cp -f $CONFIG \$(HLFS)/sources/kernel-config" >> $MKFILE.tmp
- fi
-
- # Check if we have a real /etc/fstab file
- if [[ `_IS_ $this_script fstab` ]] && [[ -n "$FSTAB" ]] ; then
-(
-cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(HLFS)\`\n" >logs/$this_script && \\
- cp -v $FSTAB \$(HLFS)/etc/fstab >>logs/$this_script 2>&1 && \\
- echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(HLFS)\`\n" >>logs/$this_script
-EOF
-) >> $MKFILE.tmp
- else
- # Initialize the log and run the script
-(
-cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(HLFS)\`\n" >logs/$this_script && \\
- \$(CHROOT2) 'cd /jhahlfs && source envars && /jhahlfs/commands/$file >>/jhahlfs/logs/$this_script 2>&1' && \\
- echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(HLFS)\`\n" >>logs/$this_script
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Remove the build directory except if the package build fails.
- if [[ `_IS_ $this_script bootscripts` ]]; then
-(
-cat << EOF
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- rm -r \$(HLFS)\$(SRC)/\$\$ROOT
- @rm -r \`cat sources-dir\` && \\
- rm sources-dir
-
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Include a touch of the target name so make can check if it's already been made.
- echo -e '\t@touch $@' >> $MKFILE.tmp
- #
- #--------------------------------------------------------------------#
- # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
- #--------------------------------------------------------------------#
-
- # Keep the script file name for Makefile dependencies.
- PREV=$this_script
- done # for file in chapter07/*
-}
-
-
-#----------------------------#
-build_Makefile() { # Construct a Makefile from the book scripts
-#----------------------------#
- echo -e "Creating Makefile... "
-
- cd $JHAHLFSDIR/commands
- # Start with a clean Makefile.tmp file
- >$MKFILE.tmp
-
- chapter4_Makefiles
- chapter5_Makefiles
- chapter6_Makefiles
- chapter7_Makefiles
-
- # Add a header, some variables and include the function file
- # to the top of the real Makefile.
-(
- cat << EOF
-$HEADER
-
-SRC= /sources
-HLFS= $BUILDDIR
-PAGE= $PAGE
-TIMEZONE= $TIMEZONE
-
-include hlfs-functions
-
-EOF
-) > $MKFILE
-
-
- # Add chroot commands
- i=1
- for file in chapter06/*chroot* ; do
- chroot=`cat $file | sed -e '/#!\/bin\/sh/d' \
- -e '/^export/d' \
- -e '/^logout/d' \
- -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
- -e 's|\\$|&&|g' \
- -e 's|exit||g' \
- -e 's|$| -c|' \
- -e 's|"$$HLFS"|$(HLFS)|'\
- -e 's|set -e||'`
- echo -e "CHROOT$i= $chroot\n" >> $MKFILE
- i=`expr $i + 1`
- done
-
- # Drop in the main target 'all:' and the chapter targets with each sub-target
- # as a dependency.
-(
- cat << EOF
-all: chapter4 chapter5 chapter6 chapter7
- @\$(call echo_finished,$VERSION)
-
-chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
-
-chapter5: chapter4 $chapter5 restore-hlfs-env
-
-chapter6: chapter5 $chapter6
-
-chapter7: chapter6 $chapter7
-
-clean-all: clean
- rm -rf ./{commands,logs,Makefile,dump-hlfs-scripts.xsl,functions,packages,patches}
-
-clean: clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter4
-
-clean-chapter4:
- -if [ ! -f user-hlfs-exist ]; then \\
- userdel hlfs; \\
- rm -rf /home/hlfs; \\
- fi;
- rm -rf \$(HLFS)/tools
- rm -f /tools
- rm -f envars user-hlfs-exist
- rm -f 02* logs/02*.log
-
-clean-chapter5:
- rm -rf \$(HLFS)/tools/*
- rm -f $chapter5 restore-hlfs-env sources-dir
- cd logs && rm -f $chapter5 && cd ..
-
-clean-chapter6:
- -umount \$(HLFS)/sys
- -umount \$(HLFS)/proc
- -umount \$(HLFS)/dev/shm
- -umount \$(HLFS)/dev/pts
- -umount \$(HLFS)/dev
- rm -rf \$(HLFS)/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
- rm -f $chapter6
- cd logs && rm -f $chapter6 && cd ..
-
-clean-chapter7:
- rm -f $chapter7
- cd logs && rm -f $chapter7 && cd ..
-
-restore-hlfs-env:
- @\$(call echo_message, Building)
- @if [ -f /home/hlfs/.bashrc.XXX ]; then \\
- mv -fv /home/hlfs/.bashrc.XXX /home/hlfs/.bashrc; \\
- fi;
- @if [ -f /home/hlfs/.bash_profile.XXX ]; then \\
- mv -v /home/hlfs/.bash_profile.XXX /home/hlfs/.bash_profile; \\
- fi;
- @chown hlfs:hlfs /home/hlfs/.bash* && \\
- touch \$@
-
-EOF
-) >> $MKFILE
-
- # Bring over the items from the Makefile.tmp
- cat $MKFILE.tmp >> $MKFILE
- rm $MKFILE.tmp
- echo -ne "${BOLD}done\n${OFF}"
-}
-
-#----------------------------#
-run_make() { # Execute the newly constructed Makefile
-#----------------------------#
- # Test if make must be run.
- if [ "$RUNMAKE" = "1" ] ; then
- # Test to make sure we're running the build as root
- if [ "$UID" != "0" ] ; then
- echo "You must be logged in as root to successfully build HLFS."
- exit 1
- fi
- # Build the system
- if [ -e $MKFILE ] ; then
- echo -ne "Building the HLFS system...\n"
- cd $JHAHLFSDIR && make
- echo -ne "done\n"
- fi
- fi
-}
-
-
-
-###################################
-### MAIN ###
-###################################
-
-# Evaluate any command line switches
-
-while test $# -gt 0 ; do
- case $1 in
- --version | -V ) 'clear'; echo "$version" ; exit 0; ;;
- --help | -h ) usage | less
- 'clear' ; exit 0
- ;;
-
- --HLFS-version | -L )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- case $1 in
- dev* | SVN | trunk )
- BOOK="" # necessary to overide any value set inside jhahlfs.conf
- WC=
- HLFSVRS=development
- ;;
- * )
- echo "$1 is an unsupported version at this time."
- exit 1
- ;;
- esac
- ;;
-
- --directory | -d )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- BUILDDIR=$1
- JHAHLFSDIR=$BUILDDIR/jhahlfs
- LOGDIR=$JHAHLFSDIR/logs
- MKFILE=$JHAHLFSDIR/Makefile
- ;;
-
- --working-copy | -W )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- if [ -f $1/patches.ent ] ; then
- WC=1
- BOOK=$1
- else
- echo -e "\nLook like $1 isn't a supported working copy."
- echo -e "Verify your selection and the command line.\n"
- exit 1
- fi
- ;;
-
- --get-packages | -P ) HPKG=1 ;;
- --run-make | -M ) RUNMAKE=1 ;;
- --rebuild ) CLEAN=1 ;;
-
- --readme )
- 'clear'
- echo "$_inline_doc" | less
- 'clear'; exit
- ;;
-
- --fstab )
- 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 | -C )
- 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
- ;;
- * )
- echo "$usage"
- exit 1
- ;;
- esac
- shift
-done
-
-# Prevents setting "-d /" by mistake.
-if [ $BUILDDIR = / ] ; then
- echo -ne "\nThe root directory can't be used to build HLFS.\n\n"
- exit 1
-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
- no_empty_builddir
-fi
-
-# If requested, clean the build directory
-clean_builddir
-
-# Find the download client to use, if not already specified.
-if [ -z $DL ] ; then
- if [ `type -p wget` ] ; then
- DL=wget
- elif [ `type -p curl` ] ; then
- DL=curl
- else
- eval "$no_dl_client"
- fi
-fi
-
-# Set the document location..
-# if set by conf file leave it alone otherwise load the specified version
-BOOK=${BOOK:=hlfs-$HLFSVRS}
-
-[[ ! -d $JHAHLFSDIR ]] && mkdir -pv $JHAHLFSDIR
-[[ ! -d $LOGDIR ]] && mkdir -v $LOGDIR
-if [[ "$PWD" != "$JHAHLFSDIR" ]]; then
- cp -v $FILES $JHAHLFSDIR/
- sed 's,FAKEDIR,'$BOOK',' $XSL > $JHAHLFSDIR/dump-hlfs-scripts.xsl
- export XSL=$JHAHLFSDIR/dump-hlfs-scripts.xsl
-fi
-
->$LOGDIR/$LOG
-
-
-# Check for minumum gcc and kernel versions
-check_requirements 1 # 0/1 0-do not display values.
-validate_config 1 # 0/1 0-do not display values
-get_book
-build_Makefile
-run_make
diff --git a/HLFS/jhahlfs.conf b/HLFS/jhahlfs.conf
deleted file mode 100644
index 0998509..0000000
--- a/HLFS/jhahlfs.conf
+++ /dev/null
@@ -1,82 +0,0 @@
-#####
-#
-# Configuration file for the jhahlfs build script
-#
-#####
-
-declare -r SVN="svn://svn.linuxfromscratch.org"
-declare -r FTP=http://ftp.linuxfromscratch.org/pub/lfs/conglomeration
-declare -r LOG=000-jhahlfs.log
-
-#--- Mount point for the build
-BUILDDIR=/mnt/hlfs
-
-#--- Download the source packages 0(no)/1(yes)
-HPKG=0
-
-#--- Run the makefile at the end 0(no)/1(yes)
-RUNMAKE=0
-
-#--- Run test suites 0(no)/1(yes)
-TEST=0
-
-#--- Run the toolchain tests 0(no)/1(yes)
-TOOLCHAINTEST=0
-
-#--- Run the stripping phases 0(no)/1(yes)
-STRIP=1
-
-#--- page definition for groff letter/A4
-PAGE=letter
-
-#--- set default timezone.
-TIMEZONE=America/Toronto
-
-#--- install the optional vim-lang package 0(no)/1(yes)
-VIMLANG=0
-
-#--- Location of fstab file (if empty, a template is created)
-FSTAB=
-
-#--- Location of kernel config file (if the kernel is to be compiled)
-CONFIG=
-
-#--- Which library model to use uclibc/glibc
-MODEL=glibc
-
-#--- The host system has grsecurity options enabled 0(no)/1(yes)
-GRSECURITY_HOST=0
-
-#--- Language information, /etc/profile see for values
-LC_ALL=en_CA
-LANG=en_CA
-
-#--- Include the keymap in the kernel if defined
-KEYMAP=/usr/share/kbd/keymaps/i386/qwerty/us.map.gz
-
-#--- 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
-
-#--- Default stylesheet
-XSL=dump-hlfs-scripts.xsl
-
-#--- Files that will be copied to $JHAHLFSDIR
-FILES="hlfs-functions dump-hlfs-scripts.xsl hlfs-patcheslist_.xsl"
-
-#--- Working directories
-JHAHLFSDIR=$BUILDDIR/jhahlfs
- LOGDIR=$JHAHLFSDIR/logs
- MKFILE=$JHAHLFSDIR/Makefile
-
-#--- FTP/HTTP mirror used as fallback (full path)
-SERVER=ftp://anduin.linuxfromscratch.org/LFS/conglomeration
-
-#--- Book version
-HLFSVRS=development
-
-
-
diff --git a/HLFS/master.sh b/HLFS/master.sh
new file mode 100755
index 0000000..a105a41
--- /dev/null
+++ b/HLFS/master.sh
@@ -0,0 +1,616 @@
+#!/bin/sh
+set -e # Enable error trapping
+
+# $Id$
+
+###################################
+### FUNCTIONS ###
+###################################
+
+
+#----------------------------#
+get_sources() { #
+#----------------------------#
+ local IFS
+
+ # Test if the packages must be downloaded
+ if [ ! "$HPKG" = "1" ] ; then
+ return
+ fi
+
+ # Modify the 'internal field separator' to break on 'LF' only
+ IFS=$'\x0A'
+
+ if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
+ cd $BUILDDIR/sources
+
+ > MISSING_FILES.DMP # Files not in md5sum end up here
+
+ if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
+ if [ -f MD5SUMS-$VERSION ] ; then rm MD5SUMS-$VERSION ; fi
+
+ # Retrieve the master md5sum file
+ download "" MD5SUMS
+
+ # Iterate through each package and grab it, along with any patches it needs.
+ for i in `cat $JHALFSDIR/packages` ; do
+ PKG=`echo $i | sed -e 's/-version.*//' \
+ -e 's/uclibc/uClibc/' `
+
+ #
+ # How to deal with orphan packages..??
+ #
+ VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
+ case "$PKG" in
+ "gcc" )
+ download $PKG "gcc-core-$VRS.tar.bz2"
+ download $PKG "gcc-g++-$VRS.tar.bz2"
+ if [ ! "$TEST" = "0" ] ; then
+ download $PKG "gcc-testsuite-$VRS.tar.bz2" ;
+ fi
+ ;;
+
+ "glibc")
+ if [ "$MODEL" = "glibc" ] ; then
+ download $PKG "$PKG-$VRS.tar.bz2"
+ download $PKG "$PKG-libidn-$VRS.tar.bz2"
+ fi
+ ;;
+
+ "tcl" )
+ FILE="$PKG$VRS-src.tar.bz2" ; download $PKG $FILE ;;
+
+ "uclibc" )
+ if [ "$MODEL" = "uclibc" ] ; then
+ download $PKG "$PKG-$VRS.tar.bz2"
+ fi
+ ;;
+
+ "uClibc-locale" )
+ if [ "$MODEL" = "uclibc" ] ; then
+ FILE="$PKG-$VRS.tgz" ; PKG="uClibc"
+ download $PKG $FILE
+ # There can be no patches for this file
+ continue
+ fi
+ ;;
+
+ "uClibc-patch" ) continue ;;
+
+ * )
+ FILE="$PKG-$VRS.tar.bz2" ; download $PKG $FILE ;;
+ esac
+
+ for patch in `grep "$PKG-&$PKG" $JHALFSDIR/patches` ; do
+ PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
+ download $PKG $PATCH
+ done
+
+ done
+
+ # .... U G L Y .... what to do with the grsecurity patch to the kernel..
+ download grsecurity `grep grsecurity $JHALFSDIR/patches`
+
+ if [[ -s $BUILDDIR/sources/MISSING_FILES.DMP ]]; then
+ echo -e "\n\n${tab_}${RED} One or more files were not retrieved.\n${tab_} Check for names ${OFF}\n\n"
+ fi
+}
+
+
+#----------------------------#
+chapter3_Makefiles() { # Initialization of the system
+#----------------------------#
+ local TARGET LOADER
+
+ echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3${R_arrow}"
+
+ # Define a few model dependant variables
+ if [[ ${MODEL} = "uclibc" ]]; then
+ TARGET="tools-linux-uclibc"; LOADER="ld-uClibc.so.0"
+ else
+ TARGET="tools-linux-gnu"; LOADER="ld-linux.so.2"
+ fi
+
+ # NOTE: We use the lfs username and groupname also in HLFS
+ # 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
+ # of their bash init files is made.
+(
+cat << EOF
+020-creatingtoolsdir:
+ @\$(call echo_message, Building)
+ @mkdir -v \$(MOUNT_PT)/tools && \\
+ rm -fv /tools && \\
+ ln -sv \$(MOUNT_PT)/tools /
+ @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
+ mkdir \$(MOUNT_PT)/sources; \\
+ fi;
+ @chmod a+wt \$(MOUNT_PT)/sources && \\
+ touch \$@
+
+021-addinguser: 020-creatingtoolsdir
+ @\$(call echo_message, Building)
+ @if [ ! -d /home/lfs ]; then \\
+ groupadd lfs; \\
+ useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
+ else \\
+ touch user-lfs-exist; \\
+ fi;
+ @chown lfs \$(MOUNT_PT)/tools && \\
+ chown lfs \$(MOUNT_PT)/sources && \\
+ touch \$@
+
+022-settingenvironment: 021-addinguser
+ @\$(call echo_message, Building)
+ @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
+ mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
+ fi;
+ @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
+ mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
+ fi;
+ @echo "set +h" > /home/lfs/.bashrc && \\
+ echo "umask 022" >> /home/lfs/.bashrc && \\
+ echo "HLFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
+ echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
+ echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
+ echo "export HLFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
+ echo "" >> /home/lfs/.bashrc && \\
+ echo "target=$(uname -m)-${TARGET}" >> /home/lfs/.bashrc && \\
+ echo "ldso=/tools/lib/${LOADER}" >> /home/lfs/.bashrc && \\
+ echo "export target ldso" >> /home/lfs/.bashrc && \\
+ echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
+ chown lfs:lfs /home/lfs/.bashrc && \\
+ touch envars && \\
+ touch \$@
+EOF
+) >> $MKFILE.tmp
+
+}
+
+#----------------------------#
+chapter5_Makefiles() { # Bootstrap or temptools phase
+#----------------------------#
+ local file
+ local this_script
+
+ echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5${R_arrow}"
+
+ for file in chapter05/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # Skip this script depending on jhalfs.conf flags set.
+ case $this_script in
+ # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
+ *tcl* ) [[ "$TEST" = "0" ]] && continue; ;;
+ *expect* ) [[ "$TEST" = "0" ]] && continue; ;;
+ *dejagnu* ) [[ "$TEST" = "0" ]] && continue; ;;
+ # Nothing interestin in this script
+ *introduction* ) continue ;;
+ # Test if the stripping phase must be skipped
+ *stripping* ) [[ "$STRIP" = "0" ]] && continue ;;
+ *) ;;
+ esac
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ chapter5="$chapter5 $this_script"
+
+ # Grab the name of the target (minus the -headers or -cross in the case of gcc
+ # and binutils in chapter 5)
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-cross@@' -e 's@-headers@@'`
+
+ # Adjust 'name'
+ case $name in
+ linux-libc) name=linux-libc-headers ;;
+ esac
+
+ # Set the dependency for the first target.
+ if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
+
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ wrt_target "$this_script" "$PREV"
+
+ # Find the version of the command files, if it corresponds with the building of
+ # a specific package
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+ # If $vrs isn't empty, we've got a package...
+ if [ "$vrs" != "" ] ; then
+ # Deal with non-standard names
+ case $name in
+ tcl) FILE="$name$vrs-src.tar.*" ;;
+ uclibc) FILE="uClibc-$vrs.tar.*" ;;
+ gcc) FILE="gcc-core-$vrs.tar.*" ;;
+ *) FILE="$name-$vrs.tar.*" ;;
+ esac
+ # Insert instructions for unpacking the package and to set the PKGDIR variable.
+ wrt_unpack "$FILE"
+ fi
+
+ case $this_script in
+ *binutils* ) # Dump the path to sources directory for later removal
+ echo -e '\techo "$(MOUNT_PT)$(SRC)/$$ROOT" >> sources-dir' >> $MKFILE.tmp
+ ;;
+ *adjusting* ) # For the Adjusting phase we must to cd to the binutils-build directory.
+ echo -e '\t@echo "export PKGDIR=$(MOUNT_PT)$(SRC)/binutils-build" > envars' >> $MKFILE.tmp
+ ;;
+ * ) # Everything else, add a true statment so we don't confuse make
+ echo -e '\ttrue' >> $MKFILE.tmp
+ ;;
+ esac
+
+ # Insert date and disk usage at the top of the log file, the script run
+ # and date and disk usage again at the bottom of the log file.
+ wrt_run_as_su "${this_script}" "${file}"
+
+ # Remove the build directory(ies) except if the package build fails
+ # (so we can review config.cache, config.log, etc.)
+ # For Binutils the sources must be retained for some time.
+ if [ "$vrs" != "" ] ; then
+ case "${this_script}" in
+ *binutils*) : # do NOTHING
+ ;;
+ *) wrt_remove_build_dirs "$name"
+ ;;
+ esac
+ fi
+
+ # Remove the Binutils pass 1 sources after a successful Adjusting phase.
+ case "${this_script}" in
+ *adjusting*)
+(
+cat << EOF
+ @rm -r \`cat sources-dir\` && \\
+ rm -r \$(MOUNT_PT)\$(SRC)/binutils-build && \\
+ rm sources-dir
+EOF
+) >> $MKFILE.tmp
+ ;;
+ esac
+
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+ done # end for file in chapter05/*
+}
+
+
+#----------------------------#
+chapter6_Makefiles() { # sysroot or chroot build phase
+#----------------------------#
+ local TARGET LOADER
+ local file
+ local this_script
+
+ echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6${R_arrow}"
+ #
+ # Set these definitions early and only once
+ #
+ if [[ ${MODEL} = "uclibc" ]]; then
+ TARGET="pc-linux-uclibc"; LOADER="ld-uClibc.so.0"
+ else
+ TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
+ fi
+
+ for file in chapter06/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # Skip this script depending on jhalfs.conf flags set.
+ case $this_script in
+ # We'll run the chroot commands differently than the others, so skip them in the
+ # dependencies and target creation.
+ *chroot* ) continue ;;
+ # Test if the stripping phase must be skipped
+ *-stripping* ) [[ "$STRIP" = "0" ]] && continue ;;
+ *) ;;
+ esac
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ chapter6="$chapter6 $this_script"
+
+ # Grab the name of the target
+ name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
+
+ #
+ # Sed replacement to fix some rm command that could fail.
+ # That should be fixed in the book sources.
+ #
+ case $name in
+ glibc)
+ sed 's/rm /rm -f /' -i chapter06/$this_script
+ ;;
+ gcc)
+ sed 's/rm /rm -f /' -i chapter06/$this_script
+ ;;
+ esac
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ wrt_target "$this_script" "$PREV"
+
+ # Find the version of the command files, if it corresponds with the building of
+ # a specific package
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ # If $vrs isn't empty, we've got a package...
+ # Insert instructions for unpacking the package and changing directories
+ if [ "$vrs" != "" ] ; then
+ # Deal with non-standard names
+ case $name in
+ tcl) FILE="$name$vrs-src.tar.*" ;;
+ uclibc) FILE="uClibc-$vrs.tar.*" ;;
+ gcc) FILE="gcc-core-$vrs.tar.*" ;;
+ *) FILE="$name-$vrs.tar.*" ;;
+ esac
+ wrt_unpack2 "$FILE"
+ wrt_target_vars
+ fi
+
+ case $this_script in
+ *readjusting*) # For the Re-Adjusting phase we must to cd to the binutils-build directory.
+ echo -e '\t@echo "export PKGDIR=$(SRC)/binutils-build" > envars' >> $MKFILE.tmp
+ ;;
+ esac
+
+ # In the mount of kernel filesystems we need to set LFS and not to use chroot.
+ case "${this_script}" in
+ *kernfs*)
+ wrt_run_as_root "${this_script}" "${file}"
+ ;;
+ *) # The rest of Chapter06
+ wrt_run_as_chroot1 "${this_script}" "${file}"
+ ;;
+ esac
+ #
+ # Remove the build directory(ies) except if the package build fails.
+ if [ "$vrs" != "" ] ; then
+ wrt_remove_build_dirs "$name"
+ fi
+ #
+ # Remove the Binutils pass 2 sources after a successful Re-Adjusting phase.
+ case "${this_script}" in
+ *readjusting*)
+(
+cat << EOF
+ @rm -r \`cat sources-dir\` && \\
+ rm -r \$(MOUNT_PT)\$(SRC)/binutils-build && \\
+ rm sources-dir
+EOF
+) >> $MKFILE.tmp
+ ;;
+ esac
+
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+ done # end for file in chapter06/*
+
+}
+
+#----------------------------#
+chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..etc
+#----------------------------#
+ local file
+ local this_script
+
+ echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7${R_arrow}"
+ for file in chapter07/*; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # Grub must be configured manually.
+ # The filesystems can't be unmounted via Makefile and the user
+ # should enter the chroot environment to create the root
+ # password, edit several files and setup Grub.
+ case $this_script in
+ *usage) continue ;; # Contains example commands
+ *grub) continue ;;
+ *reboot) continue ;;
+ *console) continue ;; # Use the file generated by lfs-bootscripts
+
+ *kernel)
+ # If no .config file is supplied, the kernel build is skipped
+ [[ -z $CONFIG ]] && continue
+ cp $CONFIG $BUILDDIR/sources/kernel-config
+ ;;
+ esac
+
+ # First append then name of the script file to a list (this will become
+ # the names of the targets in the Makefile
+ chapter7="$chapter7 $this_script"
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ wrt_target "$this_script" "$PREV"
+
+ case "${this_script}" in
+ *bootscripts*)
+ vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+ FILE="lfs-bootscripts-$vrs.tar.*"
+ wrt_unpack2 "$FILE"
+ vrs=`grep "^blfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+ echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/blfs-bootscripts-$vrs\" >> sources-dir" >> $MKFILE.tmp
+ ;;
+ esac
+
+ case "${this_script}" in
+ *fstab*) # Check if we have a real /etc/fstab file
+ if [[ -n "$FSTAB" ]] ; then
+ wrt_copy_fstab "$this_script"
+ else # Initialize the log and run the script
+ wrt_run_as_chroot2 "${this_script}" "${file}"
+ fi
+ ;;
+ *) # All other scripts
+ wrt_run_as_chroot2 "${this_script}" "${file}"
+ ;;
+ esac
+
+ # Remove the build directory except if the package build fails.
+ case "${this_script}" in
+ *bootscripts*)
+(
+cat << EOF
+ @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+ rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT
+ @rm -r \`cat sources-dir\` && \\
+ rm sources-dir
+EOF
+) >> $MKFILE.tmp
+ ;;
+ esac
+
+ # Include a touch of the target name so make can check if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+
+ # Keep the script file name for Makefile dependencies.
+ PREV=$this_script
+ done # for file in chapter07/*
+}
+
+
+#----------------------------#
+build_Makefile() { # Construct a Makefile from the book scripts
+#----------------------------#
+ echo "Creating Makefile... "
+
+ cd $JHALFSDIR/${PROGNAME}-commands
+ # Start with a clean Makefile.tmp file
+ >$MKFILE.tmp
+
+ chapter3_Makefiles
+ chapter5_Makefiles
+ chapter6_Makefiles
+ chapter7_Makefiles
+
+ # Add a header, some variables and include the function file
+ # to the top of the real Makefile.
+(
+ cat << EOF
+$HEADER
+
+SRC= /sources
+MOUNT_PT= $BUILDDIR
+
+include makefile-functions
+
+EOF
+) > $MKFILE
+
+
+ # Add chroot commands
+ i=1
+ for file in chapter06/*chroot* ; do
+ chroot=`cat $file | sed -e '/#!\/bin\/sh/d' \
+ -e '/^export/d' \
+ -e '/^logout/d' \
+ -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
+ -e 's|\\$|&&|g' \
+ -e 's|exit||g' \
+ -e 's|$| -c|' \
+ -e 's|"$$HLFS"|$(MOUNT_PT)|'\
+ -e 's|set -e||'`
+ echo -e "CHROOT$i= $chroot\n" >> $MKFILE
+ i=`expr $i + 1`
+ done
+
+ # Drop in the main target 'all:' and the chapter targets with each sub-target
+ # as a dependency.
+(
+ cat << EOF
+all: chapter3 chapter5 chapter6 chapter7
+ @\$(call echo_finished,$VERSION)
+
+chapter3: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
+
+chapter5: chapter3 $chapter5 restore-lfs-env
+
+chapter6: chapter5 $chapter6
+
+chapter7: chapter6 $chapter7
+
+clean-all: clean
+ rm -rf ./{hlfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
+
+clean: clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3
+
+clean-chapter3:
+ -if [ ! -f user-lfs-exist ]; then \\
+ userdel lfs; \\
+ rm -rf /home/lfs; \\
+ fi;
+ rm -rf \$(MOUNT_PT)/tools
+ rm -f /tools
+ rm -f envars user-lfs-exist
+ rm -f 02* logs/02*.log
+
+clean-chapter5:
+ rm -rf \$(MOUNT_PT)/tools/*
+ rm -f $chapter5 restore-lfs-env sources-dir
+ cd logs && rm -f $chapter5 && cd ..
+
+clean-chapter6:
+ -umount \$(MOUNT_PT)/sys
+ -umount \$(MOUNT_PT)/proc
+ -umount \$(MOUNT_PT)/dev/shm
+ -umount \$(MOUNT_PT)/dev/pts
+ -umount \$(MOUNT_PT)/dev
+ rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
+ rm -f $chapter6
+ cd logs && rm -f $chapter6 && cd ..
+
+clean-chapter7:
+ rm -f $chapter7
+ cd logs && rm -f $chapter7 && cd ..
+
+restore-lfs-env:
+ @\$(call echo_message, Building)
+ @if [ -f /home/lfs/.bashrc.XXX ]; then \\
+ mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
+ fi;
+ @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
+ mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
+ fi;
+ @chown lfs:lfs /home/lfs/.bash* && \\
+ touch \$@
+
+EOF
+) >> $MKFILE
+
+ # Bring over the items from the Makefile.tmp
+ cat $MKFILE.tmp >> $MKFILE
+ rm $MKFILE.tmp
+ echo "done"
+}
diff --git a/HLFS/patcheslist.xsl b/HLFS/patcheslist.xsl
new file mode 100644
index 0000000..58056ba
--- /dev/null
+++ b/HLFS/patcheslist.xsl
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 596e9f4..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,36 +0,0 @@
-Installation Instructions
-*************************
-
-If you plan to use the packages download feature of jhalfs and
-your host system uses a md5sum program that doesn't accept '-'
-as a file name, like the one shipped with Debian 3.1 stable,
-apply the included patch, issuing:
-
-patch -Np0 < jhalfs-0.2-debian_31_as_host-1.patch
-
-jhalfs can be used directly from the sources directory, or
-installed system-wide.
-
-To install jhalfs system-wide issue as root:
-
-make install
-
-That will install the jhalfs script under /usr/bin, the
-configuration file under /etc/jhalfs, and the style sheet,
-functions, README, and LICENSE files under /usr/share/jhalfs.
-
-To customize the installation locations, the following environment
-variables can be used:
-
-BIN=/some/path Define where the jhalfs script will be
- installed
-
-CONFIG=/some/path Define where the configuration file will be
- installed
-
-DATA=/some/path Define where the additional files will be
- installed
-
-For example, to install the program and files into root's home:
-
-make BIN=/root/bin CONFIG=/root/jhalfs DATA=/root/jhalfs
diff --git a/LFS/config b/LFS/config
new file mode 100644
index 0000000..03692a9
--- /dev/null
+++ b/LFS/config
@@ -0,0 +1,37 @@
+#####
+#
+# Configuration file for the LFS module
+#
+# $Id$
+#
+#####
+declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/lfs/conglomeration
+
+#--- 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=
+
+#--- 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
+
+#--- Name of the makefile
+MKFILE=$JHALFSDIR/Makefile
+
+#--- FTP/HTTP mirror used as fallback (full path)
+SERVER=ftp://anduin.linuxfromscratch.org/LFS/conglomeration
diff --git a/dump-lfs-scripts.xsl b/LFS/lfs.xsl
similarity index 91%
rename from dump-lfs-scripts.xsl
rename to LFS/lfs.xsl
index 8cf7bf6..a0a2967 100644
--- a/dump-lfs-scripts.xsl
+++ b/LFS/lfs.xsl
@@ -4,6 +4,8 @@
%general-entities;
]>
+
+
+
+
+
+
+
+
+
+
+
@@ -121,6 +132,15 @@
+
+
+
+ export LANG=
+
+
+
+
make mrproper
@@ -181,10 +201,10 @@
- $TIMEZONE
+
- $PAGE
+
**EDITME
diff --git a/LFS/master.sh b/LFS/master.sh
new file mode 100755
index 0000000..10488fe
--- /dev/null
+++ b/LFS/master.sh
@@ -0,0 +1,395 @@
+#!/bin/sh
+
+# $Id$
+
+###################################
+### FUNCTIONS ###
+###################################
+
+
+
+#----------------------------#
+chapter4_Makefiles() {
+#----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4${R_arrow}"
+
+# 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
+# of their bash init files is made.
+(
+ cat << EOF
+020-creatingtoolsdir:
+ @\$(call echo_message, Building)
+ @mkdir -v \$(MOUNT_PT)/tools && \\
+ rm -fv /tools && \\
+ ln -sv \$(MOUNT_PT)/tools / && \\
+ touch \$@
+
+021-addinguser: 020-creatingtoolsdir
+ @\$(call echo_message, Building)
+ @if [ ! -d /home/lfs ]; then \\
+ groupadd lfs; \\
+ useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
+ else \\
+ touch user-lfs-exist; \\
+ fi;
+ @chown lfs \$(MOUNT_PT)/tools && \\
+ chmod a+wt \$(MOUNT_PT)/sources && \\
+ touch \$@
+
+022-settingenvironment: 021-addinguser
+ @\$(call echo_message, Building)
+ @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
+ mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
+ fi;
+ @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
+ mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
+ fi;
+ @echo "set +h" > /home/lfs/.bashrc && \\
+ echo "umask 022" >> /home/lfs/.bashrc && \\
+ echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\
+ echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
+ echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
+ echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
+ echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
+ chown lfs:lfs /home/lfs/.bashrc && \\
+ touch envars && \\
+ touch \$@
+EOF
+) >> $MKFILE.tmp
+}
+
+#----------------------------#
+chapter5_Makefiles() {
+#----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5${R_arrow}"
+
+ for file in chapter05/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
+ case "${this_script}" in
+ *tcl) [[ "${TEST}" = "0" ]] && continue ;;
+ *expect) [[ "${TEST}" = "0" ]] && continue ;;
+ *dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
+ *stripping) [[ "${STRIP}" = "0" ]] && continue ;;
+ esac
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ chapter5="$chapter5 ${this_script}"
+
+ # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
+ # and binutils in chapter 5)
+ name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
+
+ # Set the dependency for the first target.
+ if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ wrt_target "${this_script}" "$PREV"
+
+ # Find the version of the command files, if it corresponds with the building of
+ # a specific package
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ # If $vrs isn't empty, we've got a package...
+ if [ "$vrs" != "" ] ; then
+ if [ "$name" = "tcl" ] ; then
+ FILE="$name$vrs-src.tar.*"
+ else
+ FILE="$name-$vrs.tar.*"
+ fi
+
+ # Insert instructions for unpacking the package and to set the PKGDIR variable.
+ wrt_unpack "$FILE"
+ echo -e '\ttrue' >> $MKFILE.tmp
+ fi
+
+ # Insert date and disk usage at the top of the log file, the script run
+ # and date and disk usage again at the bottom of the log file.
+ wrt_run_as_su "${this_script}" "$file"
+
+ # Remove the build directory(ies) except if the package build fails
+ # (so we can review config.cache, config.log, etc.)
+ if [ "$vrs" != "" ] ; then
+ wrt_remove_build_dirs "$name"
+ fi
+
+ # Include a touch of the target name so make can check
+ # if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+
+ # Keep the script file name for Makefile dependencies.
+ PREV=${this_script}
+ done # end for file in chapter05/*
+}
+
+#----------------------------#
+chapter6_Makefiles() {
+#----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6${R_arrow}"
+
+ for file in chapter06/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # We'll run the chroot commands differently than the others, so skip them in the
+ # dependencies and target creation.
+ case "${this_script}" in
+ *chroot) continue ;;
+ *stripping*) [[ "${STRIP}" = "0" ]] && continue ;;
+ esac
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ chapter6="$chapter6 ${this_script}"
+
+ # Grab the name of the target
+ name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'`
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ wrt_target "${this_script}" "$PREV"
+
+ # Find the version of the command files, if it corresponds with the building of
+ # a specific package
+ vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+ # If $vrs isn't empty, we've got a package...
+ # Insert instructions for unpacking the package and changing directories
+ if [ "$vrs" != "" ] ; then
+ FILE="$name-$vrs.tar.*"
+ wrt_unpack2 "$FILE"
+ fi
+
+ # In the mount of kernel filesystems we need to set LFS
+ # and not to use chroot.
+ case "${this_script}" in
+ *kernfs) wrt_run_as_root "${this_script}" "$file" ;;
+ *) wrt_run_as_chroot1 "${this_script}" "$file" ;;
+ esac
+
+ # Remove the build directory(ies) except if the package build fails.
+ if [ "$vrs" != "" ] ; then
+ wrt_remove_build_dirs "$name"
+ fi
+
+ # Include a touch of the target name so make can check
+ # if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+
+ # Keep the script file name for Makefile dependencies.
+ PREV=${this_script}
+ done # end for file in chapter06/*
+}
+
+#----------------------------#
+chapter789_Makefiles() {
+#----------------------------#
+ echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8/9${R_arrow}"
+
+ for file in chapter0{7,8,9}/* ; do
+ # Keep the script file name
+ this_script=`basename $file`
+
+ # Grub must be configured manually.
+ # The filesystems can't be unmounted via Makefile and the user
+ # should enter the chroot environment to create the root
+ # password, edit several files and setup Grub.
+ #
+ # If no .config file is supplied, the kernel build is skipped
+ #
+ case ${this_script} in
+ *grub) continue ;;
+ *reboot) continue ;;
+ *console) continue ;; # Use the file generated by lfs-bootscripts
+ *kernel) [[ -z ${CONFIG} ]] && continue
+ cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
+ esac
+
+ # First append each name of the script files to a list (this will become
+ # the names of the targets in the Makefile
+ chapter789="$chapter789 ${this_script}"
+
+ #--------------------------------------------------------------------#
+ # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+ #
+ # Drop in the name of the target on a new line, and the previous target
+ # as a dependency. Also call the echo_message function.
+ wrt_target "${this_script}" "$PREV"
+
+ # Find the bootscripts and kernel package names
+ case "${this_script}" in
+ *bootscripts)
+ vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+ FILE="lfs-bootscripts-$vrs.tar.*"
+ wrt_unpack2 "$FILE"
+ ;;
+ *kernel)
+ vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+ FILE="linux-$vrs.tar.*"
+ wrt_unpack2 "$FILE"
+ ;;
+ esac
+
+ # Check if we have a real /etc/fstab file
+ case "${this_script}" in
+ *fstab) if [[ -n $FSTAB ]]; then
+ wrt_copy_fstab "${this_script}"
+ else
+ wrt_run_as_chroot2 "$this_script" "$file"
+ fi
+ ;;
+ *) wrt_run_as_chroot2 "$this_script" "$file"
+ ;;
+ esac
+
+ case "${this_script}" in
+ *bootscripts) wrt_remove_build_dirs "dummy" ;;
+ *kernel) wrt_remove_build_dirs "dummy" ;;
+ esac
+
+ # Include a touch of the target name so make can check
+ # if it's already been made.
+ echo -e '\t@touch $@' >> $MKFILE.tmp
+ #
+ #--------------------------------------------------------------------#
+ # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
+ #--------------------------------------------------------------------#
+
+ # Keep the script file name for Makefile dependencies.
+ PREV=${this_script}
+ done # for file in chapter0{7,8,9}/*
+}
+
+
+#----------------------------#
+build_Makefile() {
+#----------------------------#
+ echo "Creating Makefile... "
+ cd $JHALFSDIR/${PROGNAME}-commands
+
+ # Start with a clean Makefile.tmp file
+ >$MKFILE.tmp
+
+ chapter4_Makefiles
+ chapter5_Makefiles
+ chapter6_Makefiles
+ chapter789_Makefiles
+
+
+ # Add a header, some variables and include the function file
+ # to the top of the real Makefile.
+(
+ cat << EOF
+$HEADER
+
+SRC= /sources
+MOUNT_PT= $BUILDDIR
+
+include makefile-functions
+
+EOF
+) > $MKFILE
+
+
+ # Add chroot commands
+ i=1
+ for file in chapter06/*chroot* ; do
+ chroot=`cat $file | sed -e '/#!\/bin\/sh/d' -e 's@ \\\@ @g' | tr -d '\n' | sed \
+ -e 's/ */ /g' -e 's|\\$|&&|g' -e 's|exit||g' -e 's|$| -c|' \
+ -e 's|"$$LFS"|$(MOUNT_PT)|' -e 's|set -e||'`
+ echo -e "CHROOT$i= $chroot\n" >> $MKFILE
+ i=`expr $i + 1`
+ done
+
+ # Drop in the main target 'all:' and the chapter targets with each sub-target
+ # as a dependency.
+(
+ cat << EOF
+all: chapter4 chapter5 chapter6 chapter789
+ @\$(call echo_finished,$VERSION)
+
+chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
+
+chapter5: chapter4 $chapter5 restore-lfs-env
+
+chapter6: chapter5 $chapter6
+
+chapter789: chapter6 $chapter789
+
+clean-all: clean
+ rm -rf ./{lfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
+
+clean: clean-chapter789 clean-chapter6 clean-chapter5 clean-chapter4
+
+clean-chapter4:
+ -if [ ! -f user-lfs-exist ]; then \\
+ userdel lfs; \\
+ rm -rf /home/lfs; \\
+ fi;
+ rm -rf \$(MOUNT_PT)/tools
+ rm -f /tools
+ rm -f envars user-lfs-exist
+ rm -f 02* logs/02*.log
+
+clean-chapter5:
+ rm -rf \$(MOUNT_PT)/tools/*
+ rm -f $chapter5 restore-lfs-env sources-dir
+ cd logs && rm -f $chapter5 && cd ..
+
+clean-chapter6:
+ -umount \$(MOUNT_PT)/sys
+ -umount \$(MOUNT_PT)/proc
+ -umount \$(MOUNT_PT)/dev/shm
+ -umount \$(MOUNT_PT)/dev/pts
+ -umount \$(MOUNT_PT)/dev
+ rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
+ rm -f $chapter6
+ cd logs && rm -f $chapter6 && cd ..
+
+clean-chapter789:
+ rm -f $chapter789
+ cd logs && rm -f $chapter789 && cd ..
+
+restore-lfs-env:
+ @\$(call echo_message, Building)
+ @if [ -f /home/lfs/.bashrc.XXX ]; then \\
+ mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
+ fi;
+ @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
+ mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
+ fi;
+ @chown lfs:lfs /home/lfs/.bash* && \\
+ touch \$@
+
+EOF
+) >> $MKFILE
+
+ # Bring over the items from the Makefile.tmp
+ cat $MKFILE.tmp >> $MKFILE
+ rm $MKFILE.tmp
+ echo "done"
+}
+
+
diff --git a/Makefile b/Makefile
deleted file mode 100644
index e38a6f3..0000000
--- a/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Makefile to install jhalfs system-wide
-
-# Where the files will be installed
-PREFIX=/usr
-BIN=$(PREFIX)/bin
-CONFIG=/etc/jhalfs
-DATA=$(PREFIX)/share/jhalfs
-
-# List of additional files
-DATAFILES=functions dump-lfs-scripts.xsl README LICENSE
-
-install:
- install -v -d $(BIN)
- install -v -d $(CONFIG)
- install -v -d $(DATA)
- sed 's|source jhalfs.conf|source $(CONFIG)/jhalfs.conf|' jhalfs > $(BIN)/jhalfs
- chmod -v 744 $(BIN)/jhalfs
- sed 's|XSL.|&$(DATA)/|;s|FILES..|&$(DATA)/|;/FILES/s| | $(DATA)/|g' jhalfs.conf > $(CONFIG)/jhalfs.conf
- chmod -v 644 $(CONFIG)/jhalfs.conf
- install -v -m 644 $(DATAFILES) $(DATA)
diff --git a/README b/README
index 69556f9..17aa2d9 100644
--- a/README
+++ b/README
@@ -1,22 +1,95 @@
-jhalfs 0.2
+$Id$
-The purpose of jhalfs is to provide a pure automated build of Linux From
-Scratch. It does this by extracting the necessary commands and information
-straight from the LFS book's XML source. It then creates a Makefile that
-acts as the automation control of the commands to be run. Finally, if you have
-specified it to do so, and have the necessary packages available (jhalfs can
-download them if you need it to), it can begin and log the build process.
+1. INTRODUCTION::
-There are several options that jhalfs can employ and that may be useful to
-your particular needs. For a full list run:
+ This collection of scripts, known as jhalfs-X, strives to create
+ accurate makefiles from the Linux From Scratch book series XML files.
+ This software is an evolution of the original "jhalfs" code.
-jhalfs --help
+ The usage of this script assumes you have read and are familiar with
+ the book(s) and, therefore, the configuration variables found in config
+ files will have meaning to you. There are a number of command line switches
+ which, if used, will override the config file settings.
-Some variables of the build can be adjusted to fit your particular needs and
-system. The file 'jhalfs.conf' can be used to specify certain variables of the
-jhalfs build system. For more information, read the 'jhalfs.conf' file as it
-should be self-explanatory.
+ NOTES::
+ *. The resulting Makefile takes considerable time to run to completion.
+ Lay in a supply of caffeine beverages.
-For help, questions, or to report a bug, please email the alfs-discuss mailing
-list:
-alfs-discuss AT linuxfromscratch DOT org
+ *. It is recommended that you temporarily unpack your linux kernel,
+ run , configure the kernal as per the book and save
+ the resulting .config file. This suggestion also applies to the
+ configuration of the uClibc package when building a HLFS system using
+ uClibc rather than glibc.
+
+2. INSTALLATION::
+ No installation is required. System-wide installation is not allowed
+ for now.
+
+3. CONFIGURATION FILES::
+ Each book in the LFS series has its own set of configurable parameters
+ as well as the common parameters file.
+
+4. RUNNING::
+ The script master.sh cannot be invoked directly but only via the
+ supplied symlinks. After editing the config file for the project you wish
+ to build, run the script.
+
+ The term refers to the 1 of 4 package symlinks, lfs,hlfs,clfs,blfs.
+ Replace with your choice of packages; i.e.: ./lfs
+
+ ./
+ Create a makefile based on the settings found in the config files.
+ You must enter the build partition/jhalfs directory and manually run
+
+ ./ -G
+ Download the packages and patches necessary to build
+
+ ./ -G -M
+ Download the packages, create and automatically run the Makefile
+
+ ./ --help will give you a context sensitive list of command
+ line switches.
+
+5. LAYOUT::
+
+ blfs --+ /BLFS config ---+ /common/config
+ | master.sh -+ /common_functions
+ | xxxx.xsl -+ /makefile_functions
+ | /func_check_versions.sh
+ clfs --+ /CLFS config ---+ /func_validate_configs.sh
+ | master.sh -+
+ | xxxx.xsl -+
+ |
+ +--------------------- master.sh --------------->>>
+ +--README
+ |
+ hlfs --+ /HLFS config ---+
+ | master.sh -+
+ | xxxx.xsl -+
+ |
+ lfs --+ /LFS config ---+
+ master.sh -+
+ xxxx.xsl -+
+
+
+6. FAQ::
+ Q. "It doesn't work"
+ A. Yes it does..
+
+ Q. "What is the function of the SRC_ARCHIVE variable
+ A. When the makefile runs it creates a local copy of the necessary packages
+ in BUILDDIR/sources by downloading the files. If the variable SRC_ARCHIVE
+ is defined the software will first look in this location for the file and,
+ if found, will copy it to BUILDDIR/sources. If the files are not found in
+ SRC_ARCHIVE _and_ you have write priv to the directory any downloaded
+ files will be mirrored there.
+
+ Q. "Why have 2 copies of the files."
+ A. The package files must be visible during the chroot phase and this is a
+ simple and reliable method of doing so. This method also handles the CLFS
+ build method where the final build may be done on a separate machine.
+
+Authors:
+ George Boudreau
+ Manuel Canales Esparcia
+ Jeremy Huntwork
diff --git a/TODO b/TODO
index 10dbd98..49eb04b 100644
--- a/TODO
+++ b/TODO
@@ -1,52 +1,23 @@
jhalfs TODO
---------------
-(The fixes for this issues are in the experimental branch)
-
-CODE STYLE
-----------
-
-DONE - To use the same coding style in all modules. The current used
- for HLFS module (colors, error-handling, etc) look a good starting
- point for me, with two notes (to be discussed):
-
- - Bash code: to use two-spaces indentation (no tabs).
- - Makefile code: to use eight-characters tabs.
-
-DONE - To set the "Date" and "Id" svn:keywords properties on all files
- setting the "Id" key on the header of each file and using the
- "Date" key when needed (like in the -v output of jhalfs)
-
MASTER SCRIPT
-------------
-DONE - Make jhalfs a "master script" that will control and run each
- book's module. When doing that reestructuration we coulud to change
- the tool's name, if wanted.
-
-DONE - Common code for all modules should be placed in this master script.
-
-DONE - Common configuration options should be placed in a master configuration
- file.
-
-DONE - The LFS, CLFS and HLFS modules should be exclusives. I.e., when
- one is called the others must be ignored.
-
- The BLFS moudule should can be called in conjunction with any of
LFS, CLFS or HLFS modules.
- - Addapt the Makefile to install all modules system-wide.
+ - To create a Makefile to install jhalfs-X system-wide.
+ Note: is that actually wanted?
LFS MODULE (some of this is applicable also to CLFS and HLFS modules)
----------
-DONE - To move the LFS module to their own subdir.
-
-DONE - Fix the unpack code to don't hang when both the bz2 and gz formats
- of the same package are founds in the sources dir.
+ - To fix the dowload code when all packages will be placed on the
+ FTP mirrors in the upstream formats.
- To add a switch to build the BLFS module dependencies at the end of
the LFS build, that is, wget and sudo. SVN and libxslt aren't needed
@@ -55,22 +26,6 @@ DONE - Fix the unpack code to don't hang when both the bz2 and gz formats
(to be) generated BLFS HTML pages and, maybe, gpm.
-CLFS MODULE
------------
-
-DONE - Start the module creation.
-
-
-HLFS MODULE
------------
-
-DONE - To review and fix, if needed, the bash and XSL code.
-
-DONE - Be sure that the book's XML code is in a sane state.
-
-DONE - To do several build test for both Glibc and uClibc based systems.
-
-
BLFS MODULE
-----------
@@ -126,7 +81,7 @@ OTHERS
NOTE: that could require an special command line switch to regenerate the
Makefile if additional scripts are manually added to the *-commands/*/ dirs.
- - To add support for ICA/farce? Can be done as a separate module?
+ - To add support for ICA/farce. That is a required feature.
- To add support for package management??? NO by default, but patches
are acepted and will be added to the sources as external contributions.
diff --git a/blfs b/blfs
new file mode 120000
index 0000000..fba0373
--- /dev/null
+++ b/blfs
@@ -0,0 +1 @@
+master.sh
\ No newline at end of file
diff --git a/clfs b/clfs
new file mode 120000
index 0000000..fba0373
--- /dev/null
+++ b/clfs
@@ -0,0 +1 @@
+master.sh
\ No newline at end of file
diff --git a/common/common-functions b/common/common-functions
new file mode 100644
index 0000000..c08dc74
--- /dev/null
+++ b/common/common-functions
@@ -0,0 +1,874 @@
+#!/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}${WHITE}==============================================================================${OFF}"
+declare -r SD_BORDER="${BOLD}${WHITE}------------------------------------------------------------------------------${OFF}"
+declare -r STAR_BORDER="${BOLD}${WHITE}******************************************************************************${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]
+
+Options:
+${BOLD} -h, --help${OFF}
+ print this help, then exit
+
+${BOLD} -V, --version${OFF}
+ print version information, then exit
+
+${BOLD} -B, --book VER${OFF}
+ checkout VER version of the book. Supported versions at this time are:
+ dev* | trunk | SVN aliases for Development {C,H,B}LFS
+ alpha* aliases for the LFS alphabetical branch
+ udev* aliases for the LFS udev_update branch
+
+${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/jhalfs.
+
+${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} -T, --testsuites N ${OFF}
+ Run test suites [0-3]
+ 0 = none
+ 1 = only chapter06 Glibc, GCC and Binutils testsuites
+ 2 = all chapter06 testsuites (in BLFS, alias to 1)
+ 3 = all chapter05 and chapter06 testsuites
+ In BLFS, 2 and 3 are aliases to 1
+ In CLFS, 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
+-EOF-
+
+[[ ${PROGNAME} != "blfs" ]] &&
+cat <<- -EOF-
+
+${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 to perfom 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, sparcv8
+ 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} = "hlfs" ]] &&
+cat <<- -EOF-
+
+${BOLD} --model STYLE ${OFF}
+ Select the library model for the HLFS system
+ Valid choices are: glibc or uclibc
+-EOF-
+
+[[ ${PROGNAME} = "blfs" ]] &&
+cat <<- -EOF-
+
+${BOLD} --dependencies 0/1/2${OFF}
+ add dependencies of type TYPE to the build tree.
+ If not set, both required and recommended are used.
+
+ Possible values are:
+ 0 - required only required dependecies are used
+ 1 - recommended both required a recommended dependencies are used
+ 2 - optional all dependencies are used
+-EOF-
+
+cat <<- -EOF-
+${DD_BORDER}
+-EOF-
+ exit
+}
+
+version="
+${BOLD} \"jhalfs-X\"${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}
+"
+
+
+no_empty_builddir() {
+ 'clear'
+cat <<- -EOF-
+${DD_BORDER}
+
+${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF}
+ Looks like the \$BUILDDIR directory contains subdirectories
+ from a previous HLFS build.
+
+ Please format the partition mounted on \$BUILDDIR or set
+ a different build directory before running jhalfs-X.
+${OFF}
+${DD_BORDER}
+-EOF-
+ exit
+}
+
+
+help="${nl_}Try '$0 --help' for more information."
+
+
+exit_missing_arg="\
+echo \"Option '\$1' requires an argument\" >&2
+echo \"\$help\" >&2
+exit 1"
+
+no_dl_client="\
+echo \"Could not find a way to download the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} sources.\" >&2
+echo \"Attempting to continue.\" >&2"
+
+HEADER="# This file is automatically generated by jhalfs-X
+# DO NOT EDIT THIS FILE MANUALLY
+#
+# Generated on `date \"+%F %X %Z\"`"
+
+
+
+
+
+#----------------------------------#
+wrt_target() { #
+#----------------------------------#
+ local i=$1
+ local PREV=$2
+(
+cat << EOF
+
+$i: $PREV
+ @\$(call echo_message, Building)
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_unpack() { # Unpack and set 'ROOT' var
+#----------------------------------#
+ local FILE=$1
+(
+cat << EOF
+ @\$(call unpack,$FILE)
+ @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+ echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
+ chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_unpack2() { #
+#----------------------------------#
+ local FILE=$1
+(
+cat << EOF
+ @\$(call unpack2,$FILE)
+ @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+ echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#=============================#
+wrt_unpack3() { #
+#=============================#
+ local FILE=$1
+(
+cat << EOF
+ @\$(call unpack3,$FILE)
+ @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+ echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
+EOF
+) >> $MKFILE.tmp
+}
+
+
+
+#----------------------------------#
+wrt_target_vars() { # Target vars for hlfs (cross-build method)
+#----------------------------------#
+(
+cat << EOF
+ @echo "export target=$(uname -m)-${TARGET}" >> envars && \\
+ echo "export ldso=/lib/${LOADER}" >> envars
+EOF
+) >> $MKFILE.tmp
+
+}
+
+
+#----------------------------------#
+wrt_run_as_su() { # header to log file, execute script, footer to log file
+#----------------------------------#
+ local this_script=$1
+ local file=$2
+(
+cat << EOF
+ @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/$this_script && \\
+ su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 && \\
+ echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/$this_script
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_run_as_root() { #
+#----------------------------------#
+ local this_script=$1
+ local file=$2
+(
+cat << EOF
+ @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/$this_script && \\
+ export LFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 && \\
+ echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/$this_script
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#=============================#
+wrt_run_as_root2() { # Some scripts must be run as root..
+#=============================#
+ local this_script=$1
+ local file=$2
+(
+cat << EOF
+ @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \`\n" >logs/$this_script && \\
+ source envars && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 && \\
+ echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \`\n" >>logs/$this_script
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_remove_build_dirs() { #
+#----------------------------------#
+ local name=$1
+(
+cat << EOF
+ @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+ rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
+ if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
+ rm -r \$(MOUNT_PT)\$(SRC)/$name-build; \\
+ fi;
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_remove_build_dirs2() { #
+#----------------------------------#
+ local name=$1
+(
+cat << EOF
+ @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+ rm -r \$(SRC)/\$\$ROOT && \\
+ if [ -e \$(SRC)/$name-build ]; then \\
+ rm -r \$(SRC)/$name-build; \\
+ fi;
+EOF
+) >> $MKFILE.tmp
+}
+
+
+
+#----------------------------------#
+wrt_run_as_chroot1() { #
+#----------------------------------#
+ local this_script=$1
+ local file=$2
+(
+ cat << EOF
+ @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/${this_script} && \\
+ \$(CHROOT1) 'cd /jhalfs && source envars && /jhalfs/${PROGNAME}-commands/$file >>/jhalfs/logs/${this_script} 2>&1' && \\
+ echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/${this_script}
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_run_as_chroot2() { #
+#----------------------------------#
+ local this_script=$1
+ local file=$2
+(
+cat << EOF
+ @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/${this_script} && \\
+ \$(CHROOT2) 'cd /jhalfs && source envars && /jhalfs/${PROGNAME}-commands/$file >>/jhalfs/logs/${this_script} 2>&1' && \\
+ echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/${this_script}
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_copy_fstab() { #
+#----------------------------------#
+ local i=$1
+(
+ cat << EOF
+ @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >logs/$i && \\
+ cp -v $FSTAB \$(MOUNT_PT)/etc/fstab >>logs/$i 2>&1 && \\
+ echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(MOUNT_PT)\`\n" >>logs/$i
+EOF
+) >> $MKFILE.tmp
+}
+
+#----------------------------------#
+wrt_copy_fstab2() { #
+#----------------------------------#
+ local i=$1
+(
+ cat << EOF
+ @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \`\n" >logs/$i && \\
+ cp -v /sources/fstab /etc/fstab >>logs/$i 2>&1 && \\
+ echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \`\n" >>logs/$i
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------------#
+wrt_export_pkgdir() { #
+#----------------------------------#
+(
+ cat << EOF
+ @echo "export PKGDIR=\$(SRC)/binutils-build" > envars
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------#
+run_make() {
+#----------------------------#
+ # Test if make must be run.
+ if [ "$RUNMAKE" = "1" ] ; then
+ # Test to make sure we're running the build as root
+ if [ "$UID" != "0" ] ; then
+ echo "You must be logged in as root to successfully build the system."
+ exit 1
+ fi
+ # Build the system
+ if [ -e $MKFILE ] ; then
+ echo -ne "Building the system...\n"
+ cd $JHALFSDIR && make -f ${PROGNAME}-Makefile
+ echo -ne "done\n"
+ fi
+ fi
+}
+
+
+#----------------------------#
+clean_builddir() {
+#----------------------------#
+ # Test if the clean must be done.
+ if [ "$CLEAN" = "1" ] ; then
+ # Test to make sure we're running the clean as root
+ if [ "$UID" != "0" ] ; then
+ echo "You must be logged in as root to clean the build directory."
+ exit 1
+ fi
+ # Test to make sure that the build directory was populated by jhalfs
+ if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
+ echo "Looks like $BUILDDIR was not populated by a previous jhalfs-X run."
+ exit 1
+ else
+ # Clean the build directory
+ echo -ne "Cleaning $BUILDDIR...\n"
+ rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var}
+ echo -ne "Cleaning $JHALFSDIR...\n"
+ rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
+ echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n"
+ rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
+ echo -ne "done\n"
+ fi
+ fi
+}
+
+#----------------------------#
+get_book() {
+#----------------------------#
+ cd $JHALFSDIR
+
+ if [ -z $WC ] ; 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"
+ echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
+
+ case $PROGNAME in
+ lfs) svn_root="LFS" ;;
+ hlfs) svn_root="HLFS" ;;
+ clfs) svn_root="cross-lfs" ;;
+ blfs) svn_root="BLFS" ;;
+ *) echo "BOOK not defined in function "
+ exit 1 ;;
+ esac
+ # Grab a fresh book if it's missing, otherwise, update it from the
+ # repo. If we've already extracted the commands, move on to getting the
+ # sources.
+ if [ -d ${PROGNAME}-$LFSVRS ] ; then
+ cd ${PROGNAME}-$LFSVRS
+ if LC_ALL=C svn up | grep -q At && test -d $JHALFSDIR/commands && \
+ test -f $JHALFSDIR/packages && test -f $JHALFSDIR/patches ; then
+ echo -ne "done\n"
+ # Set the canonical book version
+ cd $JHALFSDIR
+ VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
+ get_sources
+ else
+ echo -ne "done\n"
+ # Set the canonical book version
+ cd $JHALFSDIR
+ VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
+ extract_commands
+ fi
+ else
+ case $LFSVRS in
+ development)
+ svn co $SVN/${svn_root}/trunk/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
+ alphabetical)
+ svn co $SVN/${svn_root}/branches/$LFSVRS/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
+ udev_update)
+ svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
+ esac
+ echo -ne "done\n"
+ # Set the canonical book version
+ cd $JHALFSDIR
+ VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
+ extract_commands
+ fi
+ else
+ echo -ne "Using $BOOK as book's sources ...\n"
+ # Set the canonical book version
+ cd $JHALFSDIR
+ VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
+ extract_commands
+ fi
+}
+
+
+#----------------------------#
+build_patches_file() { # Supply a suitably formated list of patches.
+#----------------------------#
+ local saveIFS=$IFS
+ local IFS
+
+ rm -f patches
+
+ LOC_add_patches_entry() {
+ for f in `grep "/$1-" patcheslist_.wget`; do
+ basename $f | sed "s|${2}|\&${1}-version;|" >> patches
+ done
+ }
+
+ case ${PROGNAME} in
+ hlfs)
+ echo -n "Creating the HLFS ${L_arrow}${BOLD}$MODEL${R_arrow} specific patches file"
+ xsltproc --nonet \
+ --xinclude \
+ --stringparam model $MODEL \
+ -o patcheslist_.wget \
+ patcheslist.xsl \
+ $BOOK/chapter04/patches.xml
+ #> /dev/null 2>&1
+
+ # .... U G L Y .... what to do with the grsecurity patch to the kernel..
+ for f in `grep "/grsecurity-" patcheslist_.wget`; do
+ basename $f >> patches
+ done
+ ;;
+
+ clfs) # Pull out a list of arch specific patches
+ echo -n "Creating CLFS ${L_arrow}${BOLD}$ARCH${R_arrow} specific patches file"
+ xsltproc -xinclude \
+ -o patcheslist_.wget \
+ patcheslist.xsl \
+ $BOOK/materials/${ARCH}-chapter.xml
+ ;;
+ *) return
+ esac
+
+
+ IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
+ for f in `cat packages`; do
+ IFS=$saveIFS # Restore the system defaults
+ LOC_add_patches_entry \
+ `echo $f | sed -e 's/-version//' \
+ -e 's/-file.*//' \
+ -e 's/"//g' \
+ -e 's/uclibc/uClibc/'`
+ done
+
+ rm -f patcheslist_.wget
+
+ echo " ...OK"
+}
+
+
+#----------------------------#
+extract_commands() { #
+#----------------------------#
+ local saveIFS=$IFS
+
+ # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
+ test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
+ exit 1"
+
+ cd $JHALFSDIR
+ VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
+
+ # Start clean
+ if [ -d commands ]; then
+ rm -rf commands
+ mkdir -v commands
+ fi
+ echo -n "Extracting commands for"
+
+ # Dump the commands in shell script form from the HLFS book.
+ case ${PROGNAME} in
+ clfs)
+ echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
+ xsltproc --nonet \
+ --xinclude \
+ --stringparam method $METHOD \
+ --stringparam testsuite $TEST \
+ --stringparam vim-lang $VIMLANG \
+ --stringparam timezone $TIMEZONE \
+ --stringparam page $PAGE \
+ --stringparam lang $LANG \
+ --stringparam keymap $KEYMAP \
+ -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
+ ;;
+ hlfs)
+ echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation"
+ xsltproc --nonet \
+ --xinclude \
+ --stringparam model $MODEL \
+ --stringparam testsuite $TEST \
+ --stringparam timezone $TIMEZONE \
+ --stringparam page $PAGE \
+ --stringparam lang $LANG \
+ --stringparam lc_all $LC_ALL \
+ --stringparam keymap $KEYMAP \
+ --stringparam grsecurity_host $GRSECURITY_HOST \
+ -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
+ ;;
+ lfs)
+ echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build"
+ xsltproc --nonet \
+ --xinclude \
+ --stringparam testsuite $TEST \
+ --stringparam vim-lang $VIMLANG \
+ --stringparam timezone $TIMEZONE \
+ --stringparam page $PAGE \
+ --stringparam lang $LANG \
+ -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
+ ;;
+ blfs)
+ echo -n " ${L_arrow}${BOLD}BLFS${R_arrow} build"
+ xsltproc --nonet \
+ --xinclude \
+ --stringparam testsuite $TEST \
+ --stringparam server $SERVER \
+ -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
+ ;;
+ *) exit 1
+ esac
+
+ echo " ...OK"
+
+ # Make the scripts executable.
+ chmod -R +x $JHALFSDIR/${PROGNAME}-commands
+
+ # Grab the patches and package names.
+ for i in patches packages ; do
+ rm -f $i
+ done
+ #
+ case "${PROGNAME}" in
+ clfs)
+ ################################
+ # A LOCAL function
+ # xx_.wget contains arch specific files but in URL format
+ # Build a file with only arch specific files.. small ugly..
+ LOC_add_packages_entry() {
+ local fileMATCH aFILE
+
+ # Deal with a non-standard format
+ if [[ "$1" = "clfs-bootscripts" ]]; then
+ set -- "bootscripts-cross-lfs" $2
+ fi
+ fileMATCH="/$1"
+
+ # format.. Filename-Version or FilenameVersion
+ for aFILE in `grep ${fileMATCH}-*[[:digit:]] packageslist_.wget`; do
+ # Block vim-x.x-lang file, will add it later based on config flag
+ if [[ ! "${aFILE}" =~ "vim-$2-lang" ]]; then
+ echo "$1-version \"$2\"" >> packages
+ fi
+ done
+ }
+ #################################
+
+ # We only want a list arch specific files..
+ # Unfortunately this script produces URL's which must be converted to a std format
+ echo -n "Creating CLFS ${L_arrow}${BOLD}${ARCH}${R_arrow} specific packages file"
+ xsltproc -xinclude \
+ -o packageslist_.wget \
+ packageslist.xsl \
+ $BOOK/materials/${ARCH}-chapter.xml
+
+ # This has the correct format but contains packages from every book
+ grep "\-version " $BOOK/packages.ent | sed -e 's@@"@' \
+ -e '/generic/d' > packages.tmp
+ # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
+ # separates each iteration by lines.
+ # Modify the 'internal field separator' to break on 'LF' only
+ IFS=$'\x0A'
+ for f in `cat packages.tmp`; do
+ IFS=$saveIFS # Restore the system defaults
+ LOC_add_packages_entry \
+ `echo $f | sed -e 's/-version//' \
+ -e 's/-file.*//' \
+ -e 's/"//g'`
+ done
+
+ rm -f packageslist_.wget packages.tmp
+
+ echo " ...OK"
+ ;;
+
+ hlfs)
+ echo -n "Creating <${PROGNAME}> specific packages file"
+ grep "\-version" $BOOK/general.ent | sed -e 's@@"@' \
+ -e '/generic/d' >> packages
+ echo " ...OK"
+ ;;
+
+ lfs)
+ echo -n "Creating <${PROGNAME}> specific packages file"
+ grep "\-version" $BOOK/general.ent | sed -e 's@@"@' \
+ -e '/generic/d' >> packages
+ echo `grep "glibc" packages | sed 's@glibc@glibc-libidn@'` >> packages
+ echo `grep "udev-config-file" $BOOK/general.ent | sed -e 's@@"@'` >> packages
+ echo " ...OK"
+ ;;
+ esac
+
+ # Download the vim-lang package if it must be installed
+ if [ "$VIMLANG" = "1" ] && [ ! "$PROGNAME" = "hlfs" ] ; then
+ echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages
+ fi
+
+ # Create the patches file
+ case "${PROGNAME}" in
+ hlfs)
+ build_patches_file ;;
+ clfs )
+ build_patches_file ;;
+ lfs)
+ grep "^<\!ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
+ ;;
+ blfs) ;;
+ *) exit 1
+ esac
+
+ # Done. Moving on...
+ get_sources
+}
+
+
+#----------------------------#
+download() { # Download file, write name to MISSING_FILES.DMP if an error
+#----------------------------#
+ cd $BUILDDIR/sources
+
+ # Hackish fix for the bash-doc, glibc-{linuxthreads,libidn}
+ # that don't conform to norms in the URL scheme.
+ DIR=`echo $1 | sed 's@-doc@@;s@-linuxthreads@@;s@-libidn@@;s@-testsuite@@'`
+
+ # If the file exists in the archive copy it to the $BUILDDIR/sources dir
+ # MD5SUM is assumed to be correct from previous download
+ if [ ! -z ${SRC_ARCHIVE} ] &&
+ [ -d ${SRC_ARCHIVE} ] &&
+ [ -f ${SRC_ARCHIVE}/$2 ]; then
+ cp ${SRC_ARCHIVE}/$2 .
+ echo "$2: -- ok"
+ return
+ fi
+
+ # Find the md5 sum for this package.
+ if [ $2 != MD5SUMS ] ; then
+ set +e
+ MD5=`grep " $2" MD5SUMS`
+ if [ $? -ne 0 ]; then
+ set -e
+ echo "${RED}$2 not found in MD5SUMS${OFF}"
+ echo "$2 not found in MD5SUMS" >> MISSING_FILES.DMP
+ return
+ fi
+ set -e
+ fi
+
+ if [ ! -f $2 ] ; then
+ case $DL in
+ wgetFTP ) wget --passive $FTP/$DIR/$2 ;;
+ wget ) wget $HTTP/$DIR/$2 ;;
+ curl ) `curl -# $FTP/$DIR/$2 -o $2` ;;
+ * ) echo "$DL not supported at this time." ;;
+ esac
+ elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
+ case $DL in
+ wgetFTP ) wget --passive -c $FTP/$DIR/$2 ;;
+ wget ) wget -c $HTTP/$DIR/$2 ;;
+ curl ) `curl -# -C - $FTP/$DIR/$2 -o $2` ;;
+ * ) echo "$DL not supported at this time." ;;
+ esac
+ fi
+
+ if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then
+ exit 1
+ fi
+ if [ $2 != MD5SUMS ] ; then
+ echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION
+ fi
+
+ # If we make it this far we should copy the freshly downloaded file
+ # to the source archive.
+ if [ ! -z ${SRC_ARCHIVE} ] &&
+ [ -d ${SRC_ARCHIVE} ] &&
+ [ -w ${SRC_ARCHIVE} ] &&
+ [ $2 != MD5SUMS ]; then
+ echo "Store file:<$2> in package archive"
+ cp -v $2 ${SRC_ARCHIVE}
+ fi
+
+}
+
+
+#----------------------------#
+get_sources() {
+#----------------------------#
+
+ # Test if the packages must be downloaded
+ if [ "$HPKG" = "1" ] ; then
+
+ # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
+ # separates each iteration by lines.
+ # Modify the 'internal field separator' to break on 'LF' only
+ IFS=$'\x0A'
+
+ if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
+ cd $BUILDDIR/sources
+ if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
+ if [ -f MD5SUMS-$VERSION ] ; then rm MD5SUMS-$VERSION ; fi
+ if [ -f MISSING_FILES.DMP ] ; then rm MISSING_FILES.DMP ; fi
+
+ download "" MD5SUMS
+
+ # Iterate through each package and grab it, along with any patches it needs.
+ for i in `cat $JHALFSDIR/packages` ; do
+ PKG=`echo $i | sed -e 's/-version.*//' -e 's/-file.*//'`
+
+ # There are some entities that aren't valid packages.
+ if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi
+
+ VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
+ case $PKG in
+ tcl) FILE="$PKG$VRS-src.tar.bz2" ;;
+ vim-lang) PKG="vim"
+ FILE="vim-$VRS-lang.tar.bz2" ;;
+ udev-config) PKG="udev"
+ FILE="$VRS" ;;
+ *) FILE="$PKG-$VRS.tar.bz2" ;;
+ esac
+ download $PKG $FILE
+
+ # Download any associated patches
+ for patch in `grep "&$PKG-version" $JHALFSDIR/patches` ; do
+ PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
+ download $PKG $PATCH
+ done
+ done
+ if [[ -s $BUILDDIR/sources/MISSING_FILES.DMP ]]; then
+ echo -e "\n\n${tab_}${RED} One or more files were not retrieved.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n\n"
+ fi
+ fi
+}
+
diff --git a/common/config b/common/config
new file mode 100644
index 0000000..eae4146
--- /dev/null
+++ b/common/config
@@ -0,0 +1,75 @@
+#####
+#
+# common configuration file
+#
+# $Id$
+#####
+
+declare -r SVN="svn://svn.linuxfromscratch.org"
+declare -r LOG=000-masterscript.log
+declare -r HTTP=http://ftp.lfs-matrix.net/pub/lfs/conglomeration
+
+#--- Mount point for the build
+BUILDDIR=/mnt/build_dir
+
+#--- The local repository for packages/file
+# Any missing file will be downloaded and archived here,
+# if the user has the right priviledges.
+SRC_ARCHIVE=
+
+#--- Download the source packages 0(no)/1(yes)
+HPKG=0
+
+#--- Run the makefile at the end 0(no)/1(yes)
+# In BLFS the Makefile can't be run automatically
+RUNMAKE=0
+
+#--- Run test suites [0-3]
+# 0 = none
+# 1 = only chapter06 Glibc, GCC and Binutils testsuites
+# (in BLFS, run the package testsuite, if any)
+# 2 = all chapter06 testsuites
+# (in BLFS, alias to 1)
+# 3 = all chapter05 and chapter06 testsuites
+# (in BLFS, alias to 1)
+# (in CLFS, alias to 2)
+TEST=1
+
+#--- Run the stripping phases 0(no)/1(yes)
+STRIP=1
+
+#--- page definition for groff letter/A4
+PAGE=letter
+
+#--- set default timezone.
+TIMEZONE=America/Toronto
+
+#--- install the optional vim-lang package 0(no)/1(yes)
+VIMLANG=1
+
+#--- 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 ICA (Not implemented yet :-/)===
+#--- 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 ====
+# Don't edit it unless you know what you are doing
+
+#--- Working directories
+JHALFSDIR=$BUILDDIR/jhalfs
+ LOGDIR=$JHALFSDIR/logs
diff --git a/common/func_ICA.sh b/common/func_ICA.sh
new file mode 100644
index 0000000..c648517
--- /dev/null
+++ b/common/func_ICA.sh
@@ -0,0 +1,179 @@
+# $Id$
+
+# Acknowledgment:
+# The following code is a modified version of an original work written by
+# Greg Schafer for the "DIY Linux" project and is included here with his
+# permission.
+# ref: http://www.diy-linux.org
+#
+#
+# ---------------------------------------------------------------------------- #
+# Here are the ICA functions.
+# ---------------------------------------------------------------------------- #
+#
+# Here we prepare for the Iterative Comparison Analysis (ICA). Essentially, we
+# copy most of our chroot phase files to a new location then perform some
+# manipulations on the copied files to make diff comparisons easier. The steps
+# involved are:-
+# (1) copy the whole tree (minus the PRUNEPATH defined below) to the CMP_DIR
+# location. Use tar as it seems like the most appropriate tool for copying
+# large directory trees around.
+# (2) delete all symlinks.
+# (3) gunzip all `*.gz' files.
+# (4) delete all hardlinked files (of course trying to leaving the "master"
+# intact)
+# (5) convert all `*.a' files (ar archives) into a directory of the same name
+# containing the unpacked object files.
+# (6) fully strip the whole lot (but being careful to strip only the debug
+# symbols from object `*.o' files).
+
+#----------------------------------#
+do_ica_prep() { #
+#----------------------------------#
+: <> $TMP_FILE
+ done
+
+ echo -n "Copying files to ${CMP_DIR}... "
+ cd /
+ tar -X $TMP_FILE -cf - . | tar -C $CMP_DIR -xf - || {
+ echo -e "\n\n${RED}ERROR:${OFF} tar copy failed!\n" >&2
+ exit 1
+ }
+ echo "done."
+ rm -f $TMP_FILE
+
+ echo -n "Removing symbolic links in ${CMP_DIR}... "
+ find $CMP_DIR -type l | xargs rm -f
+ echo "done."
+
+ echo -n "Gunzipping \".gz\" files in ${CMP_DIR}... "
+ find $CMP_DIR -name '*.gz' | xargs gunzip
+ echo "done."
+
+ # This was a bit tricky. You'll probably have to do it by hand
+ # to see what's actually going on. The "sort/uniq" part is
+ # inspired from the example DirCmp script from the book "Shell
+ # Programming Examples" by Bruce Blinn, published by Prentice
+ # Hall. We are essentially using the `-ls' option of the find
+ # utility to allow manipulations based on inode numbers.
+ #
+ # FIXME - this is a bit unreliable - rem out for now
+ #echo -n "Removing hardlinked file copies in ${CMP_DIR}... "
+ #find $CMP_DIR -ls | sort -n > $ALL_FILES
+ #find $CMP_DIR -ls | sort -n -u > $UNIQUE_FILES
+ #cat $UNIQUE_FILES $ALL_FILES | sort | uniq -u | awk '{ print $11 }' | xargs rm -f
+ #rm -f $ALL_FILES $UNIQUE_FILES
+ #echo "done."
+
+ # ar archives contain date & time stamp info that causes us
+ # grief when trying to find differences. Here we perform some
+ # hackery to allow easy diffing. Essentially, replace each
+ # archive with a dir of the same name and extract the object
+ # files from the archive into this dir. Despite their names,
+ # libieee.a & libmcheck.a are not actual ar archives.
+ #
+ echo -n "Extracting object files from \".a\" files in ${CMP_DIR}... "
+ L=$(find $CMP_DIR -name '*.a' ! -name 'libieee.a' ! -name 'libmcheck.a')
+
+ for F in $L; do
+ mv $F ${F}.XX
+ mkdir $F
+ cd $F
+ BN=${F##*/}
+ ar x ../${BN}.XX || {
+ echo -e "\n\n${RED}ERROR:${OFF} ar archive extraction failed!\n" >&2
+ exit 1
+ }
+ rm -f ../${BN}.XX
+ done
+ echo "done."
+
+ echo -n "Stripping (debug) symbols from \".o\" files in ${CMP_DIR}... "
+ find $CMP_DIR -name '*.o' | xargs strip -p -g 2>/dev/null
+ echo "done."
+
+ echo -n "Stripping (all) symbols from files OTHER THAN \".o\" files in ${CMP_DIR}... "
+ find $CMP_DIR ! -name '*.o' | xargs strip -p 2>/dev/null || :
+ echo "done."
+
+ echo -e "\n${CYAN}[ICA] - ICA preparation for Iteration ${ITER}\c"
+ echo -e " complete.${OFF}\n${BORDER}"
+ do_stamp icaprep
+ fi
+}
+
+
+#----------------------------------#
+do_ica_work() { # Do the ICA grunt work.
+#----------------------------------#
+: < $RAWDIFF || :
+ echo "done."
+
+ echo -e "The list of binary files that differ:\n" > $REPORT
+ grep "iles.*differ$" $RAWDIFF >> $REPORT
+ echo -e "\n" >> $REPORT
+
+ echo -e "The list of files that exist \"only in\" 1 of the directories:\n" >> $REPORT
+
+ if grep "^Only in" $RAWDIFF >/dev/null 2>&1; then
+ grep "^Only in" $RAWDIFF >> $REPORT
+ else
+ echo NONE >> $REPORT
+ fi
+
+ grep -v "iles.*differ$" $RAWDIFF | grep -v "^Only in" > ${SCRATCH_DIR}/logs/${1}V${2}.ASCII.DIFF
+ rm -f $RAWDIFF
+
+}
diff --git a/common/func_check_version.sh b/common/func_check_version.sh
new file mode 100644
index 0000000..84e6936
--- /dev/null
+++ b/common/func_check_version.sh
@@ -0,0 +1,65 @@
+# $Id$
+
+check_version() {
+: <&1 >/dev/null ||
+# 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() {
+ 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:\t${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
+ IFS=".-(" # 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 " ..OK" && return
+ (( major < ref_major )) && write_error_and_die
+ # major=ref_major
+ (( minor < ref_minor )) && write_error_and_die
+ (( minor > ref_minor )) && echo " ..OK" && return
+ # minor=ref_minor
+ (( revision >= ref_revision )) && echo " ..OK" && return
+
+ # oops.. write error msg and die
+ write_error_and_die
+}
+
diff --git a/common/func_validate_configs.sh b/common/func_validate_configs.sh
new file mode 100644
index 0000000..727ddcc
--- /dev/null
+++ b/common/func_validate_configs.sh
@@ -0,0 +1,245 @@
+# $Id$
+
+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: ${L_arrow}${BOLD}${TARGET}${OFF}${R_arrow}'
+ local -r PARAM_VALS2='TARGET32: ${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
+ ;;
+ "sparcv8") [[ "${TARGET}" = "sparc-unknown-linux-gnu" ]] && return
+ ;;
+ "x86_64-64") [[ "${TARGET}" = "x86_64-unknown-linux-gnu" ]] && return
+ ;;
+ "mips64-64") [[ "${TARGET}" = "mipsel-unknown-linux-gnu" ]] && return
+ [[ "${TARGET}" = "mips-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}" = "mipsel-unknown-linux-gnu" ]] &&
+ [[ "${TARGET32}" = "mipsel-unknown-linux-gnu" ]] && return
+
+ [[ "${TARGET}" = "mips-unknown-linux-gnu" ]] &&
+ [[ "${TARGET32}" = "mips-unknown-linux-gnu" ]] && return
+ ;;
+ "sparc64") [[ "${TARGET}" = "sparc64-unknown-linux-gnu" ]] &&
+ [[ "${TARGET32}" = "sparcv9-unknown-linux-gnu" ]] && return
+ ;;
+ "ppc64") [[ "${TARGET}" = "powerpc64-unknown-linux-gnu" ]] &&
+ [[ "${TARGET32}" = "powerpc-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)
+#----------------------------#
+: <&2
+ echo -e "`eval echo ${ERROR_MSG_pt2}`" >&2
+ echo -e "${DD_BORDER}\n"
+ exit 1
+ }
+
+ validate_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 [[ ! "${validation_str}" =~ "x${!config_param}x" ]] ; then
+ # parameter value entered is no good
+ write_error_and_die
+ fi
+ }
+
+ set +e
+ for PARAM_GROUP in ${PROGNAME}_PARAM_LIST; do
+ for config_param in ${!PARAM_GROUP}; do
+ # This is a tricky little piece of code.. executes a cmd string.
+ case $config_param in
+ BUILDDIR) # We cannot have an or > root mount point
+ echo -e "`eval echo $PARAM_VALS`"
+ if [[ "xx x/x" =~ "x${!config_param}x" ]]; then
+ write_error_and_die
+ fi
+ continue ;;
+ TIMEZONE) continue;;
+ MKFILE) continue;;
+ HPKG) validation_str="x0x x1x"; validate_str; continue ;;
+ RUNMAKE) validation_str="x0x x1x"; validate_str; continue ;;
+ TEST) validation_str="x0x x1x x2x x3x"; validate_str; continue ;;
+ STRIP) validation_str="x0x x1x"; validate_str; continue ;;
+ VIMLANG) validation_str="x0x x1x"; validate_str; continue ;;
+ DEPEND) validation_str="x0x x1x x2x"; validate_str; continue ;;
+ MODEL) validation_str="xglibcx xuclibcx"; validate_str; continue ;;
+ PAGE) validation_str="xletterx xA4x"; validate_str; continue ;;
+ GRSECURITY_HOST) validation_str="x0x x1x"; validate_str; continue ;;
+ METHOD) validation_str="xchrootx xbootx"; validate_str; continue ;;
+ ARCH) validation_str="xx86x xx86_64x xx86_64-64x xsparcx xsparcv8x xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax"; validate_str; continue ;;
+ TARGET) validate_target; continue ;;
+ esac
+
+
+ if [[ "${config_param}" = "LC_ALL" ]]; then
+ echo "`eval echo $PARAM_VALS`"
+ [[ -z "${!config_param}" ]] && continue
+ # See it the locale values exist on this machine
+ if [[ "`locale -a | grep -c ${!config_param}`" > 0 ]]; then
+ continue
+ else # If you make it this far then there is a problem
+ write_error_and_die
+ fi
+ fi
+
+ if [[ "${config_param}" = "LANG" ]]; then
+ echo "`eval echo $PARAM_VALS`"
+ [[ -z "${!config_param}" ]] && continue
+ # See it the locale values exist on this machine
+ if [[ "`locale -a | grep -c ${!config_param}`" > 0 ]]; then
+ continue
+ else # If you make it this far then there is a problem
+ write_error_and_die
+ fi
+ fi
+
+
+ if [[ "${config_param}" = "KEYMAP" ]]; then
+ echo "`eval echo $PARAM_VALS`"
+ [[ "${!config_param}" = "none" ]] && continue
+ if [[ -e "/usr/share/kbd/keymaps/${!config_param}" ]] &&
+ [[ -s "/usr/share/kbd/keymaps/${!config_param}" ]]; then
+ continue
+ else
+ write_error_and_die
+ fi
+ fi
+
+ if [[ "${config_param}" = "SRC_ARCHIVE" ]]; then
+ echo -n "`eval echo $PARAM_VALS`"
+ if [ ! -z ${SRC_ARCHIVE} ]; then
+ if [ ! -d ${SRC_ARCHIVE} ]; then
+ echo " -- is NOT a directory"
+ write_error_and_die
+ fi
+ if [ ! -w ${SRC_ARCHIVE} ]; then
+ echo -n "${nl_} [${BOLD}${YELLOW}WARN$OFF] You do not have access to this directory, ${nl_}${tab_}downloaded files can not be saved in this archive"
+ fi
+ fi
+ echo
+ continue
+ fi
+
+ if [[ "${config_param}" = "FSTAB" ]]; then
+ echo "`eval echo $PARAM_VALS`"
+ [[ -z "${!config_param}" ]] && continue
+ if [[ -e "${!config_param}" ]] &&
+ [[ -s "${!config_param}" ]]; then
+ continue
+ else
+ write_error_and_die
+ fi
+ fi
+
+ if [[ "${config_param}" = "BOOK" ]]; then
+ echo "`eval echo $PARAM_VALS`"
+ [[ ! "${WC}" = 1 ]] && continue
+ [[ -z "${!config_param}" ]] && continue
+ if [[ -e "${!config_param}" ]] &&
+ [[ -s "${!config_param}" ]]; then
+ continue
+ else
+ write_error_and_die
+ fi
+ fi
+
+ if [[ "${config_param}" = "CONFIG" ]]; then
+ echo "`eval echo $PARAM_VALS`"
+ [[ -z "${!config_param}" ]] && continue
+ if [[ -e "${!config_param}" ]] &&
+ [[ -s "${!config_param}" ]]; then
+ continue
+ else
+ write_error_and_die
+ fi
+ fi
+
+ if [[ "${config_param}" = "BOOT_CONFIG" ]]; then
+ if [[ "${METHOD}" = "boot" ]]; then
+ echo "`eval echo $PARAM_VALS`"
+ # There must be a config file when the build method is 'boot'
+ [[ -e "${!config_param}" ]] && [[ -s "${!config_param}" ]] && continue
+ # If you make it this far then there is a problem
+ write_error_and_die
+ fi
+ fi
+ done
+ done
+
+ set -e
+ echo "$tab_***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***"
+}
diff --git a/common/makefile-functions b/common/makefile-functions
new file mode 100644
index 0000000..2a62397
--- /dev/null
+++ b/common/makefile-functions
@@ -0,0 +1,91 @@
+
+# $Id$
+
+BOLD= "[0;1m"
+RED= "[1;31m"
+GREEN= "[0;32m"
+ORANGE= "[0;33m"
+BLUE= "[1;34m"
+WHITE= "[00m"
+
+define echo_message
+ @echo $(BOLD)
+ @echo --------------------------------------------------------------------------------
+ @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)
+ @echo --------------------------------------------------------------------------------$(WHITE)
+endef
+
+define unpack
+ @cd $(MOUNT_PT)$(SRC) && \
+ tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
+endef
+
+define unpack2
+ @cd $(MOUNT_PT)$(SRC) && \
+ /tools/bin/tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
+endef
+
+define unpack3
+ @cd $(SRC) && \
+ tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
+endef
+
+define echo_finished
+ @echo $(BOLD)
+ @echo --------------------------------------------------------------------------------
+ @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
+ @echo --------------------------------------------------------------------------------
+ @echo -e \\t\\t$(RED)W A R N I N G$(BOLD)
+ @echo --------------------------------------------------------------------------------
+ @echo
+ @echo To be able to boot your new system you need to follow
+ @echo the next steps:$(WHITE)
+ @echo
+ @echo -e \\t- Enter to the chroot using the command found
+ @echo -e \\tin the section -Entering the Chroot Environment-
+ @echo -e \\texcept if building CLFS with METHOO=boot.
+ @echo
+ @echo -e \\t- Set a password for the root user
+ @echo
+ @echo -e \\t- Edit /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
+ @echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network,
+ @echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
+ @echo -e \\tany other configuration file required to suit your needs.
+ @echo
+ @echo -e \\t- Set-up the boot loader. See the relevant book section.
+ @echo
+ @echo -e \\t- Unmount the filesystems.
+ @echo
+ @echo If you are an experienced LFS user, several of those steps can be
+ @echo skipped or done in a different way. But then, that is something
+ @echo that you already know and there is no need to discuss it here.
+ @echo $(BOLD)
+ @echo --------------------------------------------------------------------------------
+ @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
+ @echo --------------------------------------------------------------------------------$(WHITE)
+endef
+
+define echo_boot_finished
+ @echo $(BOLD)
+ @echo --------------------------------------------------------------------------------
+ @echo $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
+ @echo --------------------------------------------------------------------------------
+ @echo -e \\t\\t$(RED)W A R N I N G$(BOLD)
+ @echo --------------------------------------------------------------------------------
+ @echo
+ @echo The build is not complete. Follow the next steps:$(WHITE)
+ @echo
+ @echo -e \\t- Edit $(MOUNT_PT)/etc/fstab
+ @echo -e \\t and any other configuration file required to suit your needs.
+ @echo $(BOLD)
+ @echo $(BOLD)$(YELLOW)
+ @echo 1.If it is necessary, transfer the newly created partition to the target machine
+ @echo 2.Boot the new partition.
+ @echo 3.Once you are logged in issue the following commands
+ @echo -e \\t $(BOLD})cd /jhalfs
+ @echo -e \\t $(BOLD)make makesys
+ @echo The build process should resume. Follow any instructions that appear.
+ @echo --------------------------------------------------------------------------------
+ @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
+ @echo --------------------------------------------------------------------------------$(WHITE)
+endef
diff --git a/functions b/functions
deleted file mode 100644
index ff3ed59..0000000
--- a/functions
+++ /dev/null
@@ -1,59 +0,0 @@
-BOLD= "[0;1m"
-RED= "[1;31m"
-GREEN= "[0;32m"
-ORANGE= "[0;33m"
-BLUE= "[1;34m"
-WHITE= "[00m"
-
-define echo_message
- @echo $(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$(WHITE)
-endef
-
-define unpack
- @if [ -f $(LFS)$(SRC)/$(1).bz2 ] ; then \
- cd $(LFS)$(SRC) ; tar -xvjf $(1).bz2 > /tmp/unpacked ; \
- else \
- cd $(LFS)$(SRC) ; tar -xvzf $(1).gz > /tmp/unpacked ; \
- fi ;
-endef
-
-define unpack2
- @cd $(LFS)$(SRC) ; /tools/bin/tar -xvf $(1) > /tmp/unpacked
-endef
-
-define echo_finished
- @echo $(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @echo $(BOLD) Finished the build of $(BLUE)LFS-$(1)$(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @echo -e \\t\\t$(RED)W A R N I N G$(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @echo
- @echo To be able to boot your new LFS system you need to follow
- @echo the next steps:$(WHITE)
- @echo
- @echo -e \\t- Enter to the chroot using the command found
- @echo -e \\tin chapter06/revisedchroot.html
- @echo
- @echo -e \\t- Set a password for the root user
- @echo
- @echo -e \\t- Edit /etc/fstab, /etc/hosts, /etc/sysconfig/clock,
- @echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network,
- @echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and
- @echo -e \\tany other configuration file required to suit your needs.
- @echo
- @echo -e \\t- Set-up Grub. See chapter08/grub.html
- @echo
- @echo -e \\t- Unmount the filesystems. See chapter09/reboot.html
- @echo
- @echo If you are an experienced LFS user, several of those steps can be
- @echo skipped or done in a different way. But then, that is something
- @echo that you already know and there is no need to discuss it here.
- @echo $(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @echo -e \\t\\t$(GREEN)Have a nice day $(ORANGE):-\)$(BOLD)
- @echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$(WHITE)
-endef
diff --git a/hlfs b/hlfs
new file mode 120000
index 0000000..fba0373
--- /dev/null
+++ b/hlfs
@@ -0,0 +1 @@
+master.sh
\ No newline at end of file
diff --git a/jhalfs b/jhalfs
deleted file mode 100755
index f9d9f85..0000000
--- a/jhalfs
+++ /dev/null
@@ -1,1069 +0,0 @@
-#!/bin/sh
-
-#
-# Load the configuration file
-#
-source jhalfs.conf
-
-
-version="
-jhalfs development \$Date$
-
-Written by Jeremy Huntwork and Manuel Canales Esparcia.
-
-This program is published under the \
-Gnu General Public License, Version 2.
-"
-
-usage="\
-Usage: $0 [OPTION]
-
-Options:
- -h, --help print this help, then exit
-
- -V, --version print version number, then exit
-
- -d --directory DIR use DIR directory for building LFS; all files
- jhalfs produces will be in the directory
- DIR/jhalfs. Default is \"/mnt/lfs\".
-
- --rebuild clean the build directory before to perfom
- any other task. The directory is cleaned
- only if it was populated by a previous
- jhalfs run.
-
- -P, --get-packages download the packages and patches. This
- assumes that the server declared in the
- jhalfs.conf file has the proper packages
- and patches for the book version being
- processed.
-
- -D, --download-client CLIENT use CLIENT as the program for retrieving
- packages (for use in conjunction with -P)
-
- -W, --working-copy DIR use the local working copy placed in DIR
- as the LFS book
-
- -L, --LFS-version VER checkout VER version of the LFS book.
- Supported versions at this time are:
-
- dev* | trunk | SVN aliases for Development LFS
- alpha* aliases for the alphabetical branch
- udev* aliases for the udev_update branch
-
- For stable 6.1.1 book, please use jhalfs-0.2.
-
- -T, --testsuites LEVEL add support to run the optional testsuites.
- Available LEVEL values are:
-
- 0 No testsuites run. This also disables the
- build of TCL, Expect and DejaGNU
- 1 Run only final system Glic, GCC, and Binutils
- testsuites. Used as default
- 2 Run all final system testsuites
- 3 Run all testsuites for both temporal and final
- systems
-
- --no-strip don't run the strip command on both the
- temporary system and the final system
-
- --timezone TIMEZONE set TIMEZONE as the local timezone. If not
- specified, \"Europe/London\" will be used.
-
- --page_size PAGE set PAGE as the default page size (letter
- or A4). This setting is required to
- build Groff. If not specified, \"letter\"
- will be used.
-
- --fstab FILE use FILE as the /etc/fstab file for the
- LFS system. If not specified, a default
- /etc/fstab file with dummy values is
- created.
-
- --no-vim-lang don't install the optional vim-lang package
-
- -C, --kernel-config FILE 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.
-
- -M, --run-make run make on the generated Makefile
-
-"
-
-help="\
-Try '$0 --help' for more information."
-
-no_empty_builddir="\
-echo \"\" >&2
-echo \" W A R N I N G\" >&2
-echo \"\" >&2
-echo \"Looks like the \$BUILDDIR directory contains subdirectories\" >&2
-echo \"from a previous LFS build.\" >&2
-echo \"\" >&2
-echo \"Please format the partition mounted on \$BUILDDIR or set\" >&2
-echo \"a different build directory before running jhalfs.\" >&2
-echo \"\" >&2
-exit 1"
-
-exit_missing_arg="\
-echo \"Option '\$1' requires an argument\" >&2
-echo \"\$help\" >&2
-exit 1"
-
-no_dl_client="\
-echo \"Could not find a way to download the LFS sources.\" >&2
-echo \"Attempting to continue.\" >&2"
-
-HEADER="# This file is automatically generated by jhalfs
-# DO NOT EDIT THIS FILE MANUALLY
-#
-# Generated on `date \"+%F %X %Z\"`"
-
-
-###################################
-### FUNCTIONS ###
-###################################
-
-
-#----------------------------#
-clean_builddir() {
-#----------------------------#
- # Test if the clean must be done.
- if [ "$CLEAN" = "1" ] ; then
- # Test to make sure we're running the clean as root
- if [ "$UID" != "0" ] ; then
- echo "You must be logged in as root to clean the build directory."
- exit 1
- fi
- # Test to make sure that the build directory was populated by jhalfs
- if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
- echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
- exit 1
- else
- # Clean the build directory
- echo -ne "Cleaning $BUILDDIR...\n"
- rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,usr,var}
- echo -ne "Cleaning $JHALFSDIR...\n"
- rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,commands,logs,Makefile,dump-lfs-scripts.xsl,functions,packages,patches}
- echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n"
- rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
- echo -ne "done\n"
- fi
- fi
-}
-
-#----------------------------#
-get_book() {
-#----------------------------#
- cd $JHALFSDIR
-
- if [ -z $WC ] ; 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"
- echo -n "Downloading the LFS Book, version $LFSVRS... "
-
- # Grab a fresh LFS book if it's missing, otherwise, update it from the
- # repo. If we've already extracted the commands, move on to getting the
- # sources.
- if [ -d lfs-$LFSVRS ] ; then
- cd lfs-$LFSVRS
- if LC_ALL=C svn up | grep -q At && test -d $JHALFSDIR/commands && \
- test -f $JHALFSDIR/packages && test -f $JHALFSDIR/patches ; then
- echo -ne "done\n"
- # Set the canonical book version
- cd $JHALFSDIR
- VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
- get_sources
- else
- echo -ne "done\n"
- # Set the canonical book version
- cd $JHALFSDIR
- VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
- extract_commands
- fi
- else
- case $LFSVRS in
- development)
- svn co $SVN/LFS/trunk/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
- alphabetical)
- svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
- udev_update)
- svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
- esac
- echo -ne "done\n"
- # Set the canonical book version
- cd $JHALFSDIR
- VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
- extract_commands
- fi
- else
- echo -ne "Using $BOOK as book's sources ...\n"
- # Set the canonical book version
- cd $JHALFSDIR
- VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'`
- extract_commands
- fi
-}
-
-#----------------------------#
-extract_commands() {
-#----------------------------#
- # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
- test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
- exit 1"
- cd $JHALFSDIR
-
- # Start clean
- if [ -d commands ] ; then rm -rf commands ; fi && mkdir commands
- echo -n "Extracting commands... "
-
- # Dump the commands in shell script form from the LFS book.
- xsltproc --nonet --xinclude --stringparam testsuite $TEST \
- --stringparam vim-lang $VIMLANG \
- -o ./commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
-
- # Make the scripts executable.
- chmod -R +x $JHALFSDIR/commands
-
- # Grab the patches and package names.
- cd $JHALFSDIR
- for i in patches packages ; do rm -f $i ; done
- grep "\-version" $BOOK/general.ent | sed -e 's@@"@' \
- -e '/generic/d' >> packages
- # Download the vim-lang package if it must be installed
- if [ "$VIMLANG" = "1" ] ; then
- echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages
- fi
- echo `grep "udev-config-file" $BOOK/general.ent | sed -e 's@@"@'` >> packages
- echo `grep "glibc" packages | sed 's@glibc@glibc-libidn@'` >> packages
- grep "^<\!ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
- # Done. Moving on...
- echo -ne "done\n"
- get_sources
-}
-
-#----------------------------#
-download() {
-#----------------------------#
- cd $BUILDDIR/sources
-
- # Hackish fix for the bash-doc, glibc-{linuxthreads,libidn} that don't
- # conform to norms in the URL scheme.
- DIR=`echo $1 | sed 's@-doc@@;s@-libidn@@'`
-
- # Find the md5 sum for this package.
- if [ $2 != MD5SUMS ] ; then MD5=`grep " $2$" MD5SUMS` ; fi
-
- if [ ! -f $2 ] ; then
- case $DL in
- wget )
- wget --passive $FTP/$DIR/$2
- ;;
- curl )
- `curl -# $FTP/$DIR/$2 -o $2`
- ;;
- * )
- echo "$DL not supported at this time."
- ;;
- esac
- elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
- case $DL in
- wget )
- wget --passive -c $FTP/$DIR/$2
- ;;
- curl )
- `curl -# -C - $FTP/$DIR/$2 -o $2`
- ;;
- * )
- echo "$DL not supported at this time."
- ;;
- esac
- fi
- if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then
- exit 1
- fi
- if [ $2 != MD5SUMS ] ; then
- echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION
- fi
-}
-
-#----------------------------#
-get_sources() {
-#----------------------------#
-
- # Test if the packages must be downloaded
- if [ "$HPKG" = "1" ] ; then
-
- # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
- # separates each iteration by lines. It is necessary to have the second
- # ' on the next line.
- IFS='
-'
-
- if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
- cd $BUILDDIR/sources
- if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
- if [ -f MD5SUMS-$VERSION ] ; then rm MD5SUMS-$VERSION ; fi
-
- download "" MD5SUMS
-
- # Iterate through each package and grab it, along with any patches it needs.
- for i in `cat $JHALFSDIR/packages` ; do
- PKG=`echo $i | sed -e 's/-version.*//' -e 's/-file.*//'`
-
- # There are some entities that aren't valid packages.
- if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi
-
- VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
- case $PKG in
- tcl)
- FILE="$PKG$VRS-src.tar.bz2"
- ;;
- vim-lang)
- PKG="vim"
- FILE="vim-$VRS-lang.tar.bz2"
- ;;
- udev-config)
- PKG="udev"
- FILE="$VRS"
- ;;
- *)
- FILE="$PKG-$VRS.tar.bz2"
- ;;
- esac
- download $PKG $FILE
-
- # Download any associated patches
- for patch in `grep "&$PKG-version" $JHALFSDIR/patches` ; do
- PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
- download $PKG $PATCH
- done
- done
- fi
-}
-
-#-----------------------------------------------#
-_IS_() # Function to test build scripts names
-#-----------------------------------------------#
-{
- # Returns substr $2 or null str
- # Must use string testing
- case $1 in
- *$2*) echo "$2" ;;
- *) echo "" ;;
- esac
-}
-
-#----------------------------#
-chapter4_Makefiles() {
-#----------------------------#
-
-# 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
-# of their bash init files is made.
-(
- cat << EOF
-020-creatingtoolsdir:
- @\$(call echo_message, Building)
- @mkdir -v \$(LFS)/tools && \\
- rm -fv /tools && \\
- ln -sv \$(LFS)/tools / && \\
- touch \$@
-
-021-addinguser: 020-creatingtoolsdir
- @\$(call echo_message, Building)
- @if [ ! -d /home/lfs ]; then \\
- groupadd lfs; \\
- useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
- else \\
- touch user-lfs-exist; \\
- fi;
- @chown lfs \$(LFS)/tools && \\
- chown lfs \$(LFS)/sources && \\
- touch \$@
-
-022-settingenvironment: 021-addinguser
- @\$(call echo_message, Building)
- @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
- mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
- fi;
- @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
- mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
- fi;
- @echo "set +h" > /home/lfs/.bashrc && \\
- echo "umask 022" >> /home/lfs/.bashrc && \\
- echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\
- echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
- echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
- echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
- echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
- chown lfs:lfs /home/lfs/.bashrc && \\
- touch envars && \\
- touch \$@
-EOF
-) >> $MKFILE.tmp
-}
-
-#----------------------------#
-chapter5_Makefiles() {
-#----------------------------#
- for file in chapter05/* ; do
- # Keep the script file name
- i=`basename $file`
-
- # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
- if [ "$TEST" = "0" ]; then
- if [[ `_IS_ $i tcl` ]] || [[ `_IS_ $i expect` ]] || [[ `_IS_ $i dejagnu` ]] ; then
- continue
- fi
- fi
-
- # Test if the stripping phase must be skipped
- if [ "$STRIP" = "0" ] && [[ `_IS_ $i stripping` ]] ; then
- continue
- fi
-
- # First append each name of the script files to a list (this will become
- # the names of the targets in the Makefile
- chapter5="$chapter5 $i"
-
- # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
- # and binutils in chapter 5)
- name=`echo $i | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
-
- # Set the dependency for the first target.
- if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
-
- # Drop in the name of the target on a new line, and the previous target
- # as a dependency. Also call the echo_message function.
-(
- cat << EOF
-
-$i: $PREV
- @\$(call echo_message, Building)
-EOF
-) >> $MKFILE.tmp
-
- # Find the version of the command files, if it corresponds with the building of
- # a specific package
- vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
- # If $vrs isn't empty, we've got a package...
- if [ "$vrs" != "" ] ; then
- if [ "$name" = "tcl" ] ; then
- FILE="$name$vrs-src.tar"
- else
- FILE="$name-$vrs.tar"
- fi
-
- # Insert instructions for unpacking the package and to set
- # the PKGDIR variable.
-(
- cat << EOF
- @\$(call unpack,$FILE)
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- chown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\
- echo "PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT" > envars && \\
- echo "export PKGDIR" >> envars
-EOF
-) >> $MKFILE.tmp
-
- fi
-
- # Insert date and disk usage at the top of the log file, the script run
- # and date and disk usage again at the bottom of the log file.
-(
- cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(LFS)\`\n" >logs/$i && \\
- su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/commands/$file" >>logs/$i 2>&1 && \\
- echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(LFS)\`\n" >>logs/$i
-EOF
-) >> $MKFILE.tmp
-
- # Remove the build directory(ies) except if the package build fails
- # (so we can review config.cache, config.log, etc.)
- # For Binutils the sources must be retained for some time.
- if [ "$vrs" != "" ] ; then
-(
- cat << EOF
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- rm -r \$(LFS)\$(SRC)/\$\$ROOT && \\
- if [ -e \$(LFS)\$(SRC)/$name-build ]; then \\
- rm -r \$(LFS)\$(SRC)/$name-build; \\
- fi;
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Include a touch of the target name so make can check
- # if it's already been made.
-(
- cat << EOF
- @touch \$@
-EOF
-) >> $MKFILE.tmp
-
- # Keep the script file name for Makefile dependencies.
- PREV=$i
- done # end for file in chapter05/*
-}
-
-#----------------------------#
-chapter6_Makefiles() {
-#----------------------------#
- for file in chapter06/* ; do
- # Keep the script file name
- i=`basename $file`
-
- # We'll run the chroot commands differently than the others, so skip them in the
- # dependencies and target creation.
- if [[ `_IS_ $i chroot` ]] ; then
- continue
- fi
-
- # Test if the stripping phase must be skipped
- if [ "$STRIP" = "0" ] && [[ `_IS_ $i stripping` ]] ; then
- continue
- fi
-
- # First append each name of the script files to a list (this will become
- # the names of the targets in the Makefile
- chapter6="$chapter6 $i"
-
- # Grab the name of the target
- name=`echo $i | sed -e 's@[0-9]\{3\}-@@'`
-
- # Drop in the name of the target on a new line, and the previous target
- # as a dependency. Also call the echo_message function.
-(
- cat << EOF
-
-$i: $PREV
- @\$(call echo_message, Building)
-EOF
-) >> $MKFILE.tmp
-
- # Find the version of the command files, if it corresponds with the building of
- # a specific package
- vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
- # If $vrs isn't empty, we've got a package...
- # Insert instructions for unpacking the package and changing directories
- if [ "$vrs" != "" ] ; then
- FILE="$name-$vrs.tar.*"
-(
- cat << EOF
- @\$(call unpack2,$FILE)
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- echo "PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
- echo "export PKGDIR" >> envars
-EOF
-) >> $MKFILE.tmp
- fi
-
- # For Glibc we need to set TIMEZONE envar.
- if [[ `_IS_ $i glibc` ]] ; then
-(
- cat << EOF
- @echo "TIMEZONE=\$(TIMEZONE)" >> envars && \\
- echo "export TIMEZONE" >> envars
-EOF
-) >> $MKFILE.tmp
-
- # For Groff we need to set PAGE envar.
- elif [[ `_IS_ $i groff` ]] ; then
-(
- cat << EOF
- @echo "PAGE=\$(PAGE)" >> envars && \\
- echo "export PAGE" >> envars
-EOF
-) >> $MKFILE.tmp
- fi
-
- # In the mount of kernel filesystems we need to set LFS
- # and not to use chroot.
- if [[ `_IS_ $i kernfs` ]] ; then
-(
- cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(LFS)\`\n" >logs/$i && \\
- export LFS=\$(LFS) && commands/$file >>logs/$i 2>&1 && \\
- echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(LFS)\`\n" >>logs/$i
-EOF
-) >> $MKFILE.tmp
-
- # The rest of Chapter06
- else
-(
- cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >logs/$i && \\
- \$(CHROOT1) 'cd /jhalfs && source envars && /jhalfs/commands/$file >>/jhalfs/logs/$i 2>&1' && \\
- echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >>logs/$i
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Remove the build directory(ies) except if the package build fails.
- if [ "$vrs" != "" ] ; then
-(
- cat << EOF
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- rm -r \$(LFS)\$(SRC)/\$\$ROOT && \\
- if [ -e \$(LFS)\$(SRC)/$name-build ]; then \\
- rm -r \$(LFS)\$(SRC)/$name-build; \\
- fi;
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Include a touch of the target name so make can check
- # if it's already been made.
-(
- cat << EOF
- @touch \$@
-EOF
-) >> $MKFILE.tmp
-
- # Keep the script file name for Makefile dependencies.
- PREV=$i
- done # end for file in chapter06/*
-}
-
-#----------------------------#
-chapter789_Makefiles() {
-#----------------------------#
- for file in chapter0{7,8,9}/* ; do
- # Keep the script file name
- i=`basename $file`
-
- # Grub must be configured manually.
- # The filesystems can't be unmounted via Makefile and the user
- # should enter the chroot environment to create the root
- # password, edit several files and setup Grub.
- if [[ `_IS_ $i grub` ]] || [[ `_IS_ $i reboot` ]] ; then
- continue
- fi
-
- # If no .config file is supplied, the kernel build is skipped
- if [ -z $CONFIG ] && [[ `_IS_ $i kernel` ]] ; then
- continue
- fi
-
- # First append each name of the script files to a list (this will become
- # the names of the targets in the Makefile
- chapter789="$chapter789 $i"
-
- # Drop in the name of the target on a new line, and the previous target
- # as a dependency. Also call the echo_message function.
-(
- cat << EOF
-
-$i: $PREV
- @\$(call echo_message, Building)
-EOF
-) >> $MKFILE.tmp
-
- # Find the bootscripts and kernel package names
- if [[ `_IS_ $i bootscripts` ]] || [[ `_IS_ $i kernel` ]] ; then
- if [[ `_IS_ $i bootscripts` ]] ; then
- vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
- FILE="lfs-bootscripts-$vrs.tar.*"
- elif [[ `_IS_ $i kernel` ]] ; then
- vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
- FILE="linux-$vrs.tar.*"
- fi
-(
- cat << EOF
- @\$(call unpack2,$FILE)
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- echo "PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
- echo "export PKGDIR" >> envars
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Put in place the kernel .config file
- if [[ `_IS_ $i kernel` ]] ; then
-(
- cat << EOF
- @cp $CONFIG \$(LFS)/sources/kernel-config
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Check if we have a real /etc/fstab file
- if [[ `_IS_ $i fstab` ]] && [[ -n "$FSTAB" ]] ; then
-(
- cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >logs/$i && \\
- cp -v $FSTAB \$(LFS)/etc/fstab >>logs/$i 2>&1 && \\
- echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >>logs/$i
-EOF
-) >> $MKFILE.tmp
- else
- # Initialize the log and run the script
-(
- cat << EOF
- @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >logs/$i && \\
- \$(CHROOT2) 'cd /jhalfs && source envars && /jhalfs/commands/$file >>/jhalfs/logs/$i 2>&1' && \\
- echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >>logs/$i
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Remove the build directory except if the package build fails.
- if [[ `_IS_ $i bootscripts` ]] || [[ `_IS_ $i kernel` ]] ; then
-(
- cat << EOF
- @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
- rm -r \$(LFS)\$(SRC)/\$\$ROOT
-EOF
-) >> $MKFILE.tmp
- fi
-
- # Include a touch of the target name so make can check
- # if it's already been made.
-(
- cat << EOF
- @touch \$@
-EOF
-) >> $MKFILE.tmp
-
- # Keep the script file name for Makefile dependencies.
- PREV=$i
- done # for file in chapter0{7,8,9}/*
-}
-
-
-#----------------------------#
-build_Makefile() {
-#----------------------------#
- echo -n "Creating Makefile... "
- cd $JHALFSDIR/commands
-
- # Start with a clean Makefile.tmp file
- >$MKFILE.tmp
-
- chapter4_Makefiles
- chapter5_Makefiles
- chapter6_Makefiles
- chapter789_Makefiles
-
-
- # Add a header, some variables and include the function file
- # to the top of the real Makefile.
-(
- cat << EOF
-$HEADER
-
-SRC= /sources
-LFS= $BUILDDIR
-PAGE= $PAGE
-TIMEZONE= $TIMEZONE
-
-include functions
-
-EOF
-) > $MKFILE
-
-
- # Add chroot commands
- i=1
- for file in chapter06/*chroot* ; do
- chroot=`cat $file | sed -e '/#!\/bin\/sh/d' -e 's@ \\\@ @g' | tr -d '\n' | sed \
- -e 's/ */ /g' -e 's|\\$|&&|g' -e 's|exit||g' -e 's|$| -c|' \
- -e 's|"$$LFS"|$(LFS)|' -e 's|set -e||'`
- echo -e "CHROOT$i= $chroot\n" >> $MKFILE
- i=`expr $i + 1`
- done
-
- # Drop in the main target 'all:' and the chapter targets with each sub-target
- # as a dependency.
-(
- cat << EOF
-all: chapter4 chapter5 chapter6 chapter789
- @\$(call echo_finished,$VERSION)
-
-chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
-
-chapter5: chapter4 $chapter5 restore-lfs-env
-
-chapter6: chapter5 $chapter6
-
-chapter789: chapter6 $chapter789
-
-clean-all: clean
- rm -rf ./{commands,logs,Makefile,dump-lfs-scripts.xsl,functions,packages,patches}
-
-clean: clean-chapter789 clean-chapter6 clean-chapter5 clean-chapter4
-
-clean-chapter4:
- -if [ ! -f user-lfs-exist ]; then \\
- userdel lfs; \\
- rm -rf /home/lfs; \\
- fi;
- rm -rf \$(LFS)/tools
- rm -f /tools
- rm -f envars user-lfs-exist
- rm -f 02* logs/02*.log
-
-clean-chapter5:
- rm -rf \$(LFS)/tools/*
- rm -f $chapter5 restore-lfs-env sources-dir
- cd logs && rm -f $chapter5 && cd ..
-
-clean-chapter6:
- -umount \$(LFS)/sys
- -umount \$(LFS)/proc
- -umount \$(LFS)/dev/shm
- -umount \$(LFS)/dev/pts
- -umount \$(LFS)/dev
- rm -rf \$(LFS)/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
- rm -f $chapter6
- cd logs && rm -f $chapter6 && cd ..
-
-clean-chapter789:
- rm -f $chapter789
- cd logs && rm -f $chapter789 && cd ..
-
-restore-lfs-env:
- @\$(call echo_message, Building)
- @if [ -f /home/lfs/.bashrc.XXX ]; then \\
- mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
- fi;
- @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
- mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
- fi;
- @chown lfs:lfs /home/lfs/.bash* && \\
- touch \$@
-
-EOF
-) >> $MKFILE
-
- # Bring over the items from the Makefile.tmp
- cat $MKFILE.tmp >> $MKFILE
- rm $MKFILE.tmp
- echo -ne "done\n"
-}
-
-#----------------------------#
-run_make() {
-#----------------------------#
- # Test if make must be run.
- if [ "$RUNMAKE" = "1" ] ; then
- # Test to make sure we're running the build as root
- if [ "$UID" != "0" ] ; then
- echo "You must be logged in as root to successfully build LFS."
- exit 1
- fi
- # Build the system
- if [ -e $MKFILE ] ; then
- echo -ne "Building the LFS system...\n"
- cd $JHALFSDIR && make
- echo -ne "done\n"
- fi
- fi
-}
-
-
-
-###################################
-### MAIN ###
-###################################
-
-# Evaluate any command line switches
-
-while test $# -gt 0 ; do
- case $1 in
- --version | -V )
- echo "$version"
- exit 0
- ;;
-
- --help | -h )
- echo "$usage"
- exit 0
- ;;
-
- --LFS-version | -L )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- case $1 in
- dev* | SVN | trunk )
- LFSVRS=development
- ;;
-
- 6.1.1 )
- echo -e "\nFor stable 6.1.1 book, please use jhalfs-0.2."
- exit 0
- ;;
-
- alpha*)
- LFSVRS=alphabetical
- ;;
-
- udev*)
- LFSVRS=udev_update
- ;;
-
- * )
- echo -e "\n$1 is an unsupported version at this time."
- exit 1
- ;;
- esac
- ;;
-
- --directory | -d )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- BUILDDIR=$1
- JHALFSDIR=$BUILDDIR/jhalfs
- LOGDIR=$JHALFSDIR/logs
- MKFILE=$JHALFSDIR/Makefile
- ;;
-
- --rebuild ) CLEAN=1 ;;
-
- --download-client | -D )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- DL=$1
- ;;
-
- --working-copy | -W )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- if [ -f $1/patches.ent ] ; then
- WC=1
- BOOK=$1
- else
- echo -e "\nLook like $1 isn't a supported working copy."
- echo -e "Verify your selection and the command line.\n"
- exit 1
- fi
- ;;
-
- --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
- ;;
-
- --get-packages | -P ) HPKG=1 ;;
-
- --run-make | -M ) RUNMAKE=1 ;;
-
- --no-strip ) STRIP=0 ;;
-
- --no-vim-lang ) VIMLANG=0 ;;
-
- --page_size )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- case $1 in
- letter | A4 )
- PAGE=$1
- ;;
- * )
- echo -e "\n$1 isn't a supported page size."
- exit 1
- ;;
- esac
- ;;
-
- --timezone )
- test $# = 1 && eval "$exit_missing_arg"
- shift
- if [ -f /usr/share/zoneinfo/$1 ] ; then
- TIMEZONE=$1
- else
- echo -e "\nLooks like $1 isn't a valid timezone description."
- echo -e "Verify your selection and the command line.\n"
- exit 1
- fi
- ;;
-
- --fstab )
- 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 | -C )
- 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
- ;;
-
- * )
- echo "$usage"
- exit 1
- ;;
- esac
- shift
-done
-
-# Prevents setting "-d /" by mistake.
-
-if [ $BUILDDIR = / ] ; then
- echo -ne "\nThe root directory can't be used to build LFS.\n\n"
- exit 1
-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
-
-# Find the download client to use, if not already specified.
-
-if [ -z $DL ] ; then
- if [ `type -p wget` ] ; then
- DL=wget
- elif [ `type -p curl` ] ; then
- DL=curl
- else
- eval "$no_dl_client"
- fi
-fi
-
-if [ -z $BOOK ] ; then
- BOOK=lfs-$LFSVRS
-fi
-
-[[ ! -d $JHALFSDIR ]] && mkdir -pv $JHALFSDIR
-[[ "$PWD" != "$JHALFSDIR" ]] && cp -v $FILES $JHALFSDIR/ && \
- sed 's,FAKEDIR,'$BOOK',' $XSL > $JHALFSDIR/dump-lfs-scripts.xsl && \
- export XSL=$JHALFSDIR/dump-lfs-scripts.xsl
-[[ ! -d $LOGDIR ]] && mkdir -v $LOGDIR
->$LOGDIR/$LOG
-
-get_book
-build_Makefile
-run_make
-
diff --git a/jhalfs-0.2-debian_31_as_host-1.patch b/jhalfs-0.2-debian_31_as_host-1.patch
deleted file mode 100644
index 069ec81..0000000
--- a/jhalfs-0.2-debian_31_as_host-1.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-Submitted By: John Kelly (jakelly at shtc dot net)
-Date: 2005-09-26
-Initial Package Version: 0.2
-Origin: alfs-discuss
-Upstream Status: Optional
-Description: Allow jhalfs to work with a md5sum program
-that doesn't accept '-' as a filename, like the one shipped with
-Debian 3.1 stable.
-
---- jhalfs.orig 2005-12-01 00:57:13.000000000 +0000
-+++ jhalfs 2005-12-01 00:57:26.000000000 +0000
-@@ -260,9 +260,12 @@
- DIR=`echo $1 | sed 's@-doc@@;s@-linuxthreads@@;s@-libidn@@;s@-testsuite@@'`
-
- # Find the md5 sum for this package.
-- if [ $2 != MD5SUMS ] ; then MD5=`grep " $2" MD5SUMS` ; fi
-+ if [ $2 != MD5SUMS ] ; then
-+ MD5=$(grep " $2" MD5SUMS | sed -r -e 's/^[[:blank:]]+//;s/[[:blank:]]+$//;s/[[:blank:]]+/ /g')
-+ md5_file=${MD5#* } ; md5_chksum=${MD5% *}
-+ fi
-
-- if [ ! -f $2 ] ; then
-+ if [ ! -f $2 -o $2 == MD5SUMS ] ; then
- case $DL in
- wget )
- wget $FTP/$DIR/$2
-@@ -274,7 +277,7 @@
- echo "$DL not supported at this time."
- ;;
- esac
-- elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
-+ elif [ "$md5_chksum" != "$(md5sum $md5_file | sed -r -e 's/^[[:blank:]]+//;s/[[:blank:]]+$//;s/[[:blank:]]+/\t/g' | cut -f 1)" ] ; then
- case $DL in
- wget )
- wget -c $FTP/$DIR/$2
-@@ -287,8 +290,11 @@
- ;;
- esac
- fi
-- if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then
-- exit 1
-+ if [ $2 != MD5SUMS ] ; then
-+ if [ "$md5_chksum" != "$(md5sum $md5_file | sed -r -e 's/^[[:blank:]]+//;s/[[:blank:]]+$//;s/[[:blank:]]+/\t/g' | cut -f 1)" ] ; then
-+ echo "$2 md5 checksum does not match $md5_chksum"
-+ exit 1
-+ fi
- fi
- if [ $2 != MD5SUMS ] ; then
- echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION
diff --git a/jhalfs.conf b/jhalfs.conf
deleted file mode 100644
index 8d7416c..0000000
--- a/jhalfs.conf
+++ /dev/null
@@ -1,67 +0,0 @@
-#####
-#
-# Configuration file for the jhalfs build script
-#
-#####
-
-declare -r SVN="svn://svn.linuxfromscratch.org"
-declare -r FTP=ftp://ftp.linuxfromscratch.org/pub/lfs/conglomeration
-declare -r LOG=000-jhalfs.log
-
-#--- Mount point for the build
-BUILDDIR=/mnt/lfs
-
-#--- Download the source packages 0(no)/1(yes)
-HPKG=0
-
-#--- Run the makefile at the end 0(no)/1(yes)
-RUNMAKE=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
-TEST=1
-
-#--- Run the stripping phases 0(no)/1(yes)
-STRIP=1
-
-#--- page definition for groff letter/A4
-PAGE=letter
-
-#--- set default timezone.
-TIMEZONE=Europe/London
-
-#--- install the optional vim-lang package 0(no)/1(yes)
-VIMLANG=1
-
-#--- Location of fstab file (if empty, a template is created)
-FSTAB=
-
-#--- Location of kernel config file (if the kernel is to be compiled)
-CONFIG=
-
-#--- Book's sources directory
-# Uncomment this variables if you have previously checked
-# out the book from the repository
-# BOOK=/path/to/book
-# WC=1
-
-
-#==== INTERNAL VARIABLES ====
-# Don't edit it unless you know what you are doing
-
-#--- Default stylesheet
-XSL=dump-lfs-scripts.xsl
-
-#--- Files that will be copied to $JHALFSDIR
-FILES="functions"
-
-#--- Working directories
-JHALFSDIR=$BUILDDIR/jhalfs
- LOGDIR=$JHALFSDIR/logs
- MKFILE=$JHALFSDIR/Makefile
-
-#--- Book version
-LFSVRS=development
diff --git a/lfs b/lfs
new file mode 120000
index 0000000..fba0373
--- /dev/null
+++ b/lfs
@@ -0,0 +1 @@
+master.sh
\ No newline at end of file
diff --git a/master.sh b/master.sh
new file mode 100755
index 0000000..58495b7
--- /dev/null
+++ b/master.sh
@@ -0,0 +1,481 @@
+#!/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\t${BOLD}Goodbye and thank you for choosing ${L_arrow}jhalfs-X${R_arrow}\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
+
+[[ $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 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"
+#
+[[ $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 "---------------${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 "---------------${nl_}"
+
+
+###################################
+### MAIN ###
+###################################
+
+# Evaluate any command line switches
+
+while test $# -gt 0 ; do
+ case $1 in
+ # Common options for all books
+ --book | -B )
+ test $# = 1 && eval "$exit_missing_arg"
+ shift
+ case $1 in
+ dev* | SVN | trunk )
+ LFSVRS=development
+ ;;
+ *) if [[ "$PROGNAME" = "lfs" ]]; then
+ case $1 in
+ 6.1.1 )
+ echo "For stable 6.1.1 book, please use jhalfs-0.2."
+ exit 0
+ ;;
+ alpha*) LFSVRS=alphabetical ;;
+ udev*) LFSVRS=udev_update ;;
+ * ) echo "$1 is an unsupported version at this time." ;;
+ esac
+ else
+ echo "The requested version, ${L_arrow} ${BOLD}$1${OFF} ${R_arrow}, is undefined in the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} series."
+ exit 0
+ fi
+ ;;
+ 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/jhalfs
+ LOGDIR=$JHALFSDIR/logs
+ MKFILE=$JHALFSDIR/Makefile
+ ;;
+ esac
+ ;;
+
+ --get-packages | -G ) HPKG=1 ;;
+
+ --help | -h ) usage | more && exit ;;
+
+ --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 [ -f $1/patches.ent ] ; then
+ WC=1
+ BOOK=$1
+ else
+ echo -e "\nLooks like $1 isn't a LFS working copy."
+ exit 1
+ fi
+ ;;
+ clfs)
+ if [ -f $1/patches.ent ] && [ -f $1/packages.ent ]; 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 a HLFS working copy."
+ exit 1
+ fi
+ ;;
+ blfs)
+ if [ -f $1/use-unzip.xml ] ; then
+ WC=1
+ BOOK=$1
+ else
+ echo -e "\nLooks like $1 isn't a BLFS working copy."
+ exit 1
+ fi
+ ;;
+ esac
+ ;;
+
+ # Common options for LFS, CLFS and HLFS
+ --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
+ ;;
+
+ --make | -M ) RUNMAKE=1 ;;
+
+ --rebuild | -R ) CLEAN=1 ;;
+
+ # CLFS options
+ --arch | -A )
+ test $# = 1 && eval "$exit_missing_arg"
+ shift
+ case $1 in
+ 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"
+ ;;
+ sparcv8 )
+ ARCH=sparcv8
+ TARGET="sparc-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 unsopported arch."
+ exit 1
+ ;;
+ 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
+ ;;
+
+ # BLFS options
+ --dependencies )
+ test $# = 1 && eval "$exit_missing_arg"
+ shift
+ case $1 in
+ 0 | 1 | 2 )
+ DEPEND=$1
+ ;;
+ * )
+ echo -e "\n$1 isn't a valid dependencies level."
+ exit 1
+ ;;
+ esac
+ ;;
+
+ # Unknown options
+ * ) usage ;;
+ esac
+ shift
+done
+
+# Find the download client to use, if not already specified.
+
+if [ -z $DL ] ; then
+ if [ `type -p wget` ] ; then
+ DL=wget
+ elif [ `type -p curl` ] ; then
+ DL=curl
+ else
+ eval "$no_dl_client"
+ fi
+fi
+
+#===================================================
+# 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 minumum gcc and kernel versions
+#check_requirements 1 # 0/1 0-do not display values.
+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`
+check_version "1.15.0" "${tarVer##* }" "TAR"
+echo "---------------${nl_}"
+
+validate_config
+echo "---------------${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_}---------------${nl_}"
+
+# Prevents setting "-d /" by mistake.
+
+if [ $BUILDDIR = / ] ; then
+ echo -ne "\nThe root directory can't be used to build LFS.\n\n"
+ exit 1
+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
+
+if [[ "$PWD" != "$JHALFSDIR" ]]; then
+ cp $COMMON_DIR/makefile-functions $JHALFSDIR/
+ if [[ -n "$FILES" ]]; then
+ # pushd/popd necessary to deal with mulitiple files
+ pushd $PACKAGE_DIR 1> /dev/null
+ cp $FILES $JHALFSDIR/
+ popd 1> /dev/null
+ fi
+ sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
+ export XSL=$JHALFSDIR/${XSL}
+fi
+
+if [[ ! -d $LOGDIR ]]; then
+ mkdir $LOGDIR
+fi
+>$LOGDIR/$LOG
+
+get_book
+echo "---------------${nl_}"
+
+build_Makefile
+echo "---------------${nl_}"
+
+run_make
+