source: common/libs/func_book_parser@ 3cb4ef5b

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

Fix a bad fix

  • Property mode set to 100644
File size: 7.2 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 *) 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 # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
60 test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
61 exit 1"
62
63 cd $JHALFSDIR
64 case $PROGNAME in
65 clfs*)
66 VERSION=$(xmllint --noent $BOOK/BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
67 *)
68 VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
69 esac
70
71 # Start clean
72 if [ -d ${PROGNAME}-commands ]; then
73 rm -rf ${PROGNAME}-commands
74 mkdir -v ${PROGNAME}-commands
75 fi
76 echo -n "Extracting commands for"
77
78 # Dump the commands in shell script form from the HLFS book.
79 case ${PROGNAME} in
80 clfs)
81 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
82 xsltproc --nonet \
83 --xinclude \
84 --stringparam method $METHOD \
85 --stringparam testsuite $TEST \
86 --stringparam bomb-testsuite $BOMB_TEST \
87 --stringparam vim-lang $VIMLANG \
88 --stringparam timezone $TIMEZONE \
89 --stringparam page $PAGE \
90 --stringparam lang $LANG \
91 --stringparam sparc $SPARC64_PROC \
92 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
93 ;;
94
95 clfs2)
96 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
97 xsltproc --nonet \
98 --xinclude \
99 --stringparam vim-lang $VIMLANG \
100 --stringparam timezone $TIMEZONE \
101 --stringparam page $PAGE \
102 --stringparam lang $LANG \
103 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
104 ;;
105
106 clfs3)
107 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
108 xsltproc --nonet \
109 --xinclude \
110 --stringparam endian x$ENDIAN \
111 --stringparam timezone $TIMEZONE \
112 --stringparam page $PAGE \
113 --stringparam lang $LANG \
114 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
115 ;;
116
117 hlfs)
118 echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
119 xsltproc --nonet \
120 --xinclude \
121 --stringparam model $MODEL \
122 --stringparam kernel $KERNEL \
123 --stringparam testsuite $TEST \
124 --stringparam bomb-testsuite $BOMB_TEST \
125 --stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
126 --stringparam timezone $TIMEZONE \
127 --stringparam page $PAGE \
128 --stringparam lang $LANG \
129 --stringparam grsecurity_host $GRSECURITY_HOST \
130 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
131 ;;
132 lfs)
133 echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
134 pushd $BOOK > /dev/null
135 if [ -f process-scripts.sh ]; then
136 bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
137 fi
138 popd > /dev/null
139 xsltproc --nonet \
140 --xinclude \
141 --stringparam testsuite $TEST \
142 --stringparam bomb-testsuite $BOMB_TEST \
143 --stringparam vim-lang $VIMLANG \
144 --stringparam full-locale $FULL_LOCALE \
145 --stringparam timezone $TIMEZONE \
146 --stringparam page $PAGE \
147 --stringparam lang $LANG \
148 --stringparam pkgmngt $PKGMNGT \
149 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
150 ;;
151 *) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
152 exit 1 ;;
153 esac
154
155 [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
156
157 echo "done"
158
159 # Make the scripts executable.
160 chmod -R +x $JHALFSDIR/${PROGNAME}-commands
161
162 # Create the packages file. We need it for proper Makefile creation
163 create_package_list
164
165 # Done. Moving on...
166 get_sources
167
168}
169
170#----------------------------#
171create_package_list() { #
172#----------------------------#
173
174 # Create the packages file. We need it for proper Makefile creation
175 rm -f pkg_tarball_list
176 echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
177 if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
178 echo -n "... "
179 case ${PROGNAME} in
180 clfs*)
181 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
182 $BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
183 ;;
184 hlfs)
185 xsltproc --nonet --xinclude \
186 --stringparam model $MODEL \
187 --stringparam kernel $KERNEL \
188 -o pkg_tarball_list packages.xsl \
189 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
190 ;;
191 lfs)
192 xsltproc --nonet --xinclude \
193 --stringparam pkgmngt $PKGMNGT \
194 -o pkg_tarball_list packages.xsl \
195 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
196 ;;
197 *)
198 esac
199
200 if [[ "${BLFS_TOOL}" = "y" ]] ; then
201(
202cat << EOF
203$LIBXML_PKG
204$LIBXSLT_PKG
205$TIDY_PKG
206$UNZIP_PKG
207$DBXML_PKG
208$DBXSL_PKG
209$LYNX_PKG
210$SUDO_PKG
211$WGET_PKG
212$SQLITE_PKG
213$APR_PKG
214$APR_U_PKG
215$SVN_PKG
216$GPM_PKG
217EOF
218) >> pkg_tarball_list
219 fi
220
221 echo "done"
222
223}
224
Note: See TracBrowser for help on using the repository browser.