2006-11-11 20:06:46 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
#----------------------------#
|
|
|
|
get_book() { #
|
|
|
|
#----------------------------#
|
|
|
|
cd $JHALFSDIR
|
|
|
|
|
|
|
|
if [ -z $WORKING_COPY ] ; then
|
2017-04-01 13:05:15 +02:00
|
|
|
# Check for Subversion or git instead of just letting the script fail.
|
|
|
|
case $PROGNAME in
|
|
|
|
lfs | hlfs)
|
|
|
|
test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
|
|
|
exit 1"
|
|
|
|
;;
|
|
|
|
clfs*)
|
|
|
|
test `type -p git` || eval "echo \"This feature requires Git.\"
|
|
|
|
exit 1"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2006-11-11 20:06:46 +01:00
|
|
|
echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
|
|
|
|
|
|
|
|
case $PROGNAME in
|
|
|
|
lfs) svn_root="LFS" ;;
|
|
|
|
hlfs) svn_root="HLFS" ;;
|
2014-01-12 22:40:20 +01:00
|
|
|
clfs*) ;;
|
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.
|
2016-05-28 12:00:30 +02:00
|
|
|
if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] &&
|
|
|
|
[ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then
|
2013-09-14 12:13:04 +02:00
|
|
|
svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
2016-05-28 12:00:30 +02:00
|
|
|
elif [ $PROGNAME == "clfs" ] || [ $PROGNAME == "clfs2" ] ||
|
|
|
|
[ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then
|
2013-09-14 12:13:04 +02:00
|
|
|
echo $TREE
|
|
|
|
git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
|
|
|
if [ ! $TREE == "development" ]; then
|
2017-04-01 13:05:15 +02:00
|
|
|
pushd ${PROGNAME}-$LFSVRS > /dev/null
|
2013-09-14 12:13:04 +02:00
|
|
|
echo "Checking out $LFSVRS at $PWD in $TREE"
|
2013-10-03 12:28:37 +02:00
|
|
|
git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
|
2017-04-01 13:05:15 +02:00
|
|
|
popd > /dev/null
|
2013-09-14 12:13:04 +02:00
|
|
|
fi
|
2013-04-04 23:13:02 +02:00
|
|
|
else
|
|
|
|
cd ${PROGNAME}-$LFSVRS
|
2013-09-14 12:13:04 +02:00
|
|
|
case $PROGNAME in
|
2017-04-01 13:05:15 +02:00
|
|
|
clfs*)
|
|
|
|
# If the repo is in "detached head" state, git pull fails, so get
|
|
|
|
# back first to master:
|
|
|
|
git checkout master >>$LOGDIR/$LOG 2>&1
|
|
|
|
git pull >>$LOGDIR/$LOG 2>&1
|
|
|
|
if [ ! $TREE == "development" ]; then
|
|
|
|
git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
|
|
|
|
fi
|
2013-09-22 09:14:33 +02:00
|
|
|
;;
|
2013-09-14 12:13:04 +02:00
|
|
|
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
|
|
|
|
2017-04-01 13:05:15 +02:00
|
|
|
else # Working copy
|
2006-11-11 20:06:46 +01:00
|
|
|
echo -ne "Using $BOOK as book's sources ...\n"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------#
|
|
|
|
extract_commands() { #
|
|
|
|
#----------------------------#
|
|
|
|
|
|
|
|
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/<\/.*//') ;;
|
2016-05-28 12:00:30 +02:00
|
|
|
lfs)
|
|
|
|
if [ "$INITSYS" = "sysv" ] ; then
|
|
|
|
VERSION=$(grep 'ENTITY version ' $BOOK/general.ent| cut -d\" -f2)
|
|
|
|
else
|
|
|
|
VERSION=$(grep 'ENTITY versiond' $BOOK/general.ent| cut -d\" -f2)
|
|
|
|
fi
|
|
|
|
;;
|
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
|
|
|
|
|
2014-01-12 22:40:20 +01:00
|
|
|
# Clean
|
|
|
|
rm -rf ${PROGNAME}-commands
|
2006-11-11 20:06:46 +01:00
|
|
|
|
2014-01-12 22:40:20 +01:00
|
|
|
# Extract the commands
|
|
|
|
echo -n "Extracting commands for"
|
2006-11-11 20:06:46 +01:00
|
|
|
case ${PROGNAME} in
|
|
|
|
clfs)
|
2007-03-21 03:34:14 +01:00
|
|
|
echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
2017-06-29 16:10:30 +02: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" \
|
|
|
|
--stringparam sparc "$SPARC64_PROC" \
|
|
|
|
--stringparam x86 "$TARGET" \
|
|
|
|
--stringparam mips "$TARGET" \
|
|
|
|
-o ./${PROGNAME}-commands/ \
|
|
|
|
$XSL \
|
2016-05-28 12:00:30 +02:00
|
|
|
$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... "
|
2017-06-29 16:10:30 +02:00
|
|
|
xsltproc --nonet \
|
|
|
|
--xinclude \
|
|
|
|
--stringparam vim-lang "$VIMLANG" \
|
|
|
|
--stringparam timezone "$TIMEZONE" \
|
|
|
|
--stringparam page "$PAGE" \
|
|
|
|
--stringparam lang "$LANG" \
|
|
|
|
--output ./${PROGNAME}-commands/ \
|
|
|
|
$XSL \
|
2016-05-28 12:00:30 +02:00
|
|
|
$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... "
|
2017-06-29 16:10:30 +02:00
|
|
|
xsltproc --nonet \
|
|
|
|
--xinclude \
|
|
|
|
--stringparam endian x$ENDIAN \
|
|
|
|
--stringparam timezone "$TIMEZONE" \
|
|
|
|
--stringparam page "$PAGE" \
|
|
|
|
--stringparam lang "$LANG" \
|
|
|
|
--output ./${PROGNAME}-commands/ \
|
|
|
|
$XSL \
|
2016-05-28 12:00:30 +02:00
|
|
|
$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... "
|
2016-05-28 12:00:30 +02:00
|
|
|
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 \
|
|
|
|
--output ./${PROGNAME}-commands/ \
|
|
|
|
$XSL \
|
|
|
|
$BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
2006-11-11 20:06:46 +01:00
|
|
|
;;
|
|
|
|
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
|
2016-05-28 12:00:30 +02:00
|
|
|
|
2017-06-29 16:10:30 +02:00
|
|
|
xsltproc --nonet \
|
|
|
|
--xinclude \
|
|
|
|
--stringparam revision "$INITSYS" \
|
|
|
|
--stringparam testsuite "$TEST" \
|
|
|
|
--stringparam bomb-testsuite "$BOMB_TEST" \
|
|
|
|
--stringparam vim-lang "$VIMLANG" \
|
|
|
|
--stringparam full-locale "$FULL_LOCALE" \
|
|
|
|
--stringparam timezone "$TIMEZONE" \
|
|
|
|
--stringparam page "$PAGE" \
|
|
|
|
--stringparam lang "$LANG" \
|
|
|
|
--stringparam pkgmngt "$PKGMNGT" \
|
|
|
|
--stringparam wrap-install "$WRAP_INSTALL" \
|
|
|
|
--stringparam hostname "$HOSTNAME" \
|
|
|
|
--stringparam interface "$INTERFACE" \
|
|
|
|
--stringparam ip "$IP_ADDR" \
|
|
|
|
--stringparam gateway "$GATEWAY" \
|
|
|
|
--stringparam prefix "$PREFIX" \
|
|
|
|
--stringparam broadcast "$BROADCAST" \
|
|
|
|
--stringparam domain "$DOMAIN" \
|
|
|
|
--stringparam nameserver1 "$DNS1" \
|
|
|
|
--stringparam nameserver2 "$DNS2" \
|
|
|
|
--output ./${PROGNAME}-commands/ \
|
|
|
|
$XSL \
|
2017-03-27 21:10:38 +02:00
|
|
|
$BOOK/index.xml >> $LOGDIR/$LOG 2>&1
|
2006-11-11 20:06:46 +01:00
|
|
|
;;
|
2014-01-12 22:40:20 +01:00
|
|
|
*) echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... "
|
2006-11-11 20:06:46 +01:00
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
|
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
|
2014-01-12 22:40:20 +01:00
|
|
|
create_chroot_scripts
|
2006-11-11 20:06:46 +01:00
|
|
|
|
|
|
|
# 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*)
|
2016-05-28 12:00:30 +02: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)
|
2017-06-29 16:10:30 +02:00
|
|
|
xsltproc --nonet --xinclude \
|
|
|
|
--stringparam model "$MODEL" \
|
|
|
|
--stringparam kernel "$KERNEL" \
|
|
|
|
--output pkg_tarball_list \
|
|
|
|
packages.xsl \
|
2006-11-11 20:06:46 +01:00
|
|
|
$BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
|
|
|
|
;;
|
|
|
|
lfs)
|
2017-06-29 16:10:30 +02:00
|
|
|
xsltproc --nonet --xinclude \
|
|
|
|
--stringparam pkgmngt "$PKGMNGT" \
|
|
|
|
--stringparam revision "$INITSYS" \
|
|
|
|
--output 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
|
|
|
|
|
2007-03-21 03:34:14 +01:00
|
|
|
echo "done"
|
2006-11-11 20:06:46 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-12 22:40:20 +01:00
|
|
|
#----------------------------#
|
|
|
|
create_chroot_scripts() { #
|
|
|
|
#----------------------------#
|
|
|
|
|
|
|
|
rm -rf chroot_scripts
|
|
|
|
echo -n "Creating chroot commands scripts from $BOOK"
|
|
|
|
if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
|
|
|
echo -n "... "
|
|
|
|
case ${PROGNAME} in
|
|
|
|
clfs*)
|
|
|
|
xsltproc --nonet --xinclude \
|
|
|
|
-o chroot-scripts/ chroot.xsl \
|
|
|
|
$BOOK/BOOK/${ARCH}-index.xml >> $LOGDIR/$LOG 2>&1
|
|
|
|
;;
|
|
|
|
hlfs)
|
|
|
|
xsltproc --nonet --xinclude \
|
|
|
|
-o chroot-scripts/ chroot.xsl \
|
|
|
|
$BOOK/index.xml >> $LOGDIR/$LOG 2>&1
|
|
|
|
;;
|
|
|
|
lfs)
|
|
|
|
xsltproc --nonet --xinclude \
|
|
|
|
-o chroot-scripts/ chroot.xsl \
|
|
|
|
$BOOK/chapter06/chapter06.xml >> $LOGDIR/$LOG 2>&1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
esac
|
|
|
|
echo "done"
|
|
|
|
|
|
|
|
}
|