source: common/libs/func_book_parser@ 0a661b6

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

Merge trunk r3694

  • Property mode set to 100644
File size: 6.5 KB
Line 
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.
28 if ! [ -d ${PROGNAME}-$LFSVRS ] || ! [ -d ${PROGNAME}-$LFSVRS/.svn ]; then
29 svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
30 else
31 cd ${PROGNAME}-$LFSVRS
32 svn up >>$LOGDIR/$LOG 2>&1
33 fi
34 echo -ne "done\n"
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
51 clfs | clfs2 | clfs3 )
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)
67 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
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 \
77 --stringparam sparc $SPARC64_PROC \
78 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
79 ;;
80
81 clfs2)
82 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
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)
93 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
94 xsltproc --nonet \
95 --xinclude \
96 --stringparam endian x$ENDIAN \
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)
104 echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
105 xsltproc --nonet \
106 --xinclude \
107 --stringparam model $MODEL \
108 --stringparam kernel $KERNEL \
109 --stringparam testsuite $TEST \
110 --stringparam bomb-testsuite $BOMB_TEST \
111 --stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
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)
119 echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
120 pushd $BOOK > /dev/null
121 if [ -f process-scripts.sh ]; then
122 bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
123 fi
124 popd > /dev/null
125 xsltproc --nonet \
126 --xinclude \
127 --stringparam testsuite $TEST \
128 --stringparam bomb-testsuite $BOMB_TEST \
129 --stringparam vim-lang $VIMLANG \
130 --stringparam full-locale $FULL_LOCALE \
131 --stringparam timezone $TIMEZONE \
132 --stringparam page $PAGE \
133 --stringparam lang $LANG \
134 --stringparam pkgmngt $PKGMNGT \
135 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
136 ;;
137 *) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
138 exit 1 ;;
139 esac
140
141 echo "done"
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
160 echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
161 if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
162 echo -n "... "
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)
169 xsltproc --nonet --xinclude \
170 --stringparam model $MODEL \
171 --stringparam kernel $KERNEL \
172 -o pkg_tarball_list packages.xsl \
173 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
174 ;;
175 lfs)
176 xsltproc --nonet --xinclude \
177 --stringparam pkgmngt $PKGMNGT \
178 -o pkg_tarball_list packages.xsl \
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
192$LYNX_PKG
193$SUDO_PKG
194$WGET_PKG
195$SQLITE_PKG
196$APR_PKG
197$APR_U_PKG
198$SVN_PKG
199$GPM_PKG
200EOF
201) >> pkg_tarball_list
202 fi
203
204 echo "done"
205
206}
207
Note: See TracBrowser for help on using the repository browser.