source: common/libs/func_book_parser@ b7515ec

2.4 ablfs-more legacy new_features trunk
Last change on this file since b7515ec was 3f83cb0, checked in by Pierre Labastie <pierre@…>, 10 years ago

For CLFS 3.0, variable setting is now in final-prep chapter.
Adapt CLFS for that

  • Property mode set to 100644
File size: 7.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*) ;;
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.
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
36 else
37 cd ${PROGNAME}-$LFSVRS
38 case $PROGNAME in
39 clfs*) git pull >>$LOGDIR/$LOG 2>&1
40 if [ ! $TREE == "development" ]; then
41 git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
42 fi
43 ;;
44 lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;;
45 *) ;;
46 esac
47 fi
48 echo -ne "done\n"
49
50 else
51 echo -ne "Using $BOOK as book's sources ...\n"
52 fi
53}
54
55#----------------------------#
56extract_commands() { #
57#----------------------------#
58
59 cd $JHALFSDIR
60 case $PROGNAME in
61 clfs*)
62 VERSION=$(xmllint --noent $BOOK/BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
63 *)
64 VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
65 esac
66
67 # Clean
68 rm -rf ${PROGNAME}-commands
69
70 # Extract the commands
71 echo -n "Extracting commands for"
72 case ${PROGNAME} in
73 clfs)
74 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
75 xsltproc --nonet \
76 --xinclude \
77 --stringparam method $METHOD \
78 --stringparam testsuite $TEST \
79 --stringparam bomb-testsuite $BOMB_TEST \
80 --stringparam vim-lang $VIMLANG \
81 --stringparam timezone $TIMEZONE \
82 --stringparam page $PAGE \
83 --stringparam lang $LANG \
84 --stringparam sparc $SPARC64_PROC \
85 --stringparam x86 $TARGET \
86 --stringparam mips $TARGET \
87 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
88 ;;
89
90 clfs2)
91 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
92 xsltproc --nonet \
93 --xinclude \
94 --stringparam vim-lang $VIMLANG \
95 --stringparam timezone $TIMEZONE \
96 --stringparam page $PAGE \
97 --stringparam lang $LANG \
98 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
99 ;;
100
101 clfs3)
102 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
103 xsltproc --nonet \
104 --xinclude \
105 --stringparam endian x$ENDIAN \
106 --stringparam timezone $TIMEZONE \
107 --stringparam page $PAGE \
108 --stringparam lang $LANG \
109 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
110 ;;
111
112 hlfs)
113 echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
114 xsltproc --nonet \
115 --xinclude \
116 --stringparam model $MODEL \
117 --stringparam kernel $KERNEL \
118 --stringparam testsuite $TEST \
119 --stringparam bomb-testsuite $BOMB_TEST \
120 --stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
121 --stringparam timezone $TIMEZONE \
122 --stringparam page $PAGE \
123 --stringparam lang $LANG \
124 --stringparam grsecurity_host $GRSECURITY_HOST \
125 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
126 ;;
127 lfs)
128 echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
129 pushd $BOOK > /dev/null
130 if [ -f process-scripts.sh ]; then
131 bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
132 fi
133 popd > /dev/null
134 xsltproc --nonet \
135 --xinclude \
136 --stringparam testsuite $TEST \
137 --stringparam bomb-testsuite $BOMB_TEST \
138 --stringparam vim-lang $VIMLANG \
139 --stringparam full-locale $FULL_LOCALE \
140 --stringparam timezone $TIMEZONE \
141 --stringparam page $PAGE \
142 --stringparam lang $LANG \
143 --stringparam pkgmngt $PKGMNGT \
144 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
145 ;;
146 *) echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... "
147 exit 1 ;;
148 esac
149
150 echo "done"
151
152 # Make the scripts executable.
153 chmod -R +x $JHALFSDIR/${PROGNAME}-commands
154
155 # Create the packages file. We need it for proper Makefile creation
156 create_package_list
157 create_chroot_scripts
158
159 # Done. Moving on...
160 get_sources
161
162}
163
164#----------------------------#
165create_package_list() { #
166#----------------------------#
167
168 # Create the packages file. We need it for proper Makefile creation
169 rm -f pkg_tarball_list
170 echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
171 if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
172 echo -n "... "
173 case ${PROGNAME} in
174 clfs*)
175 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
176 $BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
177 ;;
178 hlfs)
179 xsltproc --nonet --xinclude \
180 --stringparam model $MODEL \
181 --stringparam kernel $KERNEL \
182 -o pkg_tarball_list packages.xsl \
183 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
184 ;;
185 lfs)
186 xsltproc --nonet --xinclude \
187 --stringparam pkgmngt $PKGMNGT \
188 -o pkg_tarball_list packages.xsl \
189 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
190 ;;
191 *)
192 esac
193
194 echo "done"
195
196}
197
198#----------------------------#
199create_chroot_scripts() { #
200#----------------------------#
201
202 rm -rf chroot_scripts
203 echo -n "Creating chroot commands scripts from $BOOK"
204 if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
205 echo -n "... "
206 case ${PROGNAME} in
207 clfs*)
208 xsltproc --nonet --xinclude \
209 -o chroot-scripts/ chroot.xsl \
210 $BOOK/BOOK/${ARCH}-index.xml >> $LOGDIR/$LOG 2>&1
211 ;;
212 hlfs)
213 xsltproc --nonet --xinclude \
214 -o chroot-scripts/ chroot.xsl \
215 $BOOK/index.xml >> $LOGDIR/$LOG 2>&1
216 ;;
217 lfs)
218 xsltproc --nonet --xinclude \
219 -o chroot-scripts/ chroot.xsl \
220 $BOOK/chapter06/chapter06.xml >> $LOGDIR/$LOG 2>&1
221 ;;
222 *)
223 esac
224 echo "done"
225
226}
Note: See TracBrowser for help on using the repository browser.