source: common/libs/func_book_parser@ 34d1b6a

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

Fix updating a git working copy when the head is detached

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