source: common/libs/func_book_parser@ 1f3e275

ablfs
Last change on this file since 1f3e275 was 1825286, checked in by Pierre Labastie <pierre@…>, 12 years ago

Merge trunk r3694

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