165 lines
5.8 KiB
Bash
165 lines
5.8 KiB
Bash
#!/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" ;;
|
|
clfs) svn_root="cross-lfs" ;;
|
|
clfs2) svn_root="cross-lfs" ;;
|
|
clfs3) svn_root="cross-lfs" ;;
|
|
*) 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/${PROGNAME}-commands && \
|
|
test -f $JHALFSDIR/pkg_tarball_list ; then
|
|
# Set the canonical book version
|
|
echo -ne "done\n"
|
|
cd $JHALFSDIR
|
|
case $PROGNAME in
|
|
clfs | clfs2 | clfs3 )
|
|
VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
|
*)
|
|
VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
|
esac
|
|
get_sources
|
|
else
|
|
echo -ne "done\n"
|
|
extract_commands
|
|
fi
|
|
else
|
|
svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
|
echo -ne "done\n"
|
|
extract_commands
|
|
fi
|
|
|
|
else
|
|
echo -ne "Using $BOOK as book's sources ...\n"
|
|
extract_commands
|
|
fi
|
|
echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n"
|
|
}
|
|
|
|
#----------------------------#
|
|
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
|
|
clfs | clfs2 | clfs3 )
|
|
VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
|
*)
|
|
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 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 bomb-testsuite $BOMB_TEST \
|
|
--stringparam vim-lang $VIMLANG \
|
|
--stringparam timezone $TIMEZONE \
|
|
--stringparam page $PAGE \
|
|
--stringparam lang $LANG \
|
|
--stringparam sparc $SPARC64_PROC \
|
|
-o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
|
;;
|
|
|
|
clfs2)
|
|
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
|
xsltproc --nonet \
|
|
--xinclude \
|
|
--stringparam vim-lang $VIMLANG \
|
|
--stringparam timezone $TIMEZONE \
|
|
--stringparam page $PAGE \
|
|
--stringparam lang $LANG \
|
|
-o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
|
;;
|
|
|
|
clfs3)
|
|
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
|
xsltproc --nonet \
|
|
--xinclude \
|
|
--stringparam endian x$ENDIAN \
|
|
--stringparam timezone $TIMEZONE \
|
|
--stringparam page $PAGE \
|
|
--stringparam lang $LANG \
|
|
-o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
|
;;
|
|
|
|
hlfs)
|
|
echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
|
|
xsltproc --nonet \
|
|
--xinclude \
|
|
--stringparam model $MODEL \
|
|
--stringparam kernel $KERNEL \
|
|
--stringparam testsuite $TEST \
|
|
--stringparam bomb-testsuite $BOMB_TEST \
|
|
--stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
|
|
--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)
|
|
echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
|
|
xsltproc --nonet \
|
|
--xinclude \
|
|
--stringparam testsuite $TEST \
|
|
--stringparam bomb-testsuite $BOMB_TEST \
|
|
--stringparam vim-lang $VIMLANG \
|
|
--stringparam timezone $TIMEZONE \
|
|
--stringparam page $PAGE \
|
|
--stringparam lang $LANG \
|
|
--stringparam custom-tools $CUSTOM_TOOLS \
|
|
--stringparam blfs-tool $BLFS_TOOL \
|
|
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
|
;;
|
|
*) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
|
|
exit 1 ;;
|
|
esac
|
|
|
|
[[ "${BLFS_TOOL}" = "y" ]] && blfs_tool_clean_scripts
|
|
|
|
echo "done"
|
|
|
|
# Make the scripts executable.
|
|
chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
|
|
|
# Done. Moving on...
|
|
get_sources
|
|
|
|
}
|