Merged experimental branch to trunk.
Updated TODO.
This commit is contained in:
parent
a0ed344738
commit
877cc6a7c9
41 changed files with 5080 additions and 3604 deletions
|
@ -5,6 +5,8 @@
|
||||||
extension-element-prefixes="exsl"
|
extension-element-prefixes="exsl"
|
||||||
version="1.0">
|
version="1.0">
|
||||||
|
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
<!-- XSLT stylesheet to create shell scripts from BLFS books. -->
|
<!-- XSLT stylesheet to create shell scripts from BLFS books. -->
|
||||||
|
|
||||||
<!-- Run optional test suites? -->
|
<!-- Run optional test suites? -->
|
|
@ -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"
|
#--- Book's sources directory
|
||||||
declare -r LOG=000-jhablfs.log
|
# If you have previously checked out the book from the repository
|
||||||
|
BOOK=
|
||||||
#--- Working directories
|
|
||||||
JHABLFSDIR=~/jhablfs
|
|
||||||
LOGDIR=$JHABLFSDIR/logs
|
|
||||||
MKFILE=$JHABLFSDIR/Makefile
|
|
||||||
|
|
||||||
#--- Book version
|
#--- Book version
|
||||||
BLFSVRS=development
|
LFSVRS=development
|
||||||
|
|
||||||
#--- FTP/HTTP mirror used as fallback (full path)
|
#--- FTP/HTTP mirror used as fallback (full path)
|
||||||
SERVER=ftp://anduin.linuxfromscratch.org/BLFS/conglomeration
|
SERVER=ftp://anduin.linuxfromscratch.org/BLFS/conglomeration
|
||||||
|
@ -25,12 +24,10 @@ DEPEND=1
|
||||||
TEST=0
|
TEST=0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#==== INTERNAL VARIABLES ====
|
#==== INTERNAL VARIABLES ====
|
||||||
# Don't edit it unless you know what you are doing
|
# Don't edit it unless you know what you are doing
|
||||||
|
|
||||||
#--- Default stylesheet
|
#--- 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"
|
|
|
@ -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
|
|
341
BLFS/jhablfs
341
BLFS/jhablfs
|
@ -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@<!ENTITY version "@@;s@">@@'`
|
|
||||||
else
|
|
||||||
echo -ne "done\n"
|
|
||||||
# Set the canonical book version
|
|
||||||
cd $JHABLFSDIR
|
|
||||||
VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;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@<!ENTITY version "@@;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@<!ENTITY version "@@;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
|
|
||||||
|
|
105
BLFS/master.sh
Executable file
105
BLFS/master.sh
Executable file
|
@ -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"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
230
CLFS/clfs.xsl
Normal file
230
CLFS/clfs.xsl
Normal file
|
@ -0,0 +1,230 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE xsl:stylesheet [
|
||||||
|
<!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
|
||||||
|
%general-entities;
|
||||||
|
]>
|
||||||
|
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:exsl="http://exslt.org/common"
|
||||||
|
extension-element-prefixes="exsl"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<!-- XSLT stylesheet to create shell scripts from CLFS books. -->
|
||||||
|
|
||||||
|
<!-- Build method used -->
|
||||||
|
<xsl:param name="method" select="chroot"/>
|
||||||
|
|
||||||
|
<!-- Compile the keymap into the kernel? -->
|
||||||
|
<xsl:param name="keymap" select="none"/>
|
||||||
|
|
||||||
|
<!-- Run test suites?
|
||||||
|
0 = none
|
||||||
|
1 = only Glibc, GCC and Binutils testsuites
|
||||||
|
2 = all testsuites
|
||||||
|
3 = alias to 2 -->
|
||||||
|
<xsl:param name="testsuite" select="1"/>
|
||||||
|
|
||||||
|
<!-- Install vim-lang package? -->
|
||||||
|
<xsl:param name="vim-lang" select="1"/>
|
||||||
|
|
||||||
|
<!-- Time zone -->
|
||||||
|
<xsl:param name="timezone" select="America/Toronto"/>
|
||||||
|
|
||||||
|
<!-- Page size -->
|
||||||
|
<xsl:param name="page" select="letter"/>
|
||||||
|
|
||||||
|
<!-- Locale settings -->
|
||||||
|
<xsl:param name="lang" select="en_CA"/>
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:apply-templates select="//sect1"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="sect1">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="../@id='chapter-partitioning' or
|
||||||
|
../@id='chapter-getting-materials' or
|
||||||
|
../@id='chapter-final-preps'"/>
|
||||||
|
<xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
|
||||||
|
<xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
|
||||||
|
<xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:if test="count(descendant::screen/userinput) > 0 and
|
||||||
|
count(descendant::screen/userinput) >
|
||||||
|
count(descendant::screen[@role='nodump'])">
|
||||||
|
<!-- The dirs names -->
|
||||||
|
<xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
|
||||||
|
<xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
||||||
|
<xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
||||||
|
<xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
||||||
|
<!-- The file names -->
|
||||||
|
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
||||||
|
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
||||||
|
<xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
||||||
|
<!-- The build order -->
|
||||||
|
<xsl:variable name="position" select="position()"/>
|
||||||
|
<xsl:variable name="order">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="string-length($position) = 1">
|
||||||
|
<xsl:text>00</xsl:text>
|
||||||
|
<xsl:value-of select="$position"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="string-length($position) = 2">
|
||||||
|
<xsl:text>0</xsl:text>
|
||||||
|
<xsl:value-of select="$position"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$position"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Creating dirs and files -->
|
||||||
|
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="../@id='chapter-chroot'">
|
||||||
|
<xsl:text>#!/tools/bin/bash
set -e

</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="@id='ch-system-stripping'">
|
||||||
|
<xsl:text>#!/bin/sh
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>#!/bin/sh
set -e

