1 | #!/bin/sh
|
---|
2 |
|
---|
3 | #
|
---|
4 | # Load the configuration file
|
---|
5 | #
|
---|
6 | source jhalfs.conf
|
---|
7 |
|
---|
8 |
|
---|
9 | version="
|
---|
10 | jhalfs 0.2-pre1 \$Date$
|
---|
11 |
|
---|
12 | Written by Jeremy Huntwork and Manuel Canales Esparcia.
|
---|
13 |
|
---|
14 | This program is published under the \
|
---|
15 | Gnu General Public License, Version 2.
|
---|
16 | "
|
---|
17 |
|
---|
18 | usage="\
|
---|
19 | Usage: $0 [OPTION]
|
---|
20 |
|
---|
21 | Options:
|
---|
22 | -h, --help print this help, then exit
|
---|
23 |
|
---|
24 | -V, --version print version number, then exit
|
---|
25 |
|
---|
26 | -d --directory DIR use DIR directory for building LFS; all files
|
---|
27 | jhalfs produces will be in the directory
|
---|
28 | DIR/jhalfs. Default is \"/mnt/lfs\".
|
---|
29 |
|
---|
30 | -P, --get-packages download the packages and patches. This
|
---|
31 | assumes that the server declared in the
|
---|
32 | jhalfs.conf file has the proper packages
|
---|
33 | and patches for the book version being
|
---|
34 | processed.
|
---|
35 |
|
---|
36 | -D, --download-client CLIENT use CLIENT as the program for retrieving
|
---|
37 | packages (for use in conjunction with -P)
|
---|
38 |
|
---|
39 | -W, --working-copy DIR use the local working copy placed in DIR
|
---|
40 | as the LFS book
|
---|
41 |
|
---|
42 | -L, --LFS-version VER checkout VER version of the LFS book.
|
---|
43 | Supported versions at this time are:
|
---|
44 |
|
---|
45 | dev* | trunk | SVN aliases for Development LFS
|
---|
46 | testing | 6.1.1 aliases for the testing 6.1.1 branch
|
---|
47 |
|
---|
48 | -T, --testsuites add support to run the optional testsuites
|
---|
49 |
|
---|
50 | --no-toolchain-test don't run the toolchain testsuites. This
|
---|
51 | also disables the build of TCL, Expect
|
---|
52 | and DejaGNU
|
---|
53 |
|
---|
54 | --timezone TIMEZONE set TIMEZONE as the local timezone. If not
|
---|
55 | specified, \"Europe/London\" will be used.
|
---|
56 |
|
---|
57 | --page_size PAGE set PAGE as the default page size (letter
|
---|
58 | or A4). This setting is required to
|
---|
59 | build Groff. If not specified, \"letter\"
|
---|
60 | will be used.
|
---|
61 |
|
---|
62 | --fstab FILE use FILE as the /etc/fstab file for the
|
---|
63 | LFS system. If not specified, a default
|
---|
64 | /etc/fstab file with dummy values is
|
---|
65 | created.
|
---|
66 |
|
---|
67 | --no-vim-lang don't install the optional vim-lang package
|
---|
68 |
|
---|
69 | -C, --kernel-config FILE use the kernel configuration file specified
|
---|
70 | in FILE to build the kernel. If the file is
|
---|
71 | not found, or if not specified, the kernel
|
---|
72 | build is skipped.
|
---|
73 |
|
---|
74 | -M, --run-make run make on the generated Makefile
|
---|
75 |
|
---|
76 | "
|
---|
77 |
|
---|
78 | help="\
|
---|
79 | Try '$0 --help' for more information."
|
---|
80 |
|
---|
81 | exit_missing_arg="\
|
---|
82 | echo \"Option '\$1' requires an argument\" >&2
|
---|
83 | echo \"\$help\" >&2
|
---|
84 | exit 1"
|
---|
85 |
|
---|
86 | no_dl_client="\
|
---|
87 | echo \"Could not find a way to download the LFS sources.\" >&2
|
---|
88 | echo \"Attempting to continue.\" >&2"
|
---|
89 |
|
---|
90 |
|
---|
91 | HEADER="# This file is automatically generated by jhalfs
|
---|
92 | # DO NOT EDIT THIS FILE MANUALLY
|
---|
93 | #
|
---|
94 | # Generated on `date \"+%F %X %Z\"`"
|
---|
95 |
|
---|
96 |
|
---|
97 | ###################################
|
---|
98 | ### FUNCTIONS ###
|
---|
99 | ###################################
|
---|
100 |
|
---|
101 |
|
---|
102 | #----------------------------#
|
---|
103 | get_book() {
|
---|
104 | #----------------------------#
|
---|
105 | # Check for Subversion instead of just letting the script hit 'svn' and fail.
|
---|
106 | test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
---|
107 | exit 1"
|
---|
108 | cd $JHALFSDIR
|
---|
109 |
|
---|
110 | if [ -z $WC ] ; then
|
---|
111 | echo -n "Downloading the LFS Book, version $LFSVRS... "
|
---|
112 |
|
---|
113 | # Grab the LFS book fresh if it's missing, otherwise, update it from the
|
---|
114 | # repo. If we've already extracted the commands, move on to getting the
|
---|
115 | # sources.
|
---|
116 | if [ -d lfs-$LFSVRS ] ; then
|
---|
117 | cd lfs-$LFSVRS
|
---|
118 | if svn up | grep -q At && test -d $JHALFSDIR/commands && \
|
---|
119 | test -f $JHALFSDIR/packages && test -f $JHALFSDIR/patches ; then
|
---|
120 | echo -ne "done\n"
|
---|
121 | get_sources
|
---|
122 | else
|
---|
123 | echo -ne "done\n"
|
---|
124 | extract_commands
|
---|
125 | fi
|
---|
126 | else
|
---|
127 | if [ $LFSVRS = development ] ; then
|
---|
128 | svn co $SVN/LFS/trunk/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
---|
129 | else
|
---|
130 | svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
---|
131 | fi
|
---|
132 | echo -ne "done\n"
|
---|
133 | extract_commands
|
---|
134 | fi
|
---|
135 | else
|
---|
136 | echo -ne "Using $BOOK as book's sources ...\n"
|
---|
137 | extract_commands
|
---|
138 | fi
|
---|
139 | # Set the canonical book version
|
---|
140 | cd $JHALFSDIR
|
---|
141 | VERSION=`grep "ENTITY version " $BOOK/general.ent | sed -e 's@<!ENTITY version "@@' -e 's@">@@'`
|
---|
142 | }
|
---|
143 |
|
---|
144 | #----------------------------#
|
---|
145 | extract_commands() {
|
---|
146 | #----------------------------#
|
---|
147 | # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
---|
148 | test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
---|
149 | exit 1"
|
---|
150 | cd $JHALFSDIR
|
---|
151 |
|
---|
152 | # Start clean
|
---|
153 | if [ -d commands ] ; then rm -rf commands ; fi && mkdir commands
|
---|
154 | echo -n "Extracting commands... "
|
---|
155 |
|
---|
156 | # Dump the commands in shell script form from the LFS book.
|
---|
157 | xsltproc --nonet --xinclude --stringparam testsuite $TEST \
|
---|
158 | --stringparam toolchaintest $TOOLCHAINTEST --stringparam vim-lang $VIMLANG \
|
---|
159 | -o ./commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
160 |
|
---|
161 | # Make the scripts executable.
|
---|
162 | chmod -R +x $JHALFSDIR/commands
|
---|
163 |
|
---|
164 | # Grab the patches and package names.
|
---|
165 | cd $JHALFSDIR
|
---|
166 | for i in patches packages ; do rm -f $i ; done
|
---|
167 | grep "\-version" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@' \
|
---|
168 | -e '/generic/d' >> packages
|
---|
169 | echo `grep "glibc" packages | sed 's@glibc@&-linuxthreads@'` >> packages
|
---|
170 | # Download the vim-lang package if it must be installed
|
---|
171 | if [ "$VIMLANG" = "1" ] ; then
|
---|
172 | echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages
|
---|
173 | fi
|
---|
174 | echo `grep "udev-config-file" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@'` >> packages
|
---|
175 | # Download the module-init-tools-testsuite package only
|
---|
176 | # if the test suite will be run.
|
---|
177 | if [ "$TEST" = "1" ] ; then
|
---|
178 | echo `grep "module" packages | sed 's@tools@&-testsuite@'` >> packages
|
---|
179 | fi
|
---|
180 | # If we are buildind the UTF-8 branch, the glibc-libidn package is required
|
---|
181 | if grep -q "man-db-version" $BOOK/general.ent ; then
|
---|
182 | echo `grep "glibc" packages | sed 's@glibc@glibc-libidn@'` >> packages
|
---|
183 | fi
|
---|
184 | grep "ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
|
---|
185 |
|
---|
186 | # Done. Moving on...
|
---|
187 | echo -ne "done\n"
|
---|
188 | get_sources
|
---|
189 | }
|
---|
190 |
|
---|
191 | #----------------------------#
|
---|
192 | download() {
|
---|
193 | #----------------------------#
|
---|
194 | cd $BUILDDIR/sources
|
---|
195 |
|
---|
196 | # Hackish fix for the bash-doc, glibc-{linuxthreads,libidn} and
|
---|
197 | # module-init-tools-testsuite packages that doesn't conform to
|
---|
198 | # norms in the URL scheme.
|
---|
199 | DIR=`echo $1 | sed 's@-doc@@;s@-linuxthreads@@;s@-libidn@@;s@-testsuite@@'`
|
---|
200 |
|
---|
201 | # Find the md5 sum for this package.
|
---|
202 | if [ $2 != MD5SUMS ] ; then MD5=`grep " $2" MD5SUMS` ; fi
|
---|
203 |
|
---|
204 | if [ ! -f $2 ] ; then
|
---|
205 | case $DL in
|
---|
206 | wget )
|
---|
207 | wget $HTTP/$DIR/$2
|
---|
208 | ;;
|
---|
209 | curl )
|
---|
210 | `curl -# $HTTP/$DIR/$2 -o $2`
|
---|
211 | ;;
|
---|
212 | * )
|
---|
213 | echo "$DL not supported at this time."
|
---|
214 | ;;
|
---|
215 | esac
|
---|
216 | elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
|
---|
217 | case $DL in
|
---|
218 | wget )
|
---|
219 | wget -c $HTTP/$DIR/$2
|
---|
220 | ;;
|
---|
221 | curl )
|
---|
222 | `curl -# -C - $HTTP/$DIR/$2 -o $2`
|
---|
223 | ;;
|
---|
224 | * )
|
---|
225 | echo "$DL not supported at this time."
|
---|
226 | ;;
|
---|
227 | esac
|
---|
228 | fi
|
---|
229 | if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then
|
---|
230 | exit 1
|
---|
231 | fi
|
---|
232 | }
|
---|
233 |
|
---|
234 | #----------------------------#
|
---|
235 | get_sources() {
|
---|
236 | #----------------------------#
|
---|
237 |
|
---|
238 | # Test if the packages must be downloaded
|
---|
239 | if [ "$HPKG" = "1" ] ; then
|
---|
240 |
|
---|
241 | # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
|
---|
242 | # separates each iteration by lines. It is necessary to have the second
|
---|
243 | # ' on the next line.
|
---|
244 | IFS='
|
---|
245 | '
|
---|
246 |
|
---|
247 | if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
|
---|
248 | cd $BUILDDIR/sources
|
---|
249 | if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
|
---|
250 |
|
---|
251 | download "" MD5SUMS
|
---|
252 |
|
---|
253 | # Iterate through each package and grab it, along with any patches it needs.
|
---|
254 | for i in `cat $JHALFSDIR/packages` ; do
|
---|
255 | PKG=`echo $i | sed -e 's/-version.*//' -e 's/-file.*//'`
|
---|
256 | # Needed for Groff patchlevel patch on UTF-8 branch
|
---|
257 | GROFFLEVEL=`grep "groff-patchlevel" $JHALFSDIR/packages | sed -e 's/groff-patchlevel //' -e 's/"//g'`
|
---|
258 |
|
---|
259 | # There is some entities that aren't valid package entities.
|
---|
260 | if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" -o "$PKG" = "groff-patchlevel" ] ; then continue ; fi
|
---|
261 |
|
---|
262 | VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
|
---|
263 | if [ "$PKG" = "tcl" ] ; then
|
---|
264 | FILE="$PKG$VRS-src.tar.bz2"
|
---|
265 | elif [ "$PKG" = "vim-lang" ] ; then
|
---|
266 | PKG="vim"
|
---|
267 | FILE="vim-$VRS-lang.tar.bz2"
|
---|
268 | elif [ "$PKG" = "udev-config" ] ; then
|
---|
269 | PKG="udev"
|
---|
270 | FILE="$VRS"
|
---|
271 | else
|
---|
272 | FILE="$PKG-$VRS.tar.bz2"
|
---|
273 | fi
|
---|
274 | download $PKG $FILE
|
---|
275 | for patch in `grep "$PKG-&$PKG" $JHALFSDIR/patches` ; do
|
---|
276 | PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
|
---|
277 | download $PKG $PATCH
|
---|
278 | done
|
---|
279 | # Needed for Groff patchlevel patch on UTF-8 branch
|
---|
280 | for patch in `grep "patchlevel" $JHALFSDIR/patches` ; do
|
---|
281 | PATCH=`echo $patch | sed 's@&'$PKG'-version;-&'$PKG'-patchlevel;@'$VRS'-'$GROFFLEVEL'@'`
|
---|
282 | download $PKG $PATCH
|
---|
283 | done
|
---|
284 | done
|
---|
285 | fi
|
---|
286 | }
|
---|
287 |
|
---|
288 | #-----------------------------------------------#
|
---|
289 | _IS_() # Function to test build scripts names
|
---|
290 | #-----------------------------------------------#
|
---|
291 | {
|
---|
292 | # Returns substr $2 or null str
|
---|
293 | # Must use string testing
|
---|
294 | case $1 in
|
---|
295 | *$2*) echo "$2" ;;
|
---|
296 | *) echo "" ;;
|
---|
297 | esac
|
---|
298 | }
|
---|
299 |
|
---|
300 | #----------------------------#
|
---|
301 | chapter4_Makefiles() {
|
---|
302 | #----------------------------#
|
---|
303 | (
|
---|
304 | cat << EOF
|
---|
305 | 020-creatingtoolsdir:
|
---|
306 | @\$(call echo_message, Building)
|
---|
307 | @mkdir -v \$(LFS)/tools && \\
|
---|
308 | ln -sv \$(LFS)/tools / && \\
|
---|
309 | touch \$@
|
---|
310 |
|
---|
311 | 021-addinguser: 020-creatingtoolsdir
|
---|
312 | @\$(call echo_message, Building)
|
---|
313 | @groupadd lfs && \\
|
---|
314 | useradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\
|
---|
315 | chown lfs \$(LFS)/tools && \\
|
---|
316 | chown lfs \$(LFS)/sources && \\
|
---|
317 | touch \$@
|
---|
318 |
|
---|
319 | 022-settingenvironment: 021-addinguser
|
---|
320 | @\$(call echo_message, Building)
|
---|
321 | @echo "set +h" > /home/lfs/.bashrc && \\
|
---|
322 | echo "umask 022" >> /home/lfs/.bashrc && \\
|
---|
323 | echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\
|
---|
324 | echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
---|
325 | echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
---|
326 | echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
---|
327 | echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
|
---|
328 | chown lfs:lfs /home/lfs/.bashrc && \\
|
---|
329 | touch envars && \\
|
---|
330 | touch \$@
|
---|
331 | EOF
|
---|
332 | ) >> $MKFILE.tmp
|
---|
333 | }
|
---|
334 |
|
---|
335 | #----------------------------#
|
---|
336 | chapter5_Makefiles() {
|
---|
337 | #----------------------------#
|
---|
338 | for file in chapter05/* ; do
|
---|
339 | # Keep the script file name
|
---|
340 | i=`basename $file`
|
---|
341 |
|
---|
342 | # If no testsuites will be run, then TCL, Expect and DejaGNU isn't needed
|
---|
343 | if [ "$TOOLCHAINTEST" = "0" ]; then
|
---|
344 | if [[ `_IS_ $i tcl` ]] || [[ `_IS_ $i expect` ]] || [[ `_IS_ $i dejagnu` ]] ; then
|
---|
345 | continue
|
---|
346 | fi
|
---|
347 | fi
|
---|
348 |
|
---|
349 | # First append each name of the script files to a list (this will become
|
---|
350 | # the names of the targets in the Makefile
|
---|
351 | chapter5="$chapter5 $i"
|
---|
352 |
|
---|
353 | # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
|
---|
354 | # and binutils in chapter 5)
|
---|
355 | name=`echo $i | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
|
---|
356 |
|
---|
357 | # Set the dependency for the first target.
|
---|
358 | if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
|
---|
359 |
|
---|
360 | # Drop in the name of the target on a new line, and the previous target
|
---|
361 | # as a dependency. Also call the echo_message function.
|
---|
362 | (
|
---|
363 | cat << EOF
|
---|
364 |
|
---|
365 | $i: $PREV
|
---|
366 | @\$(call echo_message, Building)
|
---|
367 | EOF
|
---|
368 | ) >> $MKFILE.tmp
|
---|
369 |
|
---|
370 | # Find the version of the command files, if it corresponds with the building of
|
---|
371 | # a specific package
|
---|
372 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
373 |
|
---|
374 | # If $vrs isn't empty, we've got a package...
|
---|
375 | if [ "$vrs" != "" ] ; then
|
---|
376 | if [ "$name" = "tcl" ] ; then
|
---|
377 | FILE="$name$vrs-src.tar"
|
---|
378 | else
|
---|
379 | FILE="$name-$vrs.tar"
|
---|
380 | fi
|
---|
381 |
|
---|
382 | # Insert instructions for unpacking the package and to set
|
---|
383 | # the PKGDIR variable.
|
---|
384 | (
|
---|
385 | cat << EOF
|
---|
386 | @\$(call unpack,$FILE)
|
---|
387 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
388 | chown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
389 | echo "PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT" > envars && \\
|
---|
390 | echo "export PKGDIR" >> envars && \\
|
---|
391 | EOF
|
---|
392 | ) >> $MKFILE.tmp
|
---|
393 |
|
---|
394 | fi
|
---|
395 |
|
---|
396 | # Dump the path to the Binutils or TCL sources directory.
|
---|
397 | if [[ `_IS_ $i binutils` ]] || [[ `_IS_ $i tcl` ]] ; then
|
---|
398 | (
|
---|
399 | cat << EOF
|
---|
400 | echo "\$(LFS)\$(SRC)/\$\$ROOT" > sources-dir
|
---|
401 | EOF
|
---|
402 | ) >> $MKFILE.tmp
|
---|
403 |
|
---|
404 | # For the Adjusting phase we must to cd to the binutils-build directory.
|
---|
405 | elif [[ `_IS_ $i adjusting` ]] ; then
|
---|
406 | (
|
---|
407 | cat << EOF
|
---|
408 | @echo "PKGDIR=\$(LFS)\$(SRC)/binutils-build" > envars && \\
|
---|
409 | echo "export PKGDIR" >> envars
|
---|
410 | EOF
|
---|
411 | ) >> $MKFILE.tmp
|
---|
412 |
|
---|
413 | # For the Expect build we need to set the TCLPATH envar.
|
---|
414 | elif [[ `_IS_ $i expect` ]] ; then
|
---|
415 | (
|
---|
416 | cat << EOF
|
---|
417 | echo "TCLPATH=\`cat sources-dir\`" >> envars && \\
|
---|
418 | echo "export TCLPATH" >> envars
|
---|
419 | EOF
|
---|
420 | ) >> $MKFILE.tmp
|
---|
421 |
|
---|
422 | # Everything else, add a true statment so we don't confuse make
|
---|
423 | else
|
---|
424 | (
|
---|
425 | cat << EOF
|
---|
426 | true
|
---|
427 | EOF
|
---|
428 | ) >> $MKFILE.tmp
|
---|
429 | fi
|
---|
430 |
|
---|
431 | # Insert date and disk usage at the top of the log file, the script run
|
---|
432 | # and date and disk usage again at the bottom of the log file.
|
---|
433 | (
|
---|
434 | cat << EOF
|
---|
435 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
436 | su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/commands/$file" >>logs/$i 2>&1 && \\
|
---|
437 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(LFS)\`\n" >>logs/$i
|
---|
438 | EOF
|
---|
439 | ) >> $MKFILE.tmp
|
---|
440 |
|
---|
441 | # Remove the build directory(ies) except if the package build fails
|
---|
442 | # (to can review config.cache, config.log, and like.)
|
---|
443 | # For Binutils and TCL the sources must be retained some time.
|
---|
444 | if [ "$vrs" != "" ] ; then
|
---|
445 | if [[ ! `_IS_ $i binutils` ]] && [[ ! `_IS_ $i tcl` ]] ; then
|
---|
446 | (
|
---|
447 | cat << EOF
|
---|
448 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
449 | rm -r \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
450 | if [ -e \$(LFS)\$(SRC)/$name-build ]; then \\
|
---|
451 | rm -r \$(LFS)\$(SRC)/$name-build; \\
|
---|
452 | fi;
|
---|
453 | EOF
|
---|
454 | ) >> $MKFILE.tmp
|
---|
455 | fi
|
---|
456 | fi
|
---|
457 |
|
---|
458 | # Remove the Binutils pass 1 sources after a successful Adjusting phase.
|
---|
459 | if [[ `_IS_ $i adjusting` ]] ; then
|
---|
460 | (
|
---|
461 | cat << EOF
|
---|
462 | @rm -r \`cat sources-dir\` && \\
|
---|
463 | rm -r \$(LFS)\$(SRC)/binutils-build && \\
|
---|
464 | rm sources-dir
|
---|
465 | EOF
|
---|
466 | ) >> $MKFILE.tmp
|
---|
467 | fi
|
---|
468 |
|
---|
469 | # Remove the TCL sources after a successful Expect build.
|
---|
470 | if [[ `_IS_ $i expect` ]] ; then
|
---|
471 | (
|
---|
472 | cat << EOF
|
---|
473 | @rm -r \`cat sources-dir\` && \\
|
---|
474 | rm sources-dir
|
---|
475 | EOF
|
---|
476 | ) >> $MKFILE.tmp
|
---|
477 | fi
|
---|
478 |
|
---|
479 | # Include a touch of the target name so make can check
|
---|
480 | # if it's already been made.
|
---|
481 | (
|
---|
482 | cat << EOF
|
---|
483 | @touch \$@
|
---|
484 | EOF
|
---|
485 | ) >> $MKFILE.tmp
|
---|
486 |
|
---|
487 | # Keep the script file name for Makefile dependencies.
|
---|
488 | PREV=$i
|
---|
489 | done # end for file in chapter05/*
|
---|
490 | }
|
---|
491 |
|
---|
492 | #----------------------------#
|
---|
493 | chapter6_Makefiles() {
|
---|
494 | #----------------------------#
|
---|
495 | for file in chapter06/* ; do
|
---|
496 | # Keep the script file name
|
---|
497 | i=`basename $file`
|
---|
498 |
|
---|
499 | # We'll run the chroot commands differently than the others, so skip them in the
|
---|
500 | # dependencies and target creation.
|
---|
501 | if [[ `_IS_ $i chroot` ]] ; then
|
---|
502 | continue
|
---|
503 | fi
|
---|
504 |
|
---|
505 | # First append each name of the script files to a list (this will become
|
---|
506 | # the names of the targets in the Makefile
|
---|
507 | chapter6="$chapter6 $i"
|
---|
508 |
|
---|
509 | # Grab the name of the target
|
---|
510 | name=`echo $i | sed -e 's@[0-9]\{3\}-@@'`
|
---|
511 |
|
---|
512 | # Drop in the name of the target on a new line, and the previous target
|
---|
513 | # as a dependency. Also call the echo_message function.
|
---|
514 | (
|
---|
515 | cat << EOF
|
---|
516 |
|
---|
517 | $i: $PREV
|
---|
518 | @\$(call echo_message, Building)
|
---|
519 | EOF
|
---|
520 | ) >> $MKFILE.tmp
|
---|
521 |
|
---|
522 | # Find the version of the command files, if it corresponds with the building of
|
---|
523 | # a specific package
|
---|
524 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
525 |
|
---|
526 | # If $vrs isn't empty, we've got a package...
|
---|
527 | # Insert instructions for unpacking the package and changing directories
|
---|
528 | if [ "$vrs" != "" ] ; then
|
---|
529 | FILE="$name-$vrs.tar.*"
|
---|
530 | (
|
---|
531 | cat << EOF
|
---|
532 | @\$(call unpack2,$FILE)
|
---|
533 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
534 | echo "PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
|
---|
535 | echo "export PKGDIR" >> envars
|
---|
536 | EOF
|
---|
537 | ) >> $MKFILE.tmp
|
---|
538 | fi
|
---|
539 |
|
---|
540 | # For the Re-Adjusting phase we must to cd to the binutils-build directory.
|
---|
541 | if [[ `_IS_ $i readjusting` ]] ; then
|
---|
542 | (
|
---|
543 | cat << EOF
|
---|
544 | @echo "PKGDIR=\$(SRC)/binutils-build" > envars && \\
|
---|
545 | echo "export PKGDIR" >> envars
|
---|
546 | EOF
|
---|
547 | ) >> $MKFILE.tmp
|
---|
548 |
|
---|
549 | # For Glibc we need to set TIMEZONE envar.
|
---|
550 | elif [[ `_IS_ $i glibc` ]] ; then
|
---|
551 | (
|
---|
552 | cat << EOF
|
---|
553 | @echo "TIMEZONE=\$(TIMEZONE)" >> envars && \\
|
---|
554 | echo "export TIMEZONE" >> envars
|
---|
555 | EOF
|
---|
556 | ) >> $MKFILE.tmp
|
---|
557 |
|
---|
558 | # For Groff we need to set PAGE envar.
|
---|
559 | elif [[ `_IS_ $i groff` ]] ; then
|
---|
560 | (
|
---|
561 | cat << EOF
|
---|
562 | @echo "PAGE=\$(PAGE)" >> envars && \\
|
---|
563 | echo "export PAGE" >> envars
|
---|
564 | EOF
|
---|
565 | ) >> $MKFILE.tmp
|
---|
566 | fi
|
---|
567 |
|
---|
568 | # In the mount of kernel filesystems we need to set LFS
|
---|
569 | # and not to use chroot.
|
---|
570 | if [[ `_IS_ $i kernfs` ]] ; then
|
---|
571 | (
|
---|
572 | cat << EOF
|
---|
573 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
574 | export LFS=\$(LFS) && commands/$file >>logs/$i 2>&1 && \\
|
---|
575 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude={0,1}??-* \$(LFS)\`\n" >>logs/$i
|
---|
576 | EOF
|
---|
577 | ) >> $MKFILE.tmp
|
---|
578 |
|
---|
579 | # The rest of Chapter06
|
---|
580 | else
|
---|
581 | (
|
---|
582 | cat << EOF
|
---|
583 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
584 | \$(CHROOT1) 'cd /jhalfs && source envars && /jhalfs/commands/$file >>/jhalfs/logs/$i 2>&1' && \\
|
---|
585 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >>logs/$i
|
---|
586 | EOF
|
---|
587 | ) >> $MKFILE.tmp
|
---|
588 | fi
|
---|
589 |
|
---|
590 | # Remove the build directory(ies) except if the package build fails.
|
---|
591 | if [ "$vrs" != "" ] ; then
|
---|
592 | (
|
---|
593 | cat << EOF
|
---|
594 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
595 | rm -r \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
596 | if [ -e \$(LFS)\$(SRC)/$name-build ]; then \\
|
---|
597 | rm -r \$(LFS)\$(SRC)/$name-build; \\
|
---|
598 | fi;
|
---|
599 | EOF
|
---|
600 | ) >> $MKFILE.tmp
|
---|
601 | fi
|
---|
602 |
|
---|
603 | # Remove the Binutils pass 2 sources after a successful Re-Adjusting phase.
|
---|
604 | if [[ `_IS_ $i readjusting` ]] ; then
|
---|
605 | (
|
---|
606 | cat << EOF
|
---|
607 | @rm -r \`cat sources-dir\` && \\
|
---|
608 | rm -r \$(LFS)\$(SRC)/binutils-build && \\
|
---|
609 | rm sources-dir
|
---|
610 | EOF
|
---|
611 | ) >> $MKFILE.tmp
|
---|
612 | fi
|
---|
613 |
|
---|
614 | # Include a touch of the target name so make can check
|
---|
615 | # if it's already been made.
|
---|
616 | (
|
---|
617 | cat << EOF
|
---|
618 | @touch \$@
|
---|
619 | EOF
|
---|
620 | ) >> $MKFILE.tmp
|
---|
621 |
|
---|
622 | # Keep the script file name for Makefile dependencies.
|
---|
623 | PREV=$i
|
---|
624 | done # end for file in chapter06/*
|
---|
625 | }
|
---|
626 |
|
---|
627 | #----------------------------#
|
---|
628 | chapter789_Makefiles() {
|
---|
629 | #----------------------------#
|
---|
630 | for file in chapter0{7,8,9}/* ; do
|
---|
631 | # Keep the script file name
|
---|
632 | i=`basename $file`
|
---|
633 |
|
---|
634 | # Grub must be configured manually.
|
---|
635 | # The filesystems can't be unmounted via Makefile and the user
|
---|
636 | # should to enter to the chroot environment to create the root
|
---|
637 | # password, edit several files and setup Grub,
|
---|
638 | if [[ `_IS_ $i grub` ]] || [[ `_IS_ $i reboot` ]] ; then
|
---|
639 | continue
|
---|
640 | fi
|
---|
641 |
|
---|
642 | # If no .config file is supplied, the kernel build is skipped
|
---|
643 | if [ -z $CONFIG ] && [[ `_IS_ $i kernel` ]] ; then
|
---|
644 | continue
|
---|
645 | fi
|
---|
646 |
|
---|
647 | # First append each name of the script files to a list (this will become
|
---|
648 | # the names of the targets in the Makefile
|
---|
649 | chapter789="$chapter789 $i"
|
---|
650 |
|
---|
651 | # Drop in the name of the target on a new line, and the previous target
|
---|
652 | # as a dependency. Also call the echo_message function.
|
---|
653 | (
|
---|
654 | cat << EOF
|
---|
655 |
|
---|
656 | $i: $PREV
|
---|
657 | @\$(call echo_message, Building)
|
---|
658 | EOF
|
---|
659 | ) >> $MKFILE.tmp
|
---|
660 |
|
---|
661 | # Find the the bootscripts and kernel package names
|
---|
662 | if [[ `_IS_ $i bootscripts` ]] || [[ `_IS_ $i kernel` ]] ; then
|
---|
663 | if [[ `_IS_ $i bootscripts` ]] ; then
|
---|
664 | vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
665 | FILE="lfs-bootscripts-$vrs.tar.*"
|
---|
666 | elif [[ `_IS_ $i kernel` ]] ; then
|
---|
667 | vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
668 | FILE="linux-$vrs.tar.*"
|
---|
669 | fi
|
---|
670 | (
|
---|
671 | cat << EOF
|
---|
672 | @\$(call unpack2,$FILE)
|
---|
673 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
674 | echo "PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
|
---|
675 | echo "export PKGDIR" >> envars
|
---|
676 | EOF
|
---|
677 | ) >> $MKFILE.tmp
|
---|
678 | fi
|
---|
679 |
|
---|
680 | # Put in place the kernel .config file
|
---|
681 | if [[ `_IS_ $i kernel` ]] ; then
|
---|
682 | (
|
---|
683 | cat << EOF
|
---|
684 | @cp $CONFIG \$(LFS)/sources/kernel-config
|
---|
685 | EOF
|
---|
686 | ) >> $MKFILE.tmp
|
---|
687 | fi
|
---|
688 |
|
---|
689 | # Check if we have a real /etc/fstab file
|
---|
690 | if [[ `_IS_ $i fstab` ]] && [[ -n "$FSTAB" ]] ; then
|
---|
691 | (
|
---|
692 | cat << EOF
|
---|
693 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
694 | cp -v $FSTAB \$(LFS)/etc/fstab >>logs/$i 2>&1 && \\
|
---|
695 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >>logs/$i
|
---|
696 | EOF
|
---|
697 | ) >> $MKFILE.tmp
|
---|
698 | else
|
---|
699 | # Initialize the log an run the script
|
---|
700 | (
|
---|
701 | cat << EOF
|
---|
702 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
703 | \$(CHROOT2) 'cd /jhalfs && source envars && /jhalfs/commands/$file >>/jhalfs/logs/$i 2>&1' && \\
|
---|
704 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude={0,1}??-* \$(LFS)\`\n" >>logs/$i
|
---|
705 | EOF
|
---|
706 | ) >> $MKFILE.tmp
|
---|
707 | fi
|
---|
708 |
|
---|
709 | # Remove the build directory except if the package build fails.
|
---|
710 | if [[ `_IS_ $i bootscripts` ]] || [[ `_IS_ $i kernel` ]] ; then
|
---|
711 | (
|
---|
712 | cat << EOF
|
---|
713 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
714 | rm -r \$(LFS)\$(SRC)/\$\$ROOT
|
---|
715 | EOF
|
---|
716 | ) >> $MKFILE.tmp
|
---|
717 | fi
|
---|
718 |
|
---|
719 | # Include a touch of the target name so make can check
|
---|
720 | # if it's already been made.
|
---|
721 | (
|
---|
722 | cat << EOF
|
---|
723 | @touch \$@
|
---|
724 | EOF
|
---|
725 | ) >> $MKFILE.tmp
|
---|
726 |
|
---|
727 | # Keep the script file name for Makefile dependencies.
|
---|
728 | PREV=$i
|
---|
729 | done # for file in chapter0{7,8,9}/*
|
---|
730 | }
|
---|
731 |
|
---|
732 |
|
---|
733 | #----------------------------#
|
---|
734 | build_Makefile() {
|
---|
735 | #----------------------------#
|
---|
736 | echo -n "Creating Makefile... "
|
---|
737 | cd $JHALFSDIR/commands
|
---|
738 |
|
---|
739 | # Start with a clean Makefile.tmp file
|
---|
740 | >$MKFILE.tmp
|
---|
741 |
|
---|
742 | chapter4_Makefiles
|
---|
743 | chapter5_Makefiles
|
---|
744 | chapter6_Makefiles
|
---|
745 | chapter789_Makefiles
|
---|
746 |
|
---|
747 |
|
---|
748 | # Add a header, some variables and include the function file
|
---|
749 | # to the top of the real Makefile.
|
---|
750 | (
|
---|
751 | cat << EOF
|
---|
752 | $HEADER
|
---|
753 |
|
---|
754 | SRC= /sources
|
---|
755 | LFS= $BUILDDIR
|
---|
756 | PAGE= $PAGE
|
---|
757 | TIMEZONE= $TIMEZONE
|
---|
758 |
|
---|
759 | include functions
|
---|
760 |
|
---|
761 | EOF
|
---|
762 | ) > $MKFILE
|
---|
763 |
|
---|
764 |
|
---|
765 | # Add chroot commands
|
---|
766 | i=1
|
---|
767 | for file in chapter06/*chroot* ; do
|
---|
768 | chroot=`cat $file | sed -e '/#!\/bin\/sh/d' -e 's@ \\\@ @g' | tr -d '\n' | sed \
|
---|
769 | -e 's/ */ /g' -e 's|\\$|&&|g' -e 's|exit||g' -e 's|$| -c|' \
|
---|
770 | -e 's|"$$LFS"|$(LFS)|' -e 's|set -e||'`
|
---|
771 | echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
---|
772 | i=`expr $i + 1`
|
---|
773 | done
|
---|
774 |
|
---|
775 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
776 | # as a dependency.
|
---|
777 | (
|
---|
778 | cat << EOF
|
---|
779 | all: chapter4 chapter5 chapter6 chapter789
|
---|
780 | @\$(call echo_finished,$VERSION)
|
---|
781 |
|
---|
782 | chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
---|
783 |
|
---|
784 | chapter5: chapter4 $chapter5
|
---|
785 |
|
---|
786 | chapter6: chapter5 $chapter6
|
---|
787 |
|
---|
788 | chapter789: chapter6 $chapter789
|
---|
789 |
|
---|
790 | clean-all: clean
|
---|
791 | rm -rf ./*
|
---|
792 |
|
---|
793 | clean: clean-chapter789 clean-chapter6 clean-chapter5 clean-chapter4
|
---|
794 |
|
---|
795 | clean-chapter4:
|
---|
796 | -userdel lfs
|
---|
797 | rm -rf /home/lfs
|
---|
798 | rm -rf \$(LFS)/tools
|
---|
799 | rm -f /tools
|
---|
800 | rm -f envars
|
---|
801 | rm -f 02* logs/02*.log
|
---|
802 |
|
---|
803 | clean-chapter5:
|
---|
804 | rm -rf \$(LFS)/tools/*
|
---|
805 | rm -f $chapter5
|
---|
806 | cd logs && rm -f $chapter5 && cd ..
|
---|
807 |
|
---|
808 | clean-chapter6:
|
---|
809 | -umount \$(LFS)/sys
|
---|
810 | -umount \$(LFS)/proc
|
---|
811 | -umount \$(LFS)/dev/shm
|
---|
812 | -umount \$(LFS)/dev/pts
|
---|
813 | -umount \$(LFS)/dev
|
---|
814 | rm -rf \$(LFS)/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
815 | rm -f $chapter6
|
---|
816 | cd logs && rm -f $chapter6 && cd ..
|
---|
817 |
|
---|
818 | clean-chapter789:
|
---|
819 | rm -f $chapter789
|
---|
820 | cd logs && rm -f $chapter789 && cd ..
|
---|
821 |
|
---|
822 |
|
---|
823 | EOF
|
---|
824 | ) >> $MKFILE
|
---|
825 |
|
---|
826 | # Bring over the items from the Makefile.tmp
|
---|
827 | cat $MKFILE.tmp >> $MKFILE
|
---|
828 | rm $MKFILE.tmp
|
---|
829 | echo -ne "done\n"
|
---|
830 | }
|
---|
831 |
|
---|
832 | #----------------------------#
|
---|
833 | run_make() {
|
---|
834 | #----------------------------#
|
---|
835 | # Test if make must be run.
|
---|
836 | if [ "$RUNMAKE" = "1" ] ; then
|
---|
837 | # Test to make sure we're running the build as root
|
---|
838 | if [ "$UID" != "0" ] ; then
|
---|
839 | echo "You must be logged in as root to successfully build LFS."
|
---|
840 | exit 1
|
---|
841 | fi
|
---|
842 | # Build the system
|
---|
843 | if [ -e $MKFILE ] ; then
|
---|
844 | echo -ne "Building the LFS system...\n"
|
---|
845 | cd $JHALFSDIR && make
|
---|
846 | echo -ne "done\n"
|
---|
847 | fi
|
---|
848 | fi
|
---|
849 | }
|
---|
850 |
|
---|
851 |
|
---|
852 |
|
---|
853 | ###################################
|
---|
854 | ### MAIN ###
|
---|
855 | ###################################
|
---|
856 |
|
---|
857 | # Evaluate any command line switches
|
---|
858 |
|
---|
859 | while test $# -gt 0 ; do
|
---|
860 | case $1 in
|
---|
861 | --version | -V )
|
---|
862 | echo "$version"
|
---|
863 | exit 0
|
---|
864 | ;;
|
---|
865 |
|
---|
866 | --help | -h )
|
---|
867 | echo "$usage"
|
---|
868 | exit 0
|
---|
869 | ;;
|
---|
870 |
|
---|
871 | --LFS-version | -L )
|
---|
872 | test $# = 1 && eval "$exit_missing_arg"
|
---|
873 | shift
|
---|
874 | case $1 in
|
---|
875 | dev* | SVN | trunk )
|
---|
876 | LFSVRS=development
|
---|
877 | ;;
|
---|
878 | testing | 6.1.1 )
|
---|
879 | LFSVRS=6.1.1
|
---|
880 | ;;
|
---|
881 |
|
---|
882 | alpha*)
|
---|
883 | LFSVRS=alphabetical
|
---|
884 | ;;
|
---|
885 | * )
|
---|
886 | echo "$1 is an unsupported version at this time."
|
---|
887 | exit 1
|
---|
888 | ;;
|
---|
889 | esac
|
---|
890 | ;;
|
---|
891 |
|
---|
892 | --directory | -d )
|
---|
893 | test $# = 1 && eval "$exit_missing_arg"
|
---|
894 | shift
|
---|
895 | BUILDDIR=$1
|
---|
896 | ;;
|
---|
897 |
|
---|
898 | --download-client | -D )
|
---|
899 | test $# = 1 && eval "$exit_missing_arg"
|
---|
900 | shift
|
---|
901 | DL=$1
|
---|
902 | ;;
|
---|
903 |
|
---|
904 | --working-copy | -W )
|
---|
905 | test $# = 1 && eval "$exit_missing_arg"
|
---|
906 | shift
|
---|
907 | if [ -f $1/patches.ent ] ; then
|
---|
908 | WC=1
|
---|
909 | BOOK=$1
|
---|
910 | else
|
---|
911 | echo -e "\nLook like $1 isn't a supported working copy."
|
---|
912 | echo -e "Verify your selection and the command line.\n"
|
---|
913 | exit 1
|
---|
914 | fi
|
---|
915 | ;;
|
---|
916 |
|
---|
917 | --testsuites | -T ) TEST=1 ;;
|
---|
918 |
|
---|
919 | --get-packages | -P ) HPKG=1 ;;
|
---|
920 |
|
---|
921 | --run-make | -M ) RUNMAKE=1 ;;
|
---|
922 |
|
---|
923 | --no-toolchain-test ) TOOLCHAINTEST=0 ;;
|
---|
924 |
|
---|
925 | --no-vim-lang ) VIMLANG=0 ;;
|
---|
926 |
|
---|
927 | --page_size )
|
---|
928 | test $# = 1 && eval "$exit_missing_arg"
|
---|
929 | shift
|
---|
930 | case $1 in
|
---|
931 | letter | A4 )
|
---|
932 | PAGE=$1
|
---|
933 | ;;
|
---|
934 | * )
|
---|
935 | echo "$1 isn't a supported page size."
|
---|
936 | exit 1
|
---|
937 | ;;
|
---|
938 | esac
|
---|
939 | ;;
|
---|
940 |
|
---|
941 |
|
---|
942 | --timezone )
|
---|
943 | test $# = 1 && eval "$exit_missing_arg"
|
---|
944 | shift
|
---|
945 | if [ -f /usr/share/zoneinfo/$1 ] ; then
|
---|
946 | TIMEZONE=$1
|
---|
947 | else
|
---|
948 | echo -e "\nLook like $1 isn't a valid timezone description."
|
---|
949 | echo -e "Verify your selection and the command line.\n"
|
---|
950 | exit 1
|
---|
951 | fi
|
---|
952 | ;;
|
---|
953 |
|
---|
954 | --fstab )
|
---|
955 | test $# = 1 && eval "$exit_missing_arg"
|
---|
956 | shift
|
---|
957 | if [ -f $1 ] ; then
|
---|
958 | FSTAB=$1
|
---|
959 | else
|
---|
960 | echo -e "\nFile $1 not found. Verify your command line.\n"
|
---|
961 | exit 1
|
---|
962 | fi
|
---|
963 | ;;
|
---|
964 |
|
---|
965 | --kernel-config | -C )
|
---|
966 | test $# = 1 && eval "$exit_missing_arg"
|
---|
967 | shift
|
---|
968 | if [ -f $1 ] ; then
|
---|
969 | CONFIG=$1
|
---|
970 | else
|
---|
971 | echo -e "\nFile $1 not found. Verify your command line.\n"
|
---|
972 | exit 1
|
---|
973 | fi
|
---|
974 | ;;
|
---|
975 |
|
---|
976 | * )
|
---|
977 | echo "$usage"
|
---|
978 | exit 1
|
---|
979 | ;;
|
---|
980 | esac
|
---|
981 | shift
|
---|
982 | done
|
---|
983 |
|
---|
984 | # Find the download client to use, if not already specified.
|
---|
985 |
|
---|
986 | if [ -z $DL ] ; then
|
---|
987 | if [ `type -p wget` ] ; then
|
---|
988 | DL=wget
|
---|
989 | elif [ `type -p curl` ] ; then
|
---|
990 | DL=curl
|
---|
991 | else
|
---|
992 | eval "$no_dl_client"
|
---|
993 | fi
|
---|
994 | fi
|
---|
995 |
|
---|
996 | [[ ! -d $JHALFSDIR ]] && mkdir -pv $JHALFSDIR
|
---|
997 | [[ "$PWD" != "$JHALFSDIR" ]] && cp -v $FILES $JHALFSDIR/ && \
|
---|
998 | sed -e 's/FAKEDIR/'$BOOK'/' $XSL > $JHALFSDIR/dump-lfs-scripts.xsl && \
|
---|
999 | export XSL=$JHALFSDIR/dump-lfs-scripts.xsl
|
---|
1000 | [[ ! -d $LOGDIR ]] && mkdir -v $LOGDIR
|
---|
1001 | >$LOGDIR/$LOG
|
---|
1002 |
|
---|
1003 | get_book
|
---|
1004 | build_Makefile
|
---|
1005 | run_make
|
---|
1006 |
|
---|