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