source: common/libs/func_book_parser@ eb14b7f

2.4 ablfs-more legacy new_features trunk
Last change on this file since eb14b7f was 1cf621b, checked in by Pierre Labastie <pierre@…>, 12 years ago

Take minimal versions from the book host requirements, instead
of hard coding them

  • Property mode set to 100644
File size: 6.6 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 [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
142
143 echo "done"
144
145 # Make the scripts executable.
146 chmod -R +x $JHALFSDIR/${PROGNAME}-commands
147
148 # Create the packages file. We need it for proper Makefile creation
149 create_package_list
150
151 # Done. Moving on...
152 get_sources
153
154}
155
156#----------------------------#
157create_package_list() { #
158#----------------------------#
159
160 # Create the packages file. We need it for proper Makefile creation
161 rm -f pkg_tarball_list
162 echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
163 if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
164 echo -n "... "
165 case ${PROGNAME} in
166 clfs | clfs2 | clfs3 )
167 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
168 $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
169 ;;
170 hlfs)
171 xsltproc --nonet --xinclude \
172 --stringparam model $MODEL \
173 --stringparam kernel $KERNEL \
174 -o pkg_tarball_list packages.xsl \
175 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
176 ;;
177 lfs)
178 xsltproc --nonet --xinclude \
179 --stringparam pkgmngt $PKGMNGT \
180 -o pkg_tarball_list packages.xsl \
181 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
182 ;;
183 esac
184
185 if [[ "${BLFS_TOOL}" = "y" ]] ; then
186(
187cat << EOF
188$LIBXML_PKG
189$LIBXSLT_PKG
190$TIDY_PKG
191$UNZIP_PKG
192$DBXML_PKG
193$DBXSL_PKG
194$LYNX_PKG
195$SUDO_PKG
196$WGET_PKG
197$SQLITE_PKG
198$APR_PKG
199$APR_U_PKG
200$SVN_PKG
201$GPM_PKG
202EOF
203) >> pkg_tarball_list
204 fi
205
206 echo "done"
207
208}
209
Note: See TracBrowser for help on using the repository browser.