[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 \
|
---|
[650acce] | 96 | --stringparam sparc $SPARC64_PROC \
|
---|
[fe30c61] | 97 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 98 | ;;
|
---|
| 99 |
|
---|
| 100 | clfs2)
|
---|
[b11c10b] | 101 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
---|
[fe30c61] | 102 | xsltproc --nonet \
|
---|
| 103 | --xinclude \
|
---|
| 104 | --stringparam vim-lang $VIMLANG \
|
---|
| 105 | --stringparam timezone $TIMEZONE \
|
---|
| 106 | --stringparam page $PAGE \
|
---|
| 107 | --stringparam lang $LANG \
|
---|
| 108 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 109 | ;;
|
---|
| 110 |
|
---|
| 111 | clfs3)
|
---|
[b11c10b] | 112 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
---|
[fe30c61] | 113 | xsltproc --nonet \
|
---|
| 114 | --xinclude \
|
---|
[9436828] | 115 | --stringparam endian x$ENDIAN \
|
---|
[fe30c61] | 116 | --stringparam timezone $TIMEZONE \
|
---|
| 117 | --stringparam page $PAGE \
|
---|
| 118 | --stringparam lang $LANG \
|
---|
| 119 | -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 120 | ;;
|
---|
| 121 |
|
---|
| 122 | hlfs)
|
---|
[139c34e] | 123 | echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
|
---|
[fe30c61] | 124 | xsltproc --nonet \
|
---|
| 125 | --xinclude \
|
---|
| 126 | --stringparam model $MODEL \
|
---|
[5c575e1] | 127 | --stringparam kernel $KERNEL \
|
---|
[fe30c61] | 128 | --stringparam testsuite $TEST \
|
---|
| 129 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
[31eb678] | 130 | --stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
|
---|
[fe30c61] | 131 | --stringparam timezone $TIMEZONE \
|
---|
| 132 | --stringparam page $PAGE \
|
---|
| 133 | --stringparam lang $LANG \
|
---|
| 134 | --stringparam grsecurity_host $GRSECURITY_HOST \
|
---|
| 135 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 136 | ;;
|
---|
| 137 | lfs)
|
---|
[b11c10b] | 138 | echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
|
---|
[4c6f54f] | 139 | pushd $BOOK > /dev/null
|
---|
| 140 | bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
|
---|
| 141 | popd > /dev/null
|
---|
[fe30c61] | 142 | xsltproc --nonet \
|
---|
| 143 | --xinclude \
|
---|
| 144 | --stringparam testsuite $TEST \
|
---|
| 145 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
| 146 | --stringparam vim-lang $VIMLANG \
|
---|
[b339c94] | 147 | --stringparam full-locale $FULL_LOCALE \
|
---|
[fe30c61] | 148 | --stringparam timezone $TIMEZONE \
|
---|
| 149 | --stringparam page $PAGE \
|
---|
| 150 | --stringparam lang $LANG \
|
---|
[7072e1f] | 151 | --stringparam pkgmngt $PKGMNGT \
|
---|
[fe30c61] | 152 | -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 153 | ;;
|
---|
[b11c10b] | 154 | *) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
|
---|
[fe30c61] | 155 | exit 1 ;;
|
---|
| 156 | esac
|
---|
| 157 |
|
---|
| 158 | [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
|
---|
| 159 |
|
---|
[b11c10b] | 160 | echo "done"
|
---|
[fe30c61] | 161 |
|
---|
| 162 | # Make the scripts executable.
|
---|
| 163 | chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
---|
| 164 |
|
---|
| 165 | # Create the packages file. We need it for proper Makefile creation
|
---|
| 166 | create_package_list
|
---|
| 167 |
|
---|
| 168 | # Done. Moving on...
|
---|
| 169 | get_sources
|
---|
| 170 |
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | #----------------------------#
|
---|
| 174 | create_package_list() { #
|
---|
| 175 | #----------------------------#
|
---|
| 176 |
|
---|
| 177 | # Create the packages file. We need it for proper Makefile creation
|
---|
| 178 | rm -f pkg_tarball_list
|
---|
[b11c10b] | 179 | echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
|
---|
| 180 | if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
---|
| 181 | echo -n "... "
|
---|
[fe30c61] | 182 | case ${PROGNAME} in
|
---|
| 183 | clfs | clfs2 | clfs3 )
|
---|
| 184 | xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
|
---|
| 185 | $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 186 | ;;
|
---|
| 187 | hlfs)
|
---|
[6d48bb7] | 188 | xsltproc --nonet --xinclude \
|
---|
[139c34e] | 189 | --stringparam model $MODEL \
|
---|
| 190 | --stringparam kernel $KERNEL \
|
---|
| 191 | -o pkg_tarball_list packages.xsl \
|
---|
[fe30c61] | 192 | $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 193 | ;;
|
---|
| 194 | lfs)
|
---|
[7072e1f] | 195 | xsltproc --nonet --xinclude \
|
---|
| 196 | --stringparam pkgmngt $PKGMNGT \
|
---|
| 197 | -o pkg_tarball_list packages.xsl \
|
---|
[fe30c61] | 198 | $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 199 | ;;
|
---|
| 200 | esac
|
---|
| 201 |
|
---|
| 202 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
| 203 | (
|
---|
| 204 | cat << EOF
|
---|
| 205 | $LIBXML_PKG
|
---|
| 206 | $LIBXSLT_PKG
|
---|
| 207 | $TIDY_PKG
|
---|
| 208 | $UNZIP_PKG
|
---|
| 209 | $DBXML_PKG
|
---|
| 210 | $DBXSL_PKG
|
---|
[d09e32a] | 211 | $LYNX_PKG
|
---|
[fe30c61] | 212 | $SUDO_PKG
|
---|
| 213 | $WGET_PKG
|
---|
[7072e1f] | 214 | $SQLITE_PKG
|
---|
| 215 | $APR_PKG
|
---|
| 216 | $APR_U_PKG
|
---|
[fe30c61] | 217 | $SVN_PKG
|
---|
| 218 | $GPM_PKG
|
---|
| 219 | EOF
|
---|
| 220 | ) >> pkg_tarball_list
|
---|
| 221 | fi
|
---|
| 222 |
|
---|
[b11c10b] | 223 | echo "done"
|
---|
[fe30c61] | 224 |
|
---|
| 225 | }
|
---|
| 226 |
|
---|