</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:if test="sect2[@role='installation']">
|
||||||
|
<xsl:text>cd $PKGDIR
</xsl:text>
|
||||||
|
<xsl:if test="@id='ch-system-vim' and $vim-lang = '1'">
|
||||||
|
<xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:apply-templates select=".//para/userinput | .//screen"/>
|
||||||
|
<xsl:text>exit</xsl:text>
|
||||||
|
</exsl:document>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="screen">
|
||||||
|
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
||||||
|
<xsl:apply-templates select="userinput" mode="screen"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="para/userinput">
|
||||||
|
<xsl:if test="(contains(string(),'test') or
|
||||||
|
contains(string(),'check')) and
|
||||||
|
($testsuite = '2' or $testsuite = '3')">
|
||||||
|
<xsl:value-of select="substring-before(string(),'make')"/>
|
||||||
|
<xsl:text>make -k</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),'make')"/>
|
||||||
|
<xsl:text> || true
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="userinput" mode="screen">
|
||||||
|
<xsl:choose>
|
||||||
|
<!-- Estandarized package formats -->
|
||||||
|
<xsl:when test="contains(string(),'tar.gz')">
|
||||||
|
<xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
||||||
|
<xsl:text>tar.*</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- Avoiding a race condition in a patch -->
|
||||||
|
<xsl:when test="contains(string(),'debian_fixes')">
|
||||||
|
<xsl:value-of select="substring-before(string(),'patch')"/>
|
||||||
|
<xsl:text>patch -Z</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),'patch')"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- Setting $LANG for /etc/profile -->
|
||||||
|
<xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
|
||||||
|
contains(string(),'export LANG=')">
|
||||||
|
<xsl:value-of select="substring-before(string(),'export LANG=')"/>
|
||||||
|
<xsl:text>export LANG=</xsl:text>
|
||||||
|
<xsl:value-of select="$lang"/>
|
||||||
|
<xsl:value-of select="substring-after(string(),'charmap]')"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- Compile the keymap into the kernel? -->
|
||||||
|
<xsl:when test="contains(string(),'defkeymap') and
|
||||||
|
$keymap = 'none'"/>
|
||||||
|
<!-- Copying the kernel config file -->
|
||||||
|
<xsl:when test="string() = 'make mrproper'">
|
||||||
|
<xsl:text>make mrproper
</xsl:text>
|
||||||
|
<xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
|
||||||
|
<xsl:text>cp -v ../bootkernel-config .config
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
|
||||||
|
<xsl:text>cp -v ../kernel-config .config
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- No interactive commands are needed if the .config file is the proper one -->
|
||||||
|
<xsl:when test="contains(string(),'menuconfig')"/>
|
||||||
|
<!-- The Coreutils and Module-Init-Tools test suites are optional -->
|
||||||
|
<xsl:when test="($testsuite = '0' or $testsuite = '1') and
|
||||||
|
(ancestor::sect1[@id='ch-system-coreutils'] or
|
||||||
|
ancestor::sect1[@id='ch-system-module-init-tools']) and
|
||||||
|
(contains(string(),'check') or
|
||||||
|
contains(string(),'dummy'))"/>
|
||||||
|
<!-- Fixing toolchain test suites run -->
|
||||||
|
<xsl:when test="string() = 'make check' or
|
||||||
|
string() = 'make -k check'">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$testsuite != '0'">
|
||||||
|
<xsl:text>make -k check || true
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="contains(string(),'glibc-check-log')">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$testsuite != '0'">
|
||||||
|
<xsl:value-of select="substring-before(string(),';')"/>
|
||||||
|
<xsl:text> || true
</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),';')"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="contains(string(),'test_summary') or
|
||||||
|
contains(string(),'expect -c')">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$testsuite != '0'">
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- Don't stop on strip run -->
|
||||||
|
<xsl:when test="contains(string(),'strip ')">
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text> || true
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- The rest of commands -->
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="replaceable">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
|
||||||
|
<xsl:value-of select="$timezone"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
||||||
|
<xsl:value-of select="$page"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>**EDITME</xsl:text>
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>EDITME**</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
74
CLFS/config
Normal file
74
CLFS/config
Normal file
|
@ -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
|
1077
CLFS/master.sh
Executable file
1077
CLFS/master.sh
Executable file
File diff suppressed because it is too large
Load diff
26
CLFS/packageslist.xsl
Normal file
26
CLFS/packageslist.xsl
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||||
|
|
||||||
|
<!--$Id$ -->
|
||||||
|
<!-- Get list of packages from the CLFS Book -->
|
||||||
|
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<xsl:output method="text"/>
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:apply-templates select="//ulink"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="ulink">
|
||||||
|
<!-- Packages. If some package don't have the string ".tar." in their
|
||||||
|
name, the next test must be fixed to match it also. Skip possible
|
||||||
|
duplicated URLs due that may be splitted for PDF output -->
|
||||||
|
<xsl:if test="(contains(@url, '.tar.') or contains(@url, '.tgz'))
|
||||||
|
and not(ancestor-or-self::*/@condition = 'pdf')">
|
||||||
|
<xsl:value-of select="@url"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
25
CLFS/patcheslist.xsl
Normal file
25
CLFS/patcheslist.xsl
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||||
|
|
||||||
|
<!--$Id$ -->
|
||||||
|
<!-- Get list of patches from the CLFS Book -->
|
||||||
|
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<xsl:output method="text"/>
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:apply-templates select="//ulink"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="ulink">
|
||||||
|
<!-- Patches. Match only the patches and skip possible duplicated
|
||||||
|
URLs due that may be splitted for PDF output-->
|
||||||
|
<xsl:if test="contains(@url, '.patch')
|
||||||
|
and not(ancestor-or-self::*/@condition = 'pdf')">
|
||||||
|
<xsl:value-of select="@url"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
43
HLFS/config
Normal file
43
HLFS/config
Normal file
|
@ -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
|
|
@ -1,230 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE xsl:stylesheet [
|
|
||||||
<!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
|
|
||||||
%general-entities;
|
|
||||||
]>
|
|
||||||
|
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
||||||
xmlns:exsl="http://exslt.org/common"
|
|
||||||
extension-element-prefixes="exsl"
|
|
||||||
version="1.0">
|
|
||||||
|
|
||||||
<!-- XSLT stylesheet to create shell scripts from LFS books. -->
|
|
||||||
|
|
||||||
<!-- Run optional test suites? -->
|
|
||||||
<xsl:param name="testsuite" select="0"/>
|
|
||||||
|
|
||||||
<!-- Run toolchain test suites? -->
|
|
||||||
<xsl:param name="toolchaintest" select="1"/>
|
|
||||||
|
|
||||||
<!-- Install vim-lang package? -->
|
|
||||||
<xsl:param name="vim-lang" select="1"/>
|
|
||||||
|
|
||||||
<xsl:template match="/">
|
|
||||||
<xsl:apply-templates select="//sect1"/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="sect1">
|
|
||||||
<xsl:if test="count(descendant::screen/userinput) > 0 and
|
|
||||||
count(descendant::screen/userinput) > count(descendant::screen[@role='nodump'])">
|
|
||||||
<!-- The dirs names -->
|
|
||||||
<xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
|
|
||||||
<xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
|
||||||
<xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
|
||||||
<xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
|
||||||
<!-- The file names -->
|
|
||||||
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
|
||||||
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
|
||||||
<xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
|
||||||
<!-- The build order -->
|
|
||||||
<xsl:variable name="position" select="position()"/>
|
|
||||||
<xsl:variable name="order">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="string-length($position) = 1">
|
|
||||||
<xsl:text>00</xsl:text>
|
|
||||||
<xsl:value-of select="$position"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="string-length($position) = 2">
|
|
||||||
<xsl:text>0</xsl:text>
|
|
||||||
<xsl:value-of select="$position"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="$position"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
|
|
||||||
<!-- Creating dirs and files -->
|
|
||||||
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
|
|
||||||
<!-- Add a header to each script -->
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="@id='ch-system-changingowner' or
|
|
||||||
@id='ch-system-creatingdirs' or
|
|
||||||
@id='ch-system-createfiles'">
|
|
||||||
<xsl:text>#!/tools/bin/bash
set -e

