[fe30c61] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # $Id$
|
---|
| 4 |
|
---|
| 5 | #----------------------------#
|
---|
| 6 | get_book() { #
|
---|
| 7 | #----------------------------#
|
---|
| 8 | cd $JHALFSDIR
|
---|
| 9 |
|
---|
| 10 | if [ -z $WORKING_COPY ] ; then
|
---|
| 11 | # Check for Subversion instead of just letting the script hit 'svn' and fail.
|
---|
| 12 | test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
---|
| 13 | exit 1"
|
---|
| 14 | echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
|
---|
| 15 |
|
---|
| 16 | case $PROGNAME in
|
---|
| 17 | lfs) svn_root="LFS" ;;
|
---|
| 18 | hlfs) svn_root="HLFS" ;;
|
---|
| 19 | clfs) svn_root="cross-lfs" ;;
|
---|
| 20 | clfs2) svn_root="cross-lfs" ;;
|
---|
| 21 | clfs3) svn_root="cross-lfs" ;;
|
---|
| 22 | *) echo "BOOK not defined in function <get_book>"
|
---|
| 23 | exit 1 ;;
|
---|
| 24 | esac
|
---|
| 25 | # Grab a fresh book if it's missing, otherwise, update it from the
|
---|
| 26 | # repo. If we've already extracted the commands, move on to getting the
|
---|
| 27 | # sources.
|
---|
| 28 | if [ -d ${PROGNAME}-$LFSVRS ] ; then
|
---|
| 29 | cd ${PROGNAME}-$LFSVRS
|
---|
| 30 | if LC_ALL=C svn up | grep -q At && \
|
---|
| 31 | test -d $JHALFSDIR/${PROGNAME}-commands && \
|
---|
| 32 | test -f $JHALFSDIR/pkg_tarball_list ; then
|
---|
| 33 | # Set the canonical book version
|
---|
| 34 | echo -ne "done\n"
|
---|
| 35 | cd $JHALFSDIR
|
---|
| 36 | case $PROGNAME in
|
---|
| 37 | clfs | clfs2 | clfs3 )
|
---|
| 38 | VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 39 | *)
|
---|
| 40 | VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 41 | esac
|
---|
| 42 | get_sources
|
---|
| 43 | else
|
---|
| 44 | echo -ne "done\n"
|
---|
| 45 | extract_commands
|
---|
| 46 | fi
|
---|
| 47 | else
|
---|
| 48 | svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
---|
| 49 | echo -ne "done\n"
|
---|
| 50 | extract_commands
|
---|
| 51 | fi
|
---|
| 52 |
|
---|
| 53 | else
|
---|
| 54 | echo -ne "Using $BOOK as book's sources ...\n"
|
---|
| 55 | extract_commands
|
---|
| 56 | fi
|
---|
| 57 | echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n"
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | #----------------------------#
|
---|
| 61 | extract_commands() { #
|
---|
| 62 | #----------------------------#
|
---|
| 63 |
|
---|
| 64 | # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
---|
| 65 | test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
---|
| 66 | exit 1"
|
---|
| 67 |
|
---|
| 68 | cd $JHALFSDIR
|
---|
| 69 | case $PROGNAME in
|
---|
[9c1838b] | 70 | clfs | clfs2 | clfs3 )
|
---|
[fe30c61] | 71 | VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 72 | *)
|
---|
| 73 | VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 74 | esac
|
---|
| 75 |
|
---|
| 76 | # Start clean
|
---|
| 77 | if [ -d ${PROGNAME}-commands ]; then
|
---|
| 78 | rm -rf ${PROGNAME}-commands
|
---|
| 79 | mkdir -v ${PROGNAME}-commands
|
---|
| 80 | fi
|
---|
| 81 | echo -n "Extracting commands for"
|
---|
| 82 |
|
---|
| 83 | # Dump the commands in shell script form from the HLFS book.
|
---|
| 84 | case ${PROGNAME} in
|
---|
| 85 | clfs)
|
---|
[b11c10b] | 86 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
---|
[fe30c61] | 87 | xsltproc --nonet \
|
---|
| 88 | --xinclude \
|
---|
| 89 | --stringparam method $METHOD \
|
---|
| 90 | --stringparam testsuite $TEST \
|
---|
| 91 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
| 92 | --stringparam vim-lang $VIMLANG \
|
---|
| 93 | --stringparam timezone $TIMEZONE \
|
---|
| 94 | --stringparam page $PAGE \
|
---|
| 95 | --stringparam lang $LANG \
|
---|
| 96 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 97 | ;;
|
---|
| 98 |
|
---|
| 99 | clfs2)
|
---|
[b11c10b] | 100 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
---|
[fe30c61] | 101 | xsltproc --nonet \
|
---|
| 102 | --xinclude \
|
---|
| 103 | --stringparam vim-lang $VIMLANG \
|
---|
| 104 | --stringparam timezone $TIMEZONE \
|
---|
| 105 | --stringparam page $PAGE \
|
---|
| 106 | --stringparam lang $LANG \
|
---|
| 107 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 108 | ;;
|
---|
| 109 |
|
---|
| 110 | clfs3)
|
---|
[b11c10b] | 111 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
---|
[fe30c61] | 112 | xsltproc --nonet \
|
---|
| 113 | --xinclude \
|
---|
| 114 | --stringparam timezone $TIMEZONE \
|
---|
| 115 | --stringparam page $PAGE \
|
---|
| 116 | --stringparam lang $LANG \
|
---|
| 117 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 118 | ;;
|
---|
| 119 |
|
---|
| 120 | hlfs)
|
---|
[b11c10b] | 121 | echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation... "
|
---|
[fe30c61] | 122 | xsltproc --nonet \
|
---|
| 123 | --xinclude \
|
---|
| 124 | --stringparam model $MODEL \
|
---|
| 125 | --stringparam testsuite $TEST \
|
---|
| 126 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
| 127 | --stringparam timezone $TIMEZONE \
|
---|
| 128 | --stringparam page $PAGE \
|
---|
| 129 | --stringparam lang $LANG \
|
---|
| 130 | --stringparam grsecurity_host $GRSECURITY_HOST \
|
---|
| 131 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 132 | ;;
|
---|
| 133 | lfs)
|
---|
[b11c10b] | 134 | echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
|
---|
[fe30c61] | 135 | xsltproc --nonet \
|
---|
| 136 | --xinclude \
|
---|
| 137 | --stringparam testsuite $TEST \
|
---|
| 138 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
| 139 | --stringparam vim-lang $VIMLANG \
|
---|
| 140 | --stringparam timezone $TIMEZONE \
|
---|
| 141 | --stringparam page $PAGE \
|
---|
| 142 | --stringparam lang $LANG \
|
---|
| 143 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 144 | ;;
|
---|
[b11c10b] | 145 | *) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
|
---|
[fe30c61] | 146 | exit 1 ;;
|
---|
| 147 | esac
|
---|
| 148 |
|
---|
| 149 | [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
|
---|
| 150 |
|
---|
[b11c10b] | 151 | echo "done"
|
---|
[fe30c61] | 152 |
|
---|
| 153 | # Make the scripts executable.
|
---|
| 154 | chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
---|
| 155 |
|
---|
| 156 | # Create the packages file. We need it for proper Makefile creation
|
---|
| 157 | create_package_list
|
---|
| 158 |
|
---|
| 159 | # Done. Moving on...
|
---|
| 160 | get_sources
|
---|
| 161 |
|
---|
| 162 | }
|
---|
| 163 |
|
---|
| 164 | #----------------------------#
|
---|
| 165 | create_package_list() { #
|
---|
| 166 | #----------------------------#
|
---|
| 167 |
|
---|
| 168 | # Create the packages file. We need it for proper Makefile creation
|
---|
| 169 | rm -f pkg_tarball_list
|
---|
[b11c10b] | 170 | echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
|
---|
| 171 | if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
---|
| 172 | echo -n "... "
|
---|
[fe30c61] | 173 | case ${PROGNAME} in
|
---|
| 174 | clfs | clfs2 | clfs3 )
|
---|
| 175 | xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
|
---|
| 176 | $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 177 | ;;
|
---|
| 178 | hlfs)
|
---|
| 179 | xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
|
---|
| 180 | $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 181 | ;;
|
---|
| 182 | lfs)
|
---|
| 183 | xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
|
---|
| 184 | $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 185 | ;;
|
---|
| 186 | esac
|
---|
| 187 |
|
---|
| 188 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
| 189 | (
|
---|
| 190 | cat << EOF
|
---|
| 191 | $LIBXML_PKG
|
---|
| 192 | $LIBXSLT_PKG
|
---|
| 193 | $TIDY_PKG
|
---|
| 194 | $UNZIP_PKG
|
---|
| 195 | $DBXML_PKG
|
---|
| 196 | $DBXSL_PKG
|
---|
| 197 | $LINKS_PKG
|
---|
| 198 | $SUDO_PKG
|
---|
| 199 | $WGET_PKG
|
---|
| 200 | $SVN_PKG
|
---|
| 201 | $GPM_PKG
|
---|
| 202 | EOF
|
---|
| 203 | ) >> pkg_tarball_list
|
---|
| 204 | fi
|
---|
| 205 |
|
---|
[b11c10b] | 206 | echo "done"
|
---|
[fe30c61] | 207 |
|
---|
| 208 | }
|
---|
| 209 |
|
---|