1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # $Id$
|
---|
4 |
|
---|
5 | #----------------------------#
|
---|
6 | get_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 | #----------------------------#
|
---|
57 | extract_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 | echo "done"
|
---|
157 |
|
---|
158 | # Make the scripts executable.
|
---|
159 | chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
---|
160 |
|
---|
161 | # Create the packages file. We need it for proper Makefile creation
|
---|
162 | create_package_list
|
---|
163 |
|
---|
164 | # Done. Moving on...
|
---|
165 | get_sources
|
---|
166 |
|
---|
167 | }
|
---|
168 |
|
---|
169 | #----------------------------#
|
---|
170 | create_package_list() { #
|
---|
171 | #----------------------------#
|
---|
172 |
|
---|
173 | # Create the packages file. We need it for proper Makefile creation
|
---|
174 | rm -f pkg_tarball_list
|
---|
175 | echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
|
---|
176 | if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
---|
177 | echo -n "... "
|
---|
178 | case ${PROGNAME} in
|
---|
179 | clfs*)
|
---|
180 | xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
|
---|
181 | $BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
|
---|
182 | ;;
|
---|
183 | hlfs)
|
---|
184 | xsltproc --nonet --xinclude \
|
---|
185 | --stringparam model $MODEL \
|
---|
186 | --stringparam kernel $KERNEL \
|
---|
187 | -o pkg_tarball_list packages.xsl \
|
---|
188 | $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
|
---|
189 | ;;
|
---|
190 | lfs)
|
---|
191 | xsltproc --nonet --xinclude \
|
---|
192 | --stringparam pkgmngt $PKGMNGT \
|
---|
193 | -o pkg_tarball_list packages.xsl \
|
---|
194 | $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
|
---|
195 | ;;
|
---|
196 | *)
|
---|
197 | esac
|
---|
198 |
|
---|
199 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
200 | (
|
---|
201 | cat << EOF
|
---|
202 | $LIBXML_PKG
|
---|
203 | $LIBXSLT_PKG
|
---|
204 | $TIDY_PKG
|
---|
205 | $UNZIP_PKG
|
---|
206 | $DBXML_PKG
|
---|
207 | $DBXSL_PKG
|
---|
208 | $LYNX_PKG
|
---|
209 | $SUDO_PKG
|
---|
210 | $WGET_PKG
|
---|
211 | $SQLITE_PKG
|
---|
212 | $APR_PKG
|
---|
213 | $APR_U_PKG
|
---|
214 | $SVN_PKG
|
---|
215 | $GPM_PKG
|
---|
216 | EOF
|
---|
217 | ) >> pkg_tarball_list
|
---|
218 | fi
|
---|
219 |
|
---|
220 | echo "done"
|
---|
221 |
|
---|
222 | }
|
---|
223 |
|
---|