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
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" ;;
[92b7cb8]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.
[92b7cb8]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"
[ad4ff97]34 git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
[92b7cb8]35 fi
[1cf621b]36 else
37 cd ${PROGNAME}-$LFSVRS
[92b7cb8]38 case $PROGNAME in
[ad4ff97]39 clfs*) git pull >>$LOGDIR/$LOG 2>&1
[7ce6de2]40 if [ ! $TREE == "development" ]; then
41 git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
42 fi
43 ;;
[92b7cb8]44 lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;;
45 *) ;;
46 esac
[fe30c61]47 fi
[1cf621b]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
[92b7cb8]65 clfs*)
[a1dd968]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 \
[92b7cb8]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 \
[92b7cb8]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 \
[92b7cb8]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
[66c09d0]135 if [ -f process-scripts.sh ]; then
[f0a31de]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
155 [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
156
[b11c10b]157 echo "done"
[fe30c61]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
[b11c10b]176 echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
177 if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
178 echo -n "... "
[fe30c61]179 case ${PROGNAME} in
[92b7cb8]180 clfs*)
[fe30c61]181 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
[92b7cb8]182 $BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
[fe30c61]183 ;;
184 hlfs)
[6d48bb7]185 xsltproc --nonet --xinclude \
[139c34e]186 --stringparam model $MODEL \
187 --stringparam kernel $KERNEL \
188 -o pkg_tarball_list packages.xsl \
[fe30c61]189 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
190 ;;
191 lfs)
[7072e1f]192 xsltproc --nonet --xinclude \
193 --stringparam pkgmngt $PKGMNGT \
194 -o pkg_tarball_list packages.xsl \
[fe30c61]195 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
196 ;;
[92b7cb8]197 *)
[fe30c61]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
[d09e32a]209$LYNX_PKG
[fe30c61]210$SUDO_PKG
211$WGET_PKG
[7072e1f]212$SQLITE_PKG
213$APR_PKG
214$APR_U_PKG
[fe30c61]215$SVN_PKG
216$GPM_PKG
217EOF
218) >> pkg_tarball_list
219 fi
220
[b11c10b]221 echo "done"
[fe30c61]222
223}
224
Note: See TracBrowser for help on using the repository browser.