source: jhalfs@ 6299c11

0.2 1.0 2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 6299c11 was 6299c11, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Fixed few errors.
Added a mensage after a succefull full build.

  • Property mode set to 100755
File size: 19.2 KB
Line 
1#!/bin/sh
2
3version="
4jhalfs development
5
6Originally written by Jeremy Huntwork.
7Maintained by Manuel Canales Esparcia.
8
9This program is published under the \
10Gnu General Public License, Version 2.
11"
12
13usage="\
14Usage: $0 [OPTION]
15
16Options:
17 -h, --help print this help, then exit
18 -V, --version print version number, then exit
19 -L, --LFS-version=VER use VER version of the LFS book
20 -d --directory=DIR use DIR directory for building LFS; all files
21 jhalfs produces will be in the directory
22 DIR/jhalfs
23 -D, --download-client=CLIENT use CLIENT as the program for retrieving
24 packages
25 -T, --testsuites run the optional testsuites
26 -P, --get-packages download the packages
27 -M, --run-make run make on the generated Makefile
28"
29
30help="\
31Try '$0 --help' for more information."
32
33exit_missing_arg="\
34echo \"Option '\$1' requires an argument\" >&2
35echo \"\$help\" >&2
36exit 1"
37
38no_dl_client="\
39echo \"Could not find a way to download the LFS sources.\" >&2
40echo \"Attempting to continue.\" >&2"
41
42while test $# -gt 0 ; do
43 case $1 in
44 --version | -V )
45 echo "$version"
46 exit 0
47 ;;
48
49 --help | -h )
50 echo "$usage"
51 exit 0
52 ;;
53
54 --LFS-version | -L )
55 test $# = 1 && eval "$exit_missing_arg"
56 shift
57 case $1 in
58 dev* | SVN | trunk )
59 LFSVRS=development
60 ;;
61 * )
62 echo "$1 is an unsupported version at this time."
63 exit 1
64 ;;
65 esac
66 shift
67 ;;
68
69 --directory | -d )
70 test $# = 1 && eval "$exit_missing_arg"
71 shift
72 BUILDDIR=$1
73 shift
74 ;;
75
76 --download-client | -D )
77 test $# = 1 && eval "$exit_missing_arg"
78 shift
79 DL=$1
80 shift
81 ;;
82
83 --testsuites | -T )
84 TEST=1
85 shift
86 ;;
87
88 --get-packages | -P )
89 HPKG=1
90 shift
91 ;;
92
93 --run-make | -M )
94 RUNMAKE=1
95 shift
96 ;;
97
98 * )
99 echo "$usage"
100 exit 1
101 ;;
102 esac
103done
104
105# Test to make sure we're running the build as root
106
107if [ "$UID" != "0" ] ; then
108 echo "You must be logged in as root to successfully build LFS."
109 exit 1
110fi
111
112# Find the download client to use, if not already specified.
113
114if [ -z $DL ] ; then
115 if [ `type -p wget` ] ; then
116 DL=wget
117 elif [ `type -p curl` ] ; then
118 DL=curl
119 else
120 eval "$no_dl_client"
121 fi
122fi
123
124SVN="svn://svn.linuxfromscratch.org"
125HTTP=http://ftp.lfs-matrix.net/pub/lfs/lfs-packages/conglomeration
126if [ -z $BUILDDIR ] ; then BUILDDIR=/mnt/lfs ; fi
127JHALFSDIR=$BUILDDIR/jhalfs
128LOGDIR=/jhalfs/logs
129LOG=000-jhalfs.log
130MKFILE=$JHALFSDIR/Makefile
131XSL=dump-lfs-scripts.xsl
132if [ -z $TEST ] ; then TEST=0 ; fi
133
134get_book() {
135 # Check for Subversion instead of just letting the script hit 'svn' and fail.
136 test `type -p svn` || eval "echo \"This feature requires Subversion.\"
137 exit 1"
138 cd $JHALFSDIR
139
140 # Test to make sure the LFS version is set
141 if [ -z $LFSVRS ] ; then LFSVRS=development ; fi
142 echo -n "Downloading the LFS Book, version $LFSVRS... "
143
144 # Grab the LFS book fresh if it's missing, otherwise, update it from the
145 # repo. If we've already extracted the commands, move on to getting the
146 # sources.
147 if [ -d lfs-$LFSVRS ] ; then
148 cd lfs-$LFSVRS
149 if svn up | grep -q At && test -d $JHALFSDIR/commands && \
150 test -f $JHALFSDIR/packages && test -f $JHALFSDIR/patches ; then
151 echo -ne "done\n"
152 get_sources
153 else
154 echo -ne "done\n"
155 extract_commands
156 fi
157 else
158 if [ $LFSVRS = development ] ; then
159 svn co $SVN/LFS/trunk/BOOK lfs-$LFSVRS >>$BUILDDIR$LOGDIR/$LOG 2>&1
160 else
161 svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$BUILDDIR$LOGDIR/$LOG 2>&1
162 fi
163 echo -ne "done\n"
164 extract_commands
165 fi
166}
167
168extract_commands() {
169 # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
170 test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
171 exit 1"
172 cd $JHALFSDIR
173
174 # Start clean
175 if [ -d commands ] ; then rm -rf commands ; fi && mkdir commands
176 echo -n "Extracting commands... "
177
178 # Dump the commands in shell script form from the LFS book.
179 xsltproc --nonet --xinclude --stringparam testsuite $TEST -o ./commands/ \
180 $XSL lfs-$LFSVRS/index.xml >>$BUILDDIR$LOGDIR/$LOG 2>&1
181
182 # Grab the patches and package names.
183 cd $JHALFSDIR
184 for i in patches packages ; do rm -f $i ; done
185 grep "\-version" lfs-$LFSVRS/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@' \
186 -e '/generic/d' >> packages
187 grep "ENTITY" lfs-$LFSVRS/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
188
189 # Done. Moving on...
190 echo -ne "done\n"
191 get_sources
192}
193
194download() {
195 cd $BUILDDIR/sources
196
197 # Hackish fix for the bash-doc package that doesn't conform
198 # to norms in the URL scheme.
199 DIR=`echo $1 | sed 's@-doc@@'`
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
234get_sources() {
235
236 # Test if the packages must be downloaded
237 if [ "$HPKG" = "1" ] ; then
238
239 # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
240 # separates each iteration by lines. It is necessary to have the second
241 # ' on the next line.
242 IFS='
243'
244
245 if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
246 cd $BUILDDIR/sources
247 if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
248
249 download "" MD5SUMS
250
251 # Iterate through each package and grab it, along with any patches it needs.
252 for i in `cat $JHALFSDIR/packages` ; do
253 PKG=`echo $i | sed 's/-version.*//'`
254
255 # Someone used some silly entities right next to the valid package entities.
256 if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi
257
258 VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
259 if [ "$PKG" = "tcl" ] ; then
260 FILE="$PKG$VRS-src.tar.bz2"
261 else
262 FILE="$PKG-$VRS.tar.bz2"
263 fi
264 download $PKG $FILE
265 for patch in `grep "$PKG-&$PKG" $JHALFSDIR/patches` ; do
266 PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
267 download $PKG $PATCH
268 done
269 done
270 fi
271}
272
273build_Makefile() {
274 echo -n "Creating Makefile... "
275 cd $JHALFSDIR/commands
276
277 # Start with a clean Makefile.tmp file
278 >$MKFILE.tmp
279
280 for file in chapter05/* ; do
281 # Keep the script file name
282 i=`basename $file`
283
284 # First append each name of the script files to a list (this will become
285 # the names of the targets in the Makefile
286 chapter5="$chapter5 $i"
287
288 # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
289 # and binutils in chapter 5)
290 name=`echo $i | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
291
292 # Set the dependency for the first target.
293 if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
294
295 # Drop in the name of the target on a new line, and the previous target
296 # as a dependency.
297 echo -e "\n$i: $PREV" >> $MKFILE.tmp
298
299 # Find the version of the command files, if it corresponds with the building of
300 # a specific package
301 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
302
303 # If $vrs isn't empty, we've got a package...
304 if [ "$vrs" != "" ] ; then
305 if [ "$name" = "tcl" ] ; then
306 FILE="$name$vrs-src.tar.bz2"
307 else
308 FILE="$name-$vrs.tar.bz2"
309 fi
310
311 # Insert instructions for unpacking the package and to set
312 # the PKGDIR variable.
313 echo -e "\t\$(call unpack-lfs,$FILE)" >> $MKFILE.tmp
314 echo -e "\t-ROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
315 echo -e "\tchown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
316 echo -e "\techo \"PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT\" > envars && \\" >> $MKFILE.tmp
317 echo -e "\techo \"export PKGDIR\" >> envars && \\" >> $MKFILE.tmp
318 fi
319
320 # Dump the path to the Binutils pass1 or TCL sources directory.
321 if [ "$i" = "027-binutils-pass1" -o "$i" = "032-tcl" ] ; then
322 echo -e "\techo \"\$(LFS)\$(SRC)/\$\$ROOT\" > sources-dir && \\" >> $MKFILE.tmp
323 fi
324
325 # Dump the path to the Binutils pass2 sources directory.
326 if [ "$i" = "036-binutils-pass2" ] ; then
327 echo -e "\techo \"\$(SRC)/\$\$ROOT\" > sources-dir && \\" >> $MKFILE.tmp
328 fi
329
330 # Inser date and disk usage at the top of the log file.
331 echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >\$(LFS)\$(LOGDIR)/$i && \\" >> $MKFILE.tmp
332
333 # For the Adjusting phase we must to cd to the binutils-build directory.
334 if [ "$i" = "031-adjusting" ] ; then
335 echo -e "\techo \"PKGDIR=\$(LFS)\$(SRC)/binutils-build\" > envars && \\" >> $MKFILE.tmp
336 echo -e "\techo \"export PKGDIR\" >> envars && \\" >> $MKFILE.tmp
337 fi
338
339 # For the Expect build we need to set the TCLPATH envar.
340 if [ "$i" = "033-expect" ] ; then
341 echo -e "\techo \"TCLPATH=\`cat sources-dir\`\" >> envars && \\" >> $MKFILE.tmp
342 echo -e "\techo \"export TCLPATH\" >> envars && \\" >> $MKFILE.tmp
343 fi
344
345 # Insert the script run
346 echo -e "\tsu - lfs -c \". /home/lfs/.bashrc && $JHALFSDIR/commands/$file\" >>\$(LFS)\$(LOGDIR)/$i 2>&1 && \\" >> $MKFILE.tmp
347
348 # Inser date and disk usage at the bottom of the log file.
349 echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >>\$(LFS)\$(LOGDIR)/$i && \\" >> $MKFILE.tmp
350
351 # Include a touch of the target name so make can check
352 # if it's already been made.
353 echo -e "\ttouch \$@" >> $MKFILE.tmp
354
355 # Remove the build directory(ies) even if the package build fails, except for
356 # Binutils and TCL. In that cases the sources directories are removed
357 # only if the build fails.
358 if [ "$vrs" != "" ] ; then
359 if [ "$i" != "027-binutils-pass1" ] && [ "$i" != "032-tcl" ] && [ "$i" != "036-binutils-pass2" ] ; then
360 echo -e "\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
361 echo -e "\trm -r \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
362 echo -e "\tif [ -e \$(LFS)\$(SRC)/$name-build ]; then \\" >> $MKFILE.tmp
363 echo -e "\t\trm -r \$(LFS)\$(SRC)/$name-build; \\" >> $MKFILE.tmp
364 echo -e "\tfi;" >> $MKFILE.tmp
365 fi
366 fi
367 if [ "$i" = "027-binutils-pass1" -o "$i" = "036-binutils-pass2" ] ; then
368 echo -e "\tif [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
369 echo -e "\t\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
370 echo -e "\t\trm -r \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
371 echo -e "\t\trm -r \$(LFS)\$(SRC)/binutils-build; \\" >> $MKFILE.tmp
372 echo -e "\tfi;" >> $MKFILE.tmp
373 fi
374 if [ "$i" = "032-tcl" ] ; then
375 echo -e "\tif [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
376 echo -e "\t\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
377 echo -e "\t\trm -r \$(LFS)\$(SRC)/\$\$ROOT; \\" >> $MKFILE.tmp
378 echo -e "\tfi;" >> $MKFILE.tmp
379 fi
380
381 # Remove the Binutils pass 1 sources after a sucessfull Adjusting phase.
382 if [ "$i" = "031-adjusting" ] ; then
383 echo -e "\tif [ -e \$@ ] ; then \\" >> $MKFILE.tmp
384 echo -e "\t\trm -r \`cat sources-dir\` && \\" >> $MKFILE.tmp
385 echo -e "\t\trm -r \$(LFS)\$(SRC)/binutils-build && \\" >> $MKFILE.tmp
386 echo -e "\t\trm sources-dir; \\" >> $MKFILE.tmp
387 echo -e "\tfi;" >> $MKFILE.tmp
388 fi
389
390 # Remove the TCL sources after a sucessfull Expect build.
391 if [ "$i" = "033-expect" ] ; then
392 echo -e "\tif [ -e \$@ ] ; then \\" >> $MKFILE.tmp
393 echo -e "\t\trm -r \`cat sources-dir\` && \\" >> $MKFILE.tmp
394 echo -e "\t\trm sources-dir; \\" >> $MKFILE.tmp
395 echo -e "\tfi;" >> $MKFILE.tmp
396 fi
397
398 # Check if the package has been sucessfully build.
399 echo -e "\tif [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
400 echo -e "\t\techo \"The build of \$@ has failed\" && exit 1; \\" >> $MKFILE.tmp
401 echo -e "\tfi;" >> $MKFILE.tmp
402
403 # Keep the script file name for Makefile dependencies.
404 PREV=$i
405 done
406
407 for file in chapter06/* ; do
408 # Keep the script file name
409 i=`basename $file`
410
411 # First append each name of the script files to a list (this will become
412 # the names of the targets in the Makefile
413 chapter6="$chapter6 $i"
414
415 # Grab the name of the target
416 name=`echo $i | sed -e 's@[0-9]\{3\}-@@'`
417
418 # Set the dependency for the first target.
419 if [ -z $PREV ] ; then PREV=055-stripping ; fi
420
421 # Drop in the name of the target on a new line, and the previous target
422 # as a dependency.
423 echo -e "\n$i: $PREV" >> $MKFILE.tmp
424
425 # Find the version of the command files, if it corresponds with the building of
426 # a specific package
427 vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
428
429 # If $vrs isn't empty, we've got a package...
430 if [ "$vrs" != "" ] ; then
431 FILE="$name-$vrs.tar.bz2"
432
433 # Insert instructions for unpacking the package and changing directories
434 echo -e "\t\$(call unpack,$FILE)" >> $MKFILE.tmp
435 echo -e "\t-ROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
436 echo -e "\tcd \$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
437 fi
438
439 # Inser date and disk usage at the top of the log file.
440 echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* /\`\\\n\" >\$(LOGDIR)/$i && \\" >> $MKFILE.tmp
441
442 # For the Re-Adjusting phase we must to cd to the binutils-build directory.
443 if [ "$i" = "067-readjusting" ] ; then
444 echo -e "\tcd \$(SRC)/binutils-build && \\" >> $MKFILE.tmp
445 fi
446
447 # Insert the script run
448 echo -e "\t/jhalfs/commands/$file >>\$(LOGDIR)/$i 2>&1 && \\" >> $MKFILE.tmp
449
450 # Inser date and disk usage at the bottom of the log file.
451 echo -e "\techo -e \"\\\n\`date\`\\\n\\\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\\\n\" >>\$(LOGDIR)/$i && \\" >> $MKFILE.tmp
452
453 # Include a touch of the target name so make can check
454 # if it's already been made.
455 echo -e "\ttouch \$@" >> $MKFILE.tmp
456
457 # Remove the build directory(ies) even if the package build fails.
458 if [ "$vrs" != "" ] ; then
459 echo -e "\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
460 echo -e "\trm -r \$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
461 echo -e "\tif [ -e \$(SRC)/$name-build ]; then \\" >> $MKFILE.tmp
462 echo -e "\t\trm -r \$(SRC)/$name-build; \\" >> $MKFILE.tmp
463 echo -e "\tfi;" >> $MKFILE.tmp
464 fi
465
466 # Remove the Binutils pass 2 sources after a sucessfull Re-Adjusting phase.
467 if [ "$i" = "067-readjusting" ] ; then
468 echo -e "\tif [ -e \$@ ] ; then \\" >> $MKFILE.tmp
469 echo -e "\t\trm -r \`cat sources-dir\` && \\" >> $MKFILE.tmp
470 echo -e "\t\trm -r \$(SRC)/binutils-build && \\" >> $MKFILE.tmp
471 echo -e "\t\trm sources-dir; \\" >> $MKFILE.tmp
472 echo -e "\tfi;" >> $MKFILE.tmp
473 fi
474
475 # Check if the package has been sucessfully build.
476 echo -e "\tif [ ! -e \$@ ] ; then \\" >> $MKFILE.tmp
477 echo -e "\t\techo \"The build of \$@ has failed\" && exit 1; \\" >> $MKFILE.tmp
478 echo -e "\tfi;" >> $MKFILE.tmp
479
480 # Keep the script file name for Makefile dependencies.
481 PREV=$i
482 done
483
484 # Stick variables and some defines at the top of the real makefile
485 echo "export SRC := /sources" > $MKFILE
486 echo "export LFS := $BUILDDIR" >> $MKFILE
487 echo -e "export LOGDIR := $LOGDIR\n" >> $MKFILE
488 echo "define unpack-lfs" >> $MKFILE
489 echo -e "\t@cd \$(LFS)\$(SRC) ; tar -xvjf \$(1) > /tmp/unpacked" >> $MKFILE
490 echo -e "endef\n" >> $MKFILE
491 echo "define unpack" >> $MKFILE
492 echo -e "\t@cd \$(SRC) ; tar -xvf \$(1) > /tmp/unpacked" >> $MKFILE
493 echo -e "endef\n" >> $MKFILE
494
495 # Drop in the main target 'all:' and the chapter targets with each sub-target
496 # as a dependency.
497 echo "all: chapter4 chapter5" >> $MKFILE
498 echo -e "\techo -e \"\\\n\\\tYour new LFS system has been sucessfully build\"\n" >> $MKFILE
499 echo -e "chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment\n" >> $MKFILE
500 echo -e "chapter5: chapter4 $chapter5\n" >> $MKFILE >> $MKFILE
501 echo -e "chapter6: chapter5 $chapter6\n" >> $MKFILE
502
503 # Clean targets
504 echo "clean-all: clean" >> $MKFILE
505 echo -e "\trm -rfv ./*\n" >> $MKFILE
506
507 echo -e "clean: clean-chapter5 clean-chapter4\n" >> $MKFILE
508
509 echo "clean-chapter4:" >> $MKFILE
510 echo -e "\t-userdel lfs" >> $MKFILE
511 echo -e "\trm -rfv /home/lfs" >> $MKFILE
512 echo -e "\trm -rfv \$(LFS)/tools" >> $MKFILE
513 echo -e "\trm -fv /tools" >> $MKFILE
514 echo -e "\trm -fv envars" >> $MKFILE
515 echo -e "\trm -fv 02* logs/02*.log\n" >> $MKFILE
516
517 echo "clean-chapter5:" >> $MKFILE
518 echo -e "\trm -rfv \$(LFS)/tools/*" >> $MKFILE
519 echo -e "\trm -fv envars" >> $MKFILE
520 echo -e "\trm -fv $chapter5" >> $MKFILE
521 echo -e "\tcd logs && rm -fv $chapter5 && cd ..\n" >> $MKFILE
522
523 # The chapter4 sub-targets are hard-coded to can create the lfs user,
524 # to make the scripts executables, and to create a clean environment
525 # for the lfs user.
526 echo "020-creatingtoolsdir:" >> $MKFILE
527 echo -e "\tmkdir -v \$(LFS)/tools && \\" >> $MKFILE
528 echo -e "\tln -sv \$(LFS)/tools / && \\" >> $MKFILE
529 echo -e "\ttouch \$@\n" >> $MKFILE
530
531 echo "021-addinguser: 020-creatingtoolsdir" >> $MKFILE
532 echo -e "\tgroupadd lfs && \\" >> $MKFILE
533 echo -e "\tuseradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\" >> $MKFILE
534 echo -e "\tchown lfs \$(LFS)/tools && \\" >> $MKFILE
535 echo -e "\tchown lfs \$(LFS)/sources && \\" >> $MKFILE
536 # Make the scripts executables
537 echo -e "\tchmod -R +x $JHALFSDIR/commands && \\" >> $MKFILE
538 echo -e "\ttouch \$@\n" >> $MKFILE
539
540 echo "022-settingenvironment: 021-addinguser" >> $MKFILE
541 echo -e "\techo \"exec env -i HOME=\\\$\$HOME TERM=\\\$\$TERM PS1='\u:\w\$$ ' /bin/bash\" > /home/lfs/.bash_profile && \\" >> $MKFILE
542 echo -e "\techo \"set +h\" > /home/lfs/.bashrc && \\" >> $MKFILE
543 echo -e "\techo \"umask 022\" >> /home/lfs/.bashrc && \\" >> $MKFILE
544 echo -e "\techo \"LFS=/mnt/lfs\" >> /home/lfs/.bashrc && \\" >> $MKFILE
545 echo -e "\techo \"LC_ALL=POSIX\" >> /home/lfs/.bashrc && \\" >> $MKFILE
546 echo -e "\techo \"PATH=/tools/bin:/bin:/usr/bin\" >> /home/lfs/.bashrc && \\" >> $MKFILE
547 echo -e "\techo \"export LFS LC_ALL PATH\" >> /home/lfs/.bashrc && \\" >> $MKFILE
548 # Source the file where we place changing variables.
549 echo -e "\techo \". $JHALFSDIR/envars\" >> /home/lfs/.bashrc && \\" >> $MKFILE
550 echo -e "\tchown lfs:lfs /home/lfs/.bash* && \\" >> $MKFILE
551 echo -e "\ttouch envars && \\" >> $MKFILE
552 echo -e "\ttouch \$@" >> $MKFILE
553
554 # Bring over the items from the Makefile.tmp
555 cat $MKFILE.tmp >> $MKFILE
556 rm $MKFILE.tmp
557 echo -ne "done\n"
558}
559
560run_make() {
561 # Test if make must be run.
562 if [ "$RUNMAKE" = "1" ] ; then
563 # Build the system
564 if [ -e $MKFILE ] ; then
565 echo -ne "Building the LFS system\n"
566 cd $JHALFSDIR && make
567 echo -ne "done\n"
568 fi
569 fi
570}
571
572if [ ! -d $JHALFSDIR ] ; then
573 mkdir -p $JHALFSDIR
574fi
575
576if [ ! -d $BUILDDIR$LOGDIR ] ; then
577 mkdir $BUILDDIR$LOGDIR
578fi
579
580>$BUILDDIR$LOGDIR/$LOG
581
582if [ "$PWD" != "$JHALFSDIR" ] ; then
583 cp $0 $XSL $JHALFSDIR/
584fi
585
586get_book
587build_Makefile
588run_make
Note: See TracBrowser for help on using the repository browser.