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