2006-11-11 20:06:46 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
#----------------------------#
|
|
|
|
get_book() { #
|
|
|
|
#----------------------------#
|
|
|
|
cd $JHALFSDIR
|
|
|
|
|
|
|
|
if [ -z $WORKING_COPY ] ; then
|
|
|
|
# Check for Subversion instead of just letting the script hit 'svn' and fail.
|
|
|
|
test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
|
|
|
exit 1"
|
|
|
|
echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
|
|
|
|
|
|
|
|
case $PROGNAME in
|
|
|
|
lfs) svn_root="LFS" ;;
|
|
|
|
hlfs) svn_root="HLFS" ;;
|
2013-09-14 12:13:04 +02:00
|
|
|
clfs*) svn_root="cross-lfs" ;;
|
2006-11-11 20:06:46 +01:00
|
|
|
*) 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.
|
2013-09-14 12:13:04 +02:00
|
|
|
if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then
|
|
|
|
svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
|
|
|
elif [ $PROGNAME == "clfs" ] || [ $PROGNAME == "clfs2" ] || [ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then
|
|
|
|
echo $TREE
|
|
|
|
git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
|
|
|
if [ ! $TREE == "development" ]; then
|
|
|
|
cd ${PROGNAME}-$LFSVRS
|
|
|
|
echo "Checking out $LFSVRS at $PWD in $TREE"
|
|
|
|
git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
|
|
|
|
fi
|
2013-04-04 23:13:02 +02:00
|
|
|
else
|
|
|
|
cd ${PROGNAME}-$LFSVRS
|
2013-09-14 12:13:04 +02:00
|
|
|
case $PROGNAME in
|
|
|
|
clfs*) git pull >>$LOGDIR/$LOG 2>&1 ;;
|
|
|
|
lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
2006-11-11 20:06:46 +01:00
|
|
|
fi
|
2013-04-04 23:13:02 +02:00
|
|
|
echo -ne "done\n"
|
2006-11-11 20:06:46 +01:00
|
|
|
|
|
|
|
else
|
|
|
|
echo -ne "Using $BOOK as book's sources ...\n"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------#
|
|
|
|
extract_commands() { #
|
|
|
|
#----------------------------#
|
|
|
|
|
|
|
|
# Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
|
|
|
test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
|
|
|
exit 1"
|
|
|
|
|
|
|
|
cd $JHALFSDIR
|
|
|
|
case $PROGNAME in
|
2013-09-14 12:13:04 +02:00
|
|
|
clfs*)
|
2013-09-17 15:42:25 +02:00
|
|
|
VERSION=$(xmllint --noent $BOOK/BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
2006-11-11 20:06:46 +01:00
|
|
|
*)
|
|
|
|
VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Start clean
|
|
|
|
if [ -d ${PROGNAME}-commands ]; then
|
|
|
|
rm -rf ${PROGNAME}-commands
|
|
|
|
mkdir -v ${PROGNAME}-commands
|
|
|
|
fi
|
|
|
|
echo -n "Extracting commands for"
|
|
|
|
|
|
|
|
# Dump the commands in shell script form from the HLFS book.
|
|
|
|
case ${PROGNAME} in
|
|
|
|
clfs)
|
2007-03-21 03:34:14 +01:00
|
|
|
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
2006-11-11 20:06:46 +01:00
|
|
|
xsltproc --nonet \
|
|
|
|
--xinclude \
|
|
|
|
--stringparam method $METHOD \
|
|
|
|
--stringparam testsuite $TEST \
|
|
|
|
--stringparam bomb-testsuite $BOMB_TEST \
|
|
|
|
--stringparam vim-lang $VIMLANG \
|
|
|
|
--stringparam timezone $TIMEZONE \
|
|
|
|
--stringparam page $PAGE \
|
|
|
|
--stringparam lang $LANG \
|
2007-07-28 17:40:53 +02:00
|
|
|
--stringparam sparc $SPARC64_PROC \
|
2013-09-14 12:13:04 +02:00
|
|
|
-o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
2006-11-11 20:06:46 +01:00
|
|
|
;;
|
|
|
|
|
|
|
|
clfs2)
|
2007-03-21 03:34:14 +01:00
|
|
|
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
2006-11-11 20:06:46 +01:00
|
|
|
xsltproc --nonet \
|
|
|
|
--xinclude \
|
|
|
|
--stringparam vim-lang $VIMLANG \
|
|
|
|
--stringparam timezone $TIMEZONE \
|
|
|
|
--stringparam page $PAGE \
|
|
|
|
--stringparam lang $LANG \
|
2013-09-14 12:13:04 +02:00
|
|
|
-o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
2006-11-11 20:06:46 +01:00
|
|
|
;;
|
|
|
|
|
|
|
|
clfs3)
|
2007-03-21 03:34:14 +01:00
|
|
|
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
2006-11-11 20:06:46 +01:00
|
|
|
xsltproc --nonet \
|
|
|
|
--xinclude \
|
2007-07-24 21:22:46 +02:00
|
|
|
--stringparam endian x$ENDIAN \
|
2006-11-11 20:06:46 +01:00
|
|
|
--stringparam timezone $TIMEZONE \
|
|
|
|
--stringparam page $PAGE \
|
|
|
|
--stringparam lang $LANG \
|
2013-09-14 12:13:04 +02:00
|
|
|
-o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
2006-11-11 20:06:46 +01:00
|
|
|
;;
|
|
|
|
|
|
|
|
hlfs)
|
2007-06-03 12:54:07 +02:00
|
|
|
echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
|
2006-11-11 20:06:46 +01:00
|
|
|
xsltproc --nonet \
|
|
|
|
--xinclude \
|
|
|
|
--stringparam model $MODEL \
|
2007-06-03 12:27:05 +02:00
|
|
|
--stringparam kernel $KERNEL \
|
2006-11-11 20:06:46 +01:00
|
|
|
--stringparam testsuite $TEST \
|
|
|
|
--stringparam bomb-testsuite $BOMB_TEST \
|
2007-06-18 22:09:53 +02:00
|
|
|
--stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
|
2006-11-11 20:06:46 +01:00
|
|
|
--stringparam timezone $TIMEZONE \
|
|
|
|
--stringparam page $PAGE \
|
|
|
|
--stringparam lang $LANG \
|
|
|
|
--stringparam grsecurity_host $GRSECURITY_HOST \
|
|
|
|
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
|
|
|
;;
|
|
|
|
lfs)
|
2007-03-21 03:34:14 +01:00
|
|
|
echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
|
2012-02-21 09:58:49 +01:00
|
|
|
pushd $BOOK > /dev/null
|
2013-03-03 13:33:25 +01:00
|
|
|
if [ -f process-scripts.sh ]; then
|
2013-03-02 15:10:45 +01:00
|
|
|
bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
|
|
|
|
fi
|
2012-02-21 09:58:49 +01:00
|
|
|
popd > /dev/null
|
2006-11-11 20:06:46 +01:00
|
|
|
xsltproc --nonet \
|
|
|
|
--xinclude \
|
|
|
|
--stringparam testsuite $TEST \
|
|
|
|
--stringparam bomb-testsuite $BOMB_TEST \
|
|
|
|
--stringparam vim-lang $VIMLANG \
|
2012-02-10 10:43:23 +01:00
|
|
|
--stringparam full-locale $FULL_LOCALE \
|
2006-11-11 20:06:46 +01:00
|
|
|
--stringparam timezone $TIMEZONE \
|
|
|
|
--stringparam page $PAGE \
|
|
|
|
--stringparam lang $LANG \
|
2012-02-02 00:29:37 +01:00
|
|
|
--stringparam pkgmngt $PKGMNGT \
|
2006-11-11 20:06:46 +01:00
|
|
|
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
|
|
|
;;
|
2007-03-21 03:34:14 +01:00
|
|
|
*) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
|
2006-11-11 20:06:46 +01:00
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
[[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
|
|
|
|
|
2007-03-21 03:34:14 +01:00
|
|
|
echo "done"
|
2006-11-11 20:06:46 +01:00
|
|
|
|
|
|
|
# Make the scripts executable.
|
|
|
|
chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
|
|
|
|
|
|
|
# Create the packages file. We need it for proper Makefile creation
|
|
|
|
create_package_list
|
|
|
|
|
|
|
|
# Done. Moving on...
|
|
|
|
get_sources
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------#
|
|
|
|
create_package_list() { #
|
|
|
|
#----------------------------#
|
|
|
|
|
|
|
|
# Create the packages file. We need it for proper Makefile creation
|
|
|
|
rm -f pkg_tarball_list
|
2007-03-21 03:34:14 +01:00
|
|
|
echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
|
|
|
|
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
|
|
|
echo -n "... "
|
2006-11-11 20:06:46 +01:00
|
|
|
case ${PROGNAME} in
|
2013-09-14 12:13:04 +02:00
|
|
|
clfs*)
|
2006-11-11 20:06:46 +01:00
|
|
|
xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
|
2013-09-14 12:13:04 +02:00
|
|
|
$BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
|
2006-11-11 20:06:46 +01:00
|
|
|
;;
|
|
|
|
hlfs)
|
2007-06-04 19:05:56 +02:00
|
|
|
xsltproc --nonet --xinclude \
|
2007-06-03 12:54:07 +02:00
|
|
|
--stringparam model $MODEL \
|
|
|
|
--stringparam kernel $KERNEL \
|
|
|
|
-o pkg_tarball_list packages.xsl \
|
2006-11-11 20:06:46 +01:00
|
|
|
$BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
|
|
|
|
;;
|
|
|
|
lfs)
|
2012-02-02 00:29:37 +01:00
|
|
|
xsltproc --nonet --xinclude \
|
|
|
|
--stringparam pkgmngt $PKGMNGT \
|
|
|
|
-o pkg_tarball_list packages.xsl \
|
2006-11-11 20:06:46 +01:00
|
|
|
$BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
|
|
|
|
;;
|
2013-09-14 12:13:04 +02:00
|
|
|
*)
|
2006-11-11 20:06:46 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
$LIBXML_PKG
|
|
|
|
$LIBXSLT_PKG
|
|
|
|
$TIDY_PKG
|
|
|
|
$UNZIP_PKG
|
|
|
|
$DBXML_PKG
|
|
|
|
$DBXSL_PKG
|
2007-08-08 19:24:58 +02:00
|
|
|
$LYNX_PKG
|
2006-11-11 20:06:46 +01:00
|
|
|
$SUDO_PKG
|
|
|
|
$WGET_PKG
|
2012-02-02 00:29:37 +01:00
|
|
|
$SQLITE_PKG
|
|
|
|
$APR_PKG
|
|
|
|
$APR_U_PKG
|
2006-11-11 20:06:46 +01:00
|
|
|
$SVN_PKG
|
|
|
|
$GPM_PKG
|
|
|
|
EOF
|
|
|
|
) >> pkg_tarball_list
|
|
|
|
fi
|
|
|
|
|
2007-03-21 03:34:14 +01:00
|
|
|
echo "done"
|
2006-11-11 20:06:46 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|