source: common/libs/func_book_parser@ 84a651c

ablfs
Last change on this file since 84a651c was f33756b, checked in by Pierre Labastie <pierre@…>, 11 years ago

merge trunk r3730:3732

  • Property mode set to 100644
File size: 7.2 KB
RevLine 
[fe30c61]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" ;;
[27c5769]19 clfs*) svn_root="cross-lfs" ;;
[fe30c61]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.
[27c5769]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"
[f33756b]34 git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
[27c5769]35 fi
[1825286]36 else
37 cd ${PROGNAME}-$LFSVRS
[27c5769]38 case $PROGNAME in
[f33756b]39 clfs*) git pull >>$LOGDIR/$LOG 2>&1
[d928c71]40 if [ ! $TREE == "development" ]; then
41 git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
42 fi
43 ;;
[27c5769]44 lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;;
45 *) ;;
46 esac
[fe30c61]47 fi
[1825286]48 echo -ne "done\n"
[fe30c61]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
[27c5769]65 clfs*)
[df08148]66 VERSION=$(xmllint --noent $BOOK/BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
[fe30c61]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)
[b11c10b]81 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
[fe30c61]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 \
[650acce]91 --stringparam sparc $SPARC64_PROC \
[27c5769]92 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
[fe30c61]93 ;;
94
95 clfs2)
[b11c10b]96 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
[fe30c61]97 xsltproc --nonet \
98 --xinclude \
99 --stringparam vim-lang $VIMLANG \
100 --stringparam timezone $TIMEZONE \
101 --stringparam page $PAGE \
102 --stringparam lang $LANG \
[27c5769]103 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
[fe30c61]104 ;;
105
106 clfs3)
[b11c10b]107 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
[fe30c61]108 xsltproc --nonet \
109 --xinclude \
[9436828]110 --stringparam endian x$ENDIAN \
[fe30c61]111 --stringparam timezone $TIMEZONE \
112 --stringparam page $PAGE \
113 --stringparam lang $LANG \
[27c5769]114 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
[fe30c61]115 ;;
116
117 hlfs)
[139c34e]118 echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
[fe30c61]119 xsltproc --nonet \
120 --xinclude \
121 --stringparam model $MODEL \
[5c575e1]122 --stringparam kernel $KERNEL \
[fe30c61]123 --stringparam testsuite $TEST \
124 --stringparam bomb-testsuite $BOMB_TEST \
[31eb678]125 --stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
[fe30c61]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)
[b11c10b]133 echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
[f21dff8]134 pushd $BOOK > /dev/null
[96857f8]135 if [ -f process-scripts.sh ]; then
[76f8888]136 bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
137 fi
[f21dff8]138 popd > /dev/null
[fe30c61]139 xsltproc --nonet \
140 --xinclude \
141 --stringparam testsuite $TEST \
142 --stringparam bomb-testsuite $BOMB_TEST \
143 --stringparam vim-lang $VIMLANG \
[b339c94]144 --stringparam full-locale $FULL_LOCALE \
[fe30c61]145 --stringparam timezone $TIMEZONE \
146 --stringparam page $PAGE \
147 --stringparam lang $LANG \
[7072e1f]148 --stringparam pkgmngt $PKGMNGT \
[fe30c61]149 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
150 ;;
[b11c10b]151 *) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
[fe30c61]152 exit 1 ;;
153 esac
154
[b11c10b]155 echo "done"
[fe30c61]156
157 # Make the scripts executable.
158 chmod -R +x $JHALFSDIR/${PROGNAME}-commands
159
160 # Create the packages file. We need it for proper Makefile creation
161 create_package_list
162
163 # Done. Moving on...
164 get_sources
165
166}
167
168#----------------------------#
169create_package_list() { #
170#----------------------------#
171
172 # Create the packages file. We need it for proper Makefile creation
173 rm -f pkg_tarball_list
[b11c10b]174 echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
175 if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
176 echo -n "... "
[fe30c61]177 case ${PROGNAME} in
[27c5769]178 clfs*)
[fe30c61]179 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
[27c5769]180 $BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
[fe30c61]181 ;;
182 hlfs)
[6d48bb7]183 xsltproc --nonet --xinclude \
[139c34e]184 --stringparam model $MODEL \
185 --stringparam kernel $KERNEL \
186 -o pkg_tarball_list packages.xsl \
[fe30c61]187 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
188 ;;
189 lfs)
[7072e1f]190 xsltproc --nonet --xinclude \
191 --stringparam pkgmngt $PKGMNGT \
192 -o pkg_tarball_list packages.xsl \
[fe30c61]193 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
194 ;;
[27c5769]195 *)
[fe30c61]196 esac
197
198 if [[ "${BLFS_TOOL}" = "y" ]] ; then
199(
200cat << EOF
201$LIBXML_PKG
202$LIBXSLT_PKG
203$TIDY_PKG
204$UNZIP_PKG
205$DBXML_PKG
206$DBXSL_PKG
[d09e32a]207$LYNX_PKG
[fe30c61]208$SUDO_PKG
209$WGET_PKG
[7072e1f]210$SQLITE_PKG
211$APR_PKG
212$APR_U_PKG
[fe30c61]213$SVN_PKG
214$GPM_PKG
215EOF
216) >> pkg_tarball_list
217 fi
218
[b11c10b]219 echo "done"
[fe30c61]220
221}
222
Note: See TracBrowser for help on using the repository browser.