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