</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
|
|
||||||
<xsl:when test="@id='ch-tools-stripping' or
|
|
||||||
@id='ch-system-strippingagain'">
|
|
||||||
<xsl:text>#!/bin/sh
</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:text>#!/bin/sh
set -e

</xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
|
|
||||||
<xsl:if test="sect2[@role='installation'] or
|
|
||||||
@id='ch-tools-adjusting' or
|
|
||||||
@id='ch-system-readjusting'">
|
|
||||||
<xsl:text>cd $PKGDIR
</xsl:text>
|
|
||||||
<xsl:if test="@id='ch-system-vim' and $vim-lang = '1'">
|
|
||||||
<xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="@id='ch-tools-uclibc'">
|
|
||||||
<xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="@id='ch-system-uclibc'">
|
|
||||||
<xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="@id='ch-system-glibc'">
|
|
||||||
<xsl:text>tar -xvf ../glibc-libidn-&glibc-version;.*
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="@id='ch-tools-glibc'">
|
|
||||||
<xsl:text>tar -xvf ../glibc-libidn-&glibc-version;.*
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="@id='ch-system-gcc'">
|
|
||||||
<xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; 
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="@id='ch-tools-gcc'">
|
|
||||||
<xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; 
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="@id='bootable-bootscripts'">
|
|
||||||
<xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; 
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:apply-templates select=".//para/userinput | .//screen"/>
|
|
||||||
<xsl:text>exit</xsl:text>
|
|
||||||
</exsl:document>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="screen">
|
|
||||||
<xsl:if test="child::* = userinput">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="@role = 'nodump'"/>
|
|
||||||
<xsl:when test="@condition != $model"/>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:apply-templates select="userinput" mode="screen"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="para/userinput">
|
|
||||||
<xsl:if test="$testsuite != '0' and
|
|
||||||
(contains(string(),'test') or contains(string(),'check'))">
|
|
||||||
<xsl:value-of select="substring-before(string(),'make')"/>
|
|
||||||
<xsl:text>make -k</xsl:text>
|
|
||||||
<xsl:value-of select="substring-after(string(),'make')"/>
|
|
||||||
<xsl:text> || true
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="userinput" mode="screen">
|
|
||||||
<xsl:choose>
|
|
||||||
<!-- Estandarized package formats -->
|
|
||||||
<xsl:when test="contains(string(),'tar.gz')">
|
|
||||||
<xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
|
||||||
<xsl:text>tar.*</xsl:text>
|
|
||||||
<xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<!-- Avoiding a race condition in a patch -->
|
|
||||||
<xsl:when test="contains(string(),'debian_fixes')">
|
|
||||||
<xsl:value-of select="substring-before(string(),'patch')"/>
|
|
||||||
<xsl:text>patch -Z</xsl:text>
|
|
||||||
<xsl:value-of select="substring-after(string(),'patch')"/>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
|
|
||||||
<!-- Copying the kernel config file -->
|
|
||||||
<xsl:when test="string() = 'make mrproper'">
|
|
||||||
<xsl:text>make mrproper
</xsl:text>
|
|
||||||
<xsl:text>cp -v /sources/kernel-config .config
</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
|
|
||||||
<!-- The Coreutils and Module-Init-Tools test suites are optional -->
|
|
||||||
<xsl:when test="$testsuite = '0' and
|
|
||||||
(ancestor::sect1[@id='ch-system-coreutils'] or
|
|
||||||
ancestor::sect1[@id='ch-system-module-init-tools']) and
|
|
||||||
(contains(string(),'check') or
|
|
||||||
contains(string(),'dummy'))"/>
|
|
||||||
|
|
||||||
<!-- Fixing toolchain test suites run -->
|
|
||||||
<xsl:when test="string() = 'make check' or
|
|
||||||
string() = 'make -k check'">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$toolchaintest = '0'"/>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:text>make -k check || true</xsl:text>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="contains(string(),'glibc-check-log')">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$toolchaintest = '0'"/>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="substring-before(string(),'
')"/>
|
|
||||||
<xsl:text> || true
</xsl:text>
|
|
||||||
<xsl:value-of select="substring-after(string(),'
')"/>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="contains(string(),'test_summary') or
|
|
||||||
contains(string(),'expect -c')">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="$toolchaintest = '0'"/>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:apply-templates/>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:when>
|
|
||||||
<!-- Don't stop on strip run -->
|
|
||||||
<xsl:when test="contains(string(),'strip ')">
|
|
||||||
<xsl:apply-templates/>
|
|
||||||
<xsl:text> || true
</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<!-- The rest of commands -->
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:apply-templates/>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<!-- Deal with definable values defined inside <replaceable> -->
|
|
||||||
<xsl:template match="replaceable">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
|
|
||||||
<xsl:text>$TIMEZONE</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="ancestor::sect1[@id='ch-system-uclibc']">
|
|
||||||
<xsl:text>$TIMEZONE</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
|
||||||
<xsl:text>$PAGE</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:text>**EDITME</xsl:text>
|
|
||||||
<xsl:apply-templates/>
|
|
||||||
<xsl:text>EDITME**</xsl:text>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
|
||||||
|
|
|
@ -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
|
|
|
@ -1,25 +0,0 @@
|
||||||
<?xml version='1.0' encoding='ISO-8859-1'?>
|
|
||||||
|
|
||||||
<!-- Get list of patch files from the BLFS Book -->
|
|
||||||
<!-- $LastChangedBy: bdubbs $ -->
|
|
||||||
<!-- $Date$ -->
|
|
||||||
|
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
||||||
version="1.0">
|
|
||||||
|
|
||||||
<xsl:output method="text"/>
|
|
||||||
|
|
||||||
<!-- No text needed -->
|
|
||||||
<xsl:template match="//text()">
|
|
||||||
<xsl:text/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<!-- Just grab the url from the ulink tags that have .patch in the name -->
|
|
||||||
<xsl:template match="//ulink">
|
|
||||||
<xsl:if test="contains(@url, '.patch') or contains(@url, '.patch.gz') and contains(@url, 'linuxfromscratch')">
|
|
||||||
<xsl:value-of select="@url"/>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
|
279
HLFS/hlfs.xsl
Normal file
279
HLFS/hlfs.xsl
Normal file
|
@ -0,0 +1,279 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE xsl:stylesheet [
|
||||||
|
<!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
|
||||||
|
%general-entities;
|
||||||
|
]>
|
||||||
|
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:exsl="http://exslt.org/common"
|
||||||
|
extension-element-prefixes="exsl"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<!-- XSLT stylesheet to create shell scripts from HLFS books. -->
|
||||||
|
|
||||||
|
<!-- What libc implentation must be used? -->
|
||||||
|
<xsl:param name="model" select="glibc"/>
|
||||||
|
|
||||||
|
<!-- Is the host kernel using grsecurity? -->
|
||||||
|
<xsl:param name="grsecurity_host" select="0"/>
|
||||||
|
|
||||||
|
<!-- Compile the keymap into the kernel? -->
|
||||||
|
<xsl:param name="keymap" select="none"/>
|
||||||
|
|
||||||
|
<!-- Run test suites?
|
||||||
|
0 = none
|
||||||
|
1 = only chapter06 Glibc, GCC and Binutils testsuites
|
||||||
|
2 = all chapter06 testsuites
|
||||||
|
3 = all chapter05 and chapter06 testsuites-->
|
||||||
|
<xsl:param name="testsuite" select="1"/>
|
||||||
|
|
||||||
|
<!-- Time zone -->
|
||||||
|
<xsl:param name="timezone" select="America/Toronto"/>
|
||||||
|
|
||||||
|
<!-- Page size -->
|
||||||
|
<xsl:param name="page" select="letter"/>
|
||||||
|
|
||||||
|
<!-- Locale settings -->
|
||||||
|
<xsl:param name="lang" select="en_CA"/>
|
||||||
|
<xsl:param name="lc_all" select="en_CA"/>
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:apply-templates select="//sect1"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="sect1">
|
||||||
|
<xsl:if test="(../@id='chapter-temporary-tools' or
|
||||||
|
../@id='chapter-building-system' or
|
||||||
|
../@id='chapter-bootable') and
|
||||||
|
((@condition=$model or not(@condition)) and
|
||||||
|
count(descendant::screen/userinput) > 0 and
|
||||||
|
count(descendant::screen/userinput) >
|
||||||
|
count(descendant::screen[@role='nodump']))">
|
||||||
|
<!-- The dirs names -->
|
||||||
|
<xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
|
||||||
|
<xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
||||||
|
<xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
||||||
|
<xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
||||||
|
<!-- The file names -->
|
||||||
|
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
||||||
|
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
||||||
|
<xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
||||||
|
<!-- The build order -->
|
||||||
|
<xsl:variable name="position" select="position()"/>
|
||||||
|
<xsl:variable name="order">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="string-length($position) = 1">
|
||||||
|
<xsl:text>00</xsl:text>
|
||||||
|
<xsl:value-of select="$position"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="string-length($position) = 2">
|
||||||
|
<xsl:text>0</xsl:text>
|
||||||
|
<xsl:value-of select="$position"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$position"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Creating dirs and files -->
|
||||||
|
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="@id='ch-system-changingowner' or
|
||||||
|
@id='ch-system-creatingdirs' or
|
||||||
|
@id='ch-system-createfiles'">
|
||||||
|
<xsl:text>#!/tools/bin/bash
set -e

</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="@id='ch-tools-stripping' or
|
||||||
|
@id='ch-system-strippingagain'">
|
||||||
|
<xsl:text>#!/bin/sh
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>#!/bin/sh
set -e

</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:if test="(sect2[@role='installation'] and
|
||||||
|
not(@id='bootable-kernel')) or
|
||||||
|
@id='ch-tools-adjusting' or
|
||||||
|
@id='ch-system-readjusting'">
|
||||||
|
<xsl:text>cd $PKGDIR
</xsl:text>
|
||||||
|
<xsl:if test="@id='ch-tools-uclibc' or @id='ch-system-uclibc'">
|
||||||
|
<xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="@id='ch-tools-glibc' or @id='ch-system-glibc'">
|
||||||
|
<xsl:text>tar -xvf ../glibc-libidn-&glibc-version;.*
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="@id='ch-tools-gcc' or @id='ch-system-gcc'">
|
||||||
|
<xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; 
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="@id='ch-tools-gcc' and $testsuite = '3'">
|
||||||
|
<xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; 
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="@id='ch-system-gcc' and $testsuite != '0'">
|
||||||
|
<xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; 
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="@id='bootable-bootscripts'">
|
||||||
|
<xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; 
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="@id='ch-system-kernfs'">
|
||||||
|
<xsl:text>export HLFS=$LFS
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:apply-templates select=".//para/userinput | .//screen"/>
|
||||||
|
<xsl:text>exit</xsl:text>
|
||||||
|
</exsl:document>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="screen">
|
||||||
|
<xsl:if test="(@condition=$model or not(@condition)) and
|
||||||
|
child::* = userinput and not(@role = 'nodump')">
|
||||||
|
<xsl:apply-templates select="userinput" mode="screen"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="para/userinput">
|
||||||
|
<xsl:if test="(contains(string(),'test') or
|
||||||
|
contains(string(),'check')) and
|
||||||
|
(($testsuite = '1' and
|
||||||
|
(ancestor::sect1[@id='ch-system-gcc'] or
|
||||||
|
ancestor::sect1[@id='ch-system-glibc'])) or
|
||||||
|
($testsuite = '2' and
|
||||||
|
ancestor::chapter[@id='chapter-building-system']) or
|
||||||
|
$testsuite = '3')">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="ancestor::sect1[@id='ch-system-gcc']">
|
||||||
|
<xsl:text>make -k check || true
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="substring-before(string(),'make')"/>
|
||||||
|
<xsl:text>make -k</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),'make')"/>
|
||||||
|
<xsl:text> || true
</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="userinput" mode="screen">
|
||||||
|
<xsl:choose>
|
||||||
|
<!-- Estandarized package formats -->
|
||||||
|
<xsl:when test="contains(string(),'tar.gz')">
|
||||||
|
<xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
||||||
|
<xsl:text>tar.*</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- Avoiding a race condition in a patch -->
|
||||||
|
<xsl:when test="contains(string(),'debian_fixes')">
|
||||||
|
<xsl:value-of select="substring-before(string(),'patch')"/>
|
||||||
|
<xsl:text>patch -Z</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),'patch')"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- grsecurity kernel in the host? -->
|
||||||
|
<xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
|
||||||
|
contains(string(),'sysctl')
|
||||||
|
and $grsecurity_host ='0'"/>
|
||||||
|
<!-- Setting $LC_ALL and $LANG for /etc/profile -->
|
||||||
|
<xsl:when test="ancestor::sect1[@id='bootable-profile'] and
|
||||||
|
contains(string(),'export LANG=')">
|
||||||
|
<xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
|
||||||
|
<xsl:text>export LC_ALL=</xsl:text>
|
||||||
|
<xsl:value-of select="$lc_all"/>
|
||||||
|
<xsl:text>
export LANG=</xsl:text>
|
||||||
|
<xsl:value-of select="$lang"/>
|
||||||
|
<xsl:text>
export INPUTRC</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),'INPUTRC')"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- Fixing bootscripts installation -->
|
||||||
|
<xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
|
||||||
|
string() = 'make install'">
|
||||||
|
<xsl:text>make install
</xsl:text>
|
||||||
|
<xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- Compile the keymap into the kernel? -->
|
||||||
|
<xsl:when test="contains(string(),'defkeymap') and
|
||||||
|
$keymap = 'none'"/>
|
||||||
|
<!-- Copying the kernel config file -->
|
||||||
|
<xsl:when test="string() = 'make mrproper'">
|
||||||
|
<xsl:text>make mrproper
</xsl:text>
|
||||||
|
<xsl:text>cp -v /sources/kernel-config .config
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- No interactive commands are needed if the .config file is the proper one -->
|
||||||
|
<xsl:when test="string() = 'make menuconfig'"/>
|
||||||
|
<!-- For uClibc we need to cd to the Gettext package -->
|
||||||
|
<xsl:when test="contains(string(),'cd gettext-runtime/')">
|
||||||
|
<xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- The Coreutils and Module-Init-Tools test suites are optional -->
|
||||||
|
<xsl:when test="($testsuite = '0' or $testsuite = '1') and
|
||||||
|
(ancestor::sect1[@id='ch-system-coreutils'] or
|
||||||
|
ancestor::sect1[@id='ch-system-module-init-tools']) and
|
||||||
|
(contains(string(),'check') or
|
||||||
|
contains(string(),'distclean') or
|
||||||
|
contains(string(),'dummy'))"/>
|
||||||
|
<!-- Fixing toolchain test suites run -->
|
||||||
|
<xsl:when test="string() = 'make check' or
|
||||||
|
string() = 'make -k check'">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="(($testsuite = '1' or $testsuite = '2') and
|
||||||
|
ancestor::chapter[@id='chapter-building-system']) or
|
||||||
|
$testsuite = '3'">
|
||||||
|
<xsl:text>make -k check || true</xsl:text>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="contains(string(),'make check') and
|
||||||
|
ancestor::sect1[@id='ch-system-binutils']">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$testsuite != '0'">
|
||||||
|
<xsl:value-of select="substring-before(string(),'make check')"/>
|
||||||
|
<xsl:text>make -k check || true
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="contains(string(),'hardened-specs') and
|
||||||
|
ancestor::sect1[@id='ch-system-binutils']
|
||||||
|
and $testsuite = '0'"/>
|
||||||
|
<!-- Don't stop on strip run and chapter05 GCC installation test-->
|
||||||
|
<xsl:when test="contains(string(),'strip ') or
|
||||||
|
ancestor::sect2[@id='testing-gcc'] and
|
||||||
|
not(contains(string(),'EOF'))">
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text> || true
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- The rest of commands -->
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="replaceable">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
|
||||||
|
ancestor::sect1[@id='ch-system-uclibc']">
|
||||||
|
<xsl:value-of select="$timezone"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
||||||
|
<xsl:value-of select="$page"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="ancestor::sect1[@id='bootable-kernel']">
|
||||||
|
<xsl:value-of select="$keymap"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>**EDITME</xsl:text>
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>EDITME**</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
1426
HLFS/jhahlfs
1426
HLFS/jhahlfs
File diff suppressed because it is too large
Load diff
|
@ -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 <locale -a> 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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
616
HLFS/master.sh
Executable file
616
HLFS/master.sh
Executable file
|
@ -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 <MISSING_FILES.DMP> 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"
|
||||||
|
}
|
30
HLFS/patcheslist.xsl
Normal file
30
HLFS/patcheslist.xsl
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version='1.0' encoding='ISO-8859-1'?>
|
||||||
|
|
||||||
|
<!-- $Id$ -->
|
||||||
|
<!-- Get list of patches from the HLFS Book -->
|
||||||
|
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<xsl:output method="text"/>
|
||||||
|
|
||||||
|
<!-- What libc implentation must be used? -->
|
||||||
|
<xsl:param name="model" select="glibc"/>
|
||||||
|
|
||||||
|
<!-- No text needed -->
|
||||||
|
<xsl:template match="//text()">
|
||||||
|
<xsl:text/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Just grab the url from the patches.xml file. Skip possible
|
||||||
|
duplicated URLs due that may be splitted for PDF output -->
|
||||||
|
<xsl:template match="//ulink">
|
||||||
|
<xsl:if test="(ancestor::varlistentry[@condition=$model]
|
||||||
|
or not(ancestor::varlistentry[@condition]))
|
||||||
|
and not(ancestor-or-self::*/@condition = 'pdf')">
|
||||||
|
<xsl:value-of select="@url"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
36
INSTALL
36
INSTALL
|
@ -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
|
|
37
LFS/config
Normal file
37
LFS/config
Normal file
|
@ -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
|
|
@ -4,6 +4,8 @@
|
||||||
%general-entities;
|
%general-entities;
|
||||||
]>
|
]>
|
||||||
|
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:exsl="http://exslt.org/common"
|
xmlns:exsl="http://exslt.org/common"
|
||||||
extension-element-prefixes="exsl"
|
extension-element-prefixes="exsl"
|
||||||
|
@ -21,6 +23,15 @@
|
||||||
<!-- Install vim-lang package? -->
|
<!-- Install vim-lang package? -->
|
||||||
<xsl:param name="vim-lang" select="1"/>
|
<xsl:param name="vim-lang" select="1"/>
|
||||||
|
|
||||||
|
<!-- Time zone -->
|
||||||
|
<xsl:param name="timezone" select="America/Toronto"/>
|
||||||
|
|
||||||
|
<!-- Page size -->
|
||||||
|
<xsl:param name="page" select="letter"/>
|
||||||
|
|
||||||
|
<!-- Locale settings -->
|
||||||
|
<xsl:param name="lang" select="en_CA"/>
|
||||||
|
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<xsl:apply-templates select="//sect1"/>
|
<xsl:apply-templates select="//sect1"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
@ -121,6 +132,15 @@
|
||||||
<xsl:value-of select="substring-after(string(),'patch')"/>
|
<xsl:value-of select="substring-after(string(),'patch')"/>
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<!-- Setting $LANG for /etc/profile -->
|
||||||
|
<xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
|
||||||
|
contains(string(),'export LANG=')">
|
||||||
|
<xsl:value-of select="substring-before(string(),'export LANG=')"/>
|
||||||
|
<xsl:text>export LANG=</xsl:text>
|
||||||
|
<xsl:value-of select="$lang"/>
|
||||||
|
<xsl:value-of select="substring-after(string(),'modifiers]')"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
<!-- Copying the kernel config file -->
|
<!-- Copying the kernel config file -->
|
||||||
<xsl:when test="string() = 'make mrproper'">
|
<xsl:when test="string() = 'make mrproper'">
|
||||||
<xsl:text>make mrproper
</xsl:text>
|
<xsl:text>make mrproper
</xsl:text>
|
||||||
|
@ -181,10 +201,10 @@
|
||||||
<xsl:template match="replaceable">
|
<xsl:template match="replaceable">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
|
<xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
|
||||||
<xsl:text>$TIMEZONE</xsl:text>
|
<xsl:value-of select="$timezone"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
<xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
||||||
<xsl:text>$PAGE</xsl:text>
|
<xsl:value-of select="$page"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:text>**EDITME</xsl:text>
|
<xsl:text>**EDITME</xsl:text>
|
395
LFS/master.sh
Executable file
395
LFS/master.sh
Executable file
|
@ -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"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
20
Makefile
20
Makefile
|
@ -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)
|
|
107
README
107
README
|
@ -1,22 +1,95 @@
|
||||||
jhalfs 0.2
|
$Id$
|
||||||
|
|
||||||
The purpose of jhalfs is to provide a pure automated build of Linux From
|
1. INTRODUCTION::
|
||||||
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.
|
|
||||||
|
|
||||||
There are several options that jhalfs can employ and that may be useful to
|
This collection of scripts, known as jhalfs-X, strives to create
|
||||||
your particular needs. For a full list run:
|
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
|
NOTES::
|
||||||
system. The file 'jhalfs.conf' can be used to specify certain variables of the
|
*. The resulting Makefile takes considerable time to run to completion.
|
||||||
jhalfs build system. For more information, read the 'jhalfs.conf' file as it
|
Lay in a supply of caffeine beverages.
|
||||||
should be self-explanatory.
|
|
||||||
|
|
||||||
For help, questions, or to report a bug, please email the alfs-discuss mailing
|
*. It is recommended that you temporarily unpack your linux kernel,
|
||||||
list:
|
run <make menuconfig>, configure the kernal as per the book and save
|
||||||
alfs-discuss AT linuxfromscratch DOT org
|
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 <symlink> refers to the 1 of 4 package symlinks, lfs,hlfs,clfs,blfs.
|
||||||
|
Replace <symlink> with your choice of packages; i.e.: ./lfs
|
||||||
|
|
||||||
|
./<symlink>
|
||||||
|
Create a makefile based on the settings found in the config files.
|
||||||
|
You must enter the build partition/jhalfs directory and manually run <make>
|
||||||
|
|
||||||
|
./<symlink> -G
|
||||||
|
Download the packages and patches necessary to build <symlink>
|
||||||
|
|
||||||
|
./<symlink> -G -M
|
||||||
|
Download the packages, create and automatically run the Makefile
|
||||||
|
|
||||||
|
./<symlink> --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
|
||||||
|
|
55
TODO
55
TODO
|
@ -1,52 +1,23 @@
|
||||||
jhalfs TODO
|
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
|
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
|
- The BLFS moudule should can be called in conjunction with any of
|
||||||
LFS, CLFS or HLFS modules.
|
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)
|
LFS MODULE (some of this is applicable also to CLFS and HLFS modules)
|
||||||
----------
|
----------
|
||||||
|
|
||||||
DONE - To move the LFS module to their own subdir.
|
- To fix the dowload code when all packages will be placed on the
|
||||||
|
FTP mirrors in the upstream formats.
|
||||||
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 add a switch to build the BLFS module dependencies at the end of
|
- 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
|
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.
|
(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
|
BLFS MODULE
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
@ -126,7 +81,7 @@ OTHERS
|
||||||
NOTE: that could require an special command line switch to regenerate the
|
NOTE: that could require an special command line switch to regenerate the
|
||||||
Makefile if additional scripts are manually added to the *-commands/*/ dirs.
|
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
|
- To add support for package management??? NO by default, but patches
|
||||||
are acepted and will be added to the sources as external contributions.
|
are acepted and will be added to the sources as external contributions.
|
||||||
|
|
1
blfs
Symbolic link
1
blfs
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
master.sh
|
1
clfs
Symbolic link
1
clfs
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
master.sh
|
874
common/common-functions
Normal file
874
common/common-functions
Normal file
|
@ -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 <get_book>"
|
||||||
|
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@<!ENTITY version "@@;s@">@@'`
|
||||||
|
get_sources
|
||||||
|
else
|
||||||
|
echo -ne "done\n"
|
||||||
|
# Set the canonical book version
|
||||||
|
cd $JHALFSDIR
|
||||||
|
VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;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@<!ENTITY version "@@;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@<!ENTITY version "@@;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@<!ENTITY version "@@;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@<!ENTITY @@' \
|
||||||
|
-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@<!ENTITY @@' \
|
||||||
|
-e 's@">@"@' \
|
||||||
|
-e '/generic/d' >> packages
|
||||||
|
echo " ...OK"
|
||||||
|
;;
|
||||||
|
|
||||||
|
lfs)
|
||||||
|
echo -n "Creating <${PROGNAME}> specific packages file"
|
||||||
|
grep "\-version" $BOOK/general.ent | sed -e 's@<!ENTITY @@' \
|
||||||
|
-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@<!ENTITY @@' -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
|
||||||
|
}
|
||||||
|
|
75
common/config
Normal file
75
common/config
Normal file
|
@ -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 <locale -a> 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
|
179
common/func_ICA.sh
Normal file
179
common/func_ICA.sh
Normal file
|
@ -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() { #
|
||||||
|
#----------------------------------#
|
||||||
|
: <<inline_doc
|
||||||
|
desc:
|
||||||
|
|
||||||
|
usage:
|
||||||
|
|
||||||
|
input vars:
|
||||||
|
externals: --
|
||||||
|
modifies: --
|
||||||
|
returns: --
|
||||||
|
on error:
|
||||||
|
on success:
|
||||||
|
inline_doc
|
||||||
|
|
||||||
|
local CMP_DIR F L BN
|
||||||
|
local ALL_FILES=/tmp/allfiles.$$
|
||||||
|
local UNIQUE_FILES=/tmp/uniquefiles.$$
|
||||||
|
local PRUNEPATH="$TT_PFX $PATCHES_DIR $SCRATCH_DIR $TARBALLS_DIR \
|
||||||
|
/dev /home /mnt /proc /root /sys /tmp /usr/src /lost+found"
|
||||||
|
|
||||||
|
if [ ! -f "${STAMP_DIR}/icaprep" ]; then
|
||||||
|
CMP_DIR="${SCRATCH_DIR}/cmp/iter${ITER}"
|
||||||
|
test -d "$CMP_DIR" || mkdir -p $CMP_DIR
|
||||||
|
|
||||||
|
echo -e "\n${BORDER}\n${CYAN}[ICA] - starting ICA preparation for\c"
|
||||||
|
echo -e " Iteration ${ITER}.${OFF}\n"
|
||||||
|
|
||||||
|
# Create a file that we can pass to tar as an "exclude list".
|
||||||
|
# There might be an easier way to achieve tar exclusions? Strip
|
||||||
|
# the leading /.
|
||||||
|
for F in $PRUNEPATH; do
|
||||||
|
echo ${F#*/} >> $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.
|
||||||
|
#----------------------------------#
|
||||||
|
: <<inline_doc
|
||||||
|
desc:
|
||||||
|
|
||||||
|
usage: do_ica_work 1 2
|
||||||
|
do_ica_work 2 3
|
||||||
|
|
||||||
|
input vars: $1 iteration number to use
|
||||||
|
$2 iteration number to use
|
||||||
|
externals: --
|
||||||
|
modifies: --
|
||||||
|
returns: --
|
||||||
|
on error:
|
||||||
|
on success:
|
||||||
|
inline_doc
|
||||||
|
|
||||||
|
local ICA_DIR="${SCRATCH_DIR}/cmp"
|
||||||
|
local RAWDIFF=/tmp/rawdiff.$$
|
||||||
|
local REPORT="${SCRATCH_DIR}/logs/REPORT.${1}V${2}"
|
||||||
|
|
||||||
|
cd $ICA_DIR
|
||||||
|
|
||||||
|
echo -n "Diffing iter${1} and iter${2}... "
|
||||||
|
diff -ur iter${1} iter${2} > $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
|
||||||
|
|
||||||
|
}
|
65
common/func_check_version.sh
Normal file
65
common/func_check_version.sh
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
check_version() {
|
||||||
|
: <<inline_doc
|
||||||
|
Tests for a minimum version level. Compares to version numbers and forces an
|
||||||
|
exit if minimum level not met.
|
||||||
|
NOTE: This test will fail on versions containing alpha chars. ie. jpeg 6b
|
||||||
|
|
||||||
|
usage: check_version "2.6.2" "`uname -r`" "KERNEL"
|
||||||
|
check_version "3.0" "$BASH_VERSION" "BASH"
|
||||||
|
check_version "3.0" "`gcc -dumpversion`" "GCC"
|
||||||
|
|
||||||
|
input vars: $1=min acceptable version
|
||||||
|
$2=version to check
|
||||||
|
$3=app name
|
||||||
|
externals: --
|
||||||
|
modifies: --
|
||||||
|
returns: nothing
|
||||||
|
on error: write text to console and dies
|
||||||
|
on success: write text to console and returns
|
||||||
|
inline_doc
|
||||||
|
|
||||||
|
declare -i major minor revision change
|
||||||
|
declare -i ref_major ref_minor ref_revision ref_change
|
||||||
|
|
||||||
|
ref_version=$1
|
||||||
|
tst_version=$2
|
||||||
|
TXT=$3
|
||||||
|
|
||||||
|
# This saves us the save/restore hassle of the system IFS value
|
||||||
|
local IFS
|
||||||
|
|
||||||
|
# if echo $ref_version | grep [[:alpha:]] 2>&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
|
||||||
|
}
|
||||||
|
|
245
common/func_validate_configs.sh
Normal file
245
common/func_validate_configs.sh
Normal file
|
@ -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 \<common/config\>${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)
|
||||||
|
#----------------------------#
|
||||||
|
: <<inline_doc
|
||||||
|
Validates the configuration parameters. The global var PROGNAME selects the
|
||||||
|
parameter list.
|
||||||
|
|
||||||
|
input vars: none
|
||||||
|
externals: color constants
|
||||||
|
PROGNAME (lfs,clfs,hlfs,blfs)
|
||||||
|
modifies: none
|
||||||
|
returns: nothing
|
||||||
|
on error: write text to console and dies
|
||||||
|
on success: write text to console and returns
|
||||||
|
inline_doc
|
||||||
|
|
||||||
|
# First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
|
||||||
|
local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG DEPEND TEST"
|
||||||
|
local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE MODEL GRSECURITY_HOST TEST STRIP FSTAB CONFIG KEYMAP PAGE TIMEZONE LANG LC_ALL"
|
||||||
|
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE METHOD ARCH TARGET TEST STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
|
||||||
|
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE TEST STRIP FSTAB CONFIG VIMLANG PAGE TIMEZONE LANG"
|
||||||
|
|
||||||
|
local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
|
||||||
|
local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}'
|
||||||
|
local -r PARAM_VALS='${config_param}: ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
|
||||||
|
|
||||||
|
local PARAM_LIST=
|
||||||
|
|
||||||
|
local config_param
|
||||||
|
local validation_str
|
||||||
|
|
||||||
|
write_error_and_die() {
|
||||||
|
echo -e "\n${DD_BORDER}"
|
||||||
|
echo -e "`eval echo ${ERROR_MSG_pt1}`" >&2
|
||||||
|
echo -e "`eval echo ${ERROR_MSG_pt2}`" >&2
|
||||||
|
echo -e "${DD_BORDER}\n"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_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 <empty> 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 <write> 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} ***"
|
||||||
|
}
|
91
common/makefile-functions
Normal file
91
common/makefile-functions
Normal file
|
@ -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
|
59
functions
59
functions
|
@ -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
|
|
1
hlfs
Symbolic link
1
hlfs
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
master.sh
|
|
@ -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
|
|
67
jhalfs.conf
67
jhalfs.conf
|
@ -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
|
|
1
lfs
Symbolic link
1
lfs
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
master.sh
|
481
master.sh
Executable file
481
master.sh
Executable file
|
@ -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 <func_check_version.sh>..."
|
||||||
|
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 <func_validate_configs.sh>..."
|
||||||
|
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
|
||||||
|
|
Reference in a new issue