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
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"
[7ce6de2]34 git checkout -b ${TREE} ${TREE} >>$LOGDIR/$LOG 2>&1
[92b7cb8]35 fi
[1cf621b]36 else
37 cd ${PROGNAME}-$LFSVRS
[92b7cb8]38 case $PROGNAME in
[7ce6de2]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 ;;
[92b7cb8]45 lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;;
46 *) ;;
47 esac
[fe30c61]48 fi
[1cf621b]49 echo -ne "done\n"
[fe30c61]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
[92b7cb8]66 clfs*)
[a1dd968]67 VERSION=$(xmllint --noent $BOOK/BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
[fe30c61]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)
[b11c10b]82 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
[fe30c61]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 \
[650acce]92 --stringparam sparc $SPARC64_PROC \
[92b7cb8]93 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
[fe30c61]94 ;;
95
96 clfs2)
[b11c10b]97 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
[fe30c61]98 xsltproc --nonet \
99 --xinclude \
100 --stringparam vim-lang $VIMLANG \
101 --stringparam timezone $TIMEZONE \
102 --stringparam page $PAGE \
103 --stringparam lang $LANG \
[92b7cb8]104 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
[fe30c61]105 ;;
106
107 clfs3)
[b11c10b]108 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
[fe30c61]109 xsltproc --nonet \
110 --xinclude \
[9436828]111 --stringparam endian x$ENDIAN \
[fe30c61]112 --stringparam timezone $TIMEZONE \
113 --stringparam page $PAGE \
114 --stringparam lang $LANG \
[92b7cb8]115 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
[fe30c61]116 ;;
117
118 hlfs)
[139c34e]119 echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
[fe30c61]120 xsltproc --nonet \
121 --xinclude \
122 --stringparam model $MODEL \
[5c575e1]123 --stringparam kernel $KERNEL \
[fe30c61]124 --stringparam testsuite $TEST \
125 --stringparam bomb-testsuite $BOMB_TEST \
[31eb678]126 --stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
[fe30c61]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)
[b11c10b]134 echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
[f21dff8]135 pushd $BOOK > /dev/null
[66c09d0]136 if [ -f process-scripts.sh ]; then
[f0a31de]137 bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
138 fi
[f21dff8]139 popd > /dev/null
[fe30c61]140 xsltproc --nonet \
141 --xinclude \
142 --stringparam testsuite $TEST \
143 --stringparam bomb-testsuite $BOMB_TEST \
144 --stringparam vim-lang $VIMLANG \
[b339c94]145 --stringparam full-locale $FULL_LOCALE \
[fe30c61]146 --stringparam timezone $TIMEZONE \
147 --stringparam page $PAGE \
148 --stringparam lang $LANG \
[7072e1f]149 --stringparam pkgmngt $PKGMNGT \
[fe30c61]150 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
151 ;;
[b11c10b]152 *) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
[fe30c61]153 exit 1 ;;
154 esac
155
156 [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
157
[b11c10b]158 echo "done"
[fe30c61]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
[b11c10b]177 echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
178 if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
179 echo -n "... "
[fe30c61]180 case ${PROGNAME} in
[92b7cb8]181 clfs*)
[fe30c61]182 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
[92b7cb8]183 $BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
[fe30c61]184 ;;
185 hlfs)
[6d48bb7]186 xsltproc --nonet --xinclude \
[139c34e]187 --stringparam model $MODEL \
188 --stringparam kernel $KERNEL \
189 -o pkg_tarball_list packages.xsl \
[fe30c61]190 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
191 ;;
192 lfs)
[7072e1f]193 xsltproc --nonet --xinclude \
194 --stringparam pkgmngt $PKGMNGT \
195 -o pkg_tarball_list packages.xsl \
[fe30c61]196 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
197 ;;
[92b7cb8]198 *)
[fe30c61]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
[d09e32a]210$LYNX_PKG
[fe30c61]211$SUDO_PKG
212$WGET_PKG
[7072e1f]213$SQLITE_PKG
214$APR_PKG
215$APR_U_PKG
[fe30c61]216$SVN_PKG
217$GPM_PKG
218EOF
219) >> pkg_tarball_list
220 fi
221
[b11c10b]222 echo "done"
[fe30c61]223
224}
225
Note: See TracBrowser for help on using the repository browser.