source: CLFS/master.sh@ 659be15

2.4 ablfs-more legacy new_features trunk
Last change on this file since 659be15 was 179ae85, checked in by Pierre Labastie <pierre@…>, 11 years ago

Adapt instructions to new layout for "boot" method, while keeping
compatibility with older layouts. Joint work with W. Harrington

  • Property mode set to 100644
File size: 41.7 KB
Line 
1#!/bin/bash
2# $Id$
3
4
5orphan_scripts="" # 2 scripts do not fit BOOT_Makefiles LUSER environment
6
7
8#--------------------------------------#
9host_prep_Makefiles() { #
10#--------------------------------------#
11 local CLFS_HOST
12
13 echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
14
15 # defined here, only for ease of reading
16 CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
17(
18cat << EOF
19023-creatingtoolsdir:
20 @\$(call echo_message, Building)
21 @install -dv \$(MOUNT_PT)/tools && \\
22 rm -f /tools && \\
23 ln -s \$(MOUNT_PT)/tools /
24 @\$(call housekeeping)
25
26024-creatingcrossdir: 023-creatingtoolsdir
27 @\$(call echo_message, Building)
28 @install -dv \$(MOUNT_PT)/cross-tools && \\
29 rm -f /cross-tools && \\
30 ln -s \$(MOUNT_PT)/cross-tools /
31 @\$(call housekeeping)
32
33025-addinguser: 024-creatingcrossdir
34 @\$(call echo_message, Building)
35 @if [ ! -d \$(LUSER_HOME) ]; then \\
36 groupadd \$(LGROUP); \\
37 useradd -s /bin/bash -g \$(LGROUP) -d \$(LUSER_HOME) \$(LUSER); \\
38 mkdir -pv \$(LUSER_HOME); \\
39 chown -v \$(LUSER):\$(LGROUP) \$(LUSER_HOME); \\
40 else \\
41 touch luser-exist; \\
42 fi
43 @chown -v \$(LUSER) \$(MOUNT_PT)/tools && \\
44 chown -v \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
45 chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
46 chmod a+wt \$(SRCSDIR)
47 @\$(call housekeeping)
48
49026-settingenvironment: 025-addinguser
50 @\$(call echo_message, Building)
51 @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
52 mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
53 fi
54 @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
55 mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
56 fi;
57 @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
58 echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
59 echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
60 echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
61 echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
62 echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
63 echo "" >> \$(LUSER_HOME)/.bashrc && \\
64 echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
65 echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
66 echo "" >> \$(LUSER_HOME)/.bashrc && \\
67 echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
68 echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
69 echo "export CLFS_TARGET32=\"${TARGET32}\"" >> \$(LUSER_HOME)/.bashrc && \\
70 echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
71 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
72 chmod a+wt \$(MOUNT_PT) && \\
73 if [ -d \$(MOUNT_PT)/var ]; then \\
74 chown -R \$(LUSER) \$(MOUNT_PT)/var; \\
75 fi && \\
76 touch envars && \\
77 chown \$(LUSER):\$(LGROUP) envars
78 @\$(call housekeeping)
79EOF
80) >> $MKFILE.tmp
81 host_prep=" 023-creatingtoolsdir 024-creatingcrossdir 026-settingenvironment"
82
83}
84
85#--------------------------------------#
86cross_tools_Makefiles() { #
87#--------------------------------------#
88 echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
89
90 for file in cross-tools/* ; do
91 # Keep the script file name
92 this_script=`basename $file`
93 #
94 # Skip this script...
95 case $this_script in
96 *cflags* | *variables* ) # work done in host_prep_Makefiles
97 continue; ;;
98 *) ;;
99 esac
100 #
101 # Set the dependency for the first target.
102 if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
103
104 # First append each name of the script files to a list (this will become
105 # the names of the targets in the Makefile
106 cross_tools="$cross_tools $this_script"
107
108 # Grab the name of the target (minus the -headers or -cross in the case of gcc
109 # and binutils in chapter 5)
110 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
111 -e 's@-static@@' \
112 -e 's@-final@@' \
113 -e 's@-64@@' \
114 -e 's@-n32@@'`
115 pkg_tarball=$(get_package_tarball_name $name)
116
117 #--------------------------------------------------------------------#
118 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
119 #--------------------------------------------------------------------#
120 #
121 # Drop in the name of the target on a new line, and the previous target
122 # as a dependency. Also call the echo_message function.
123 LUSER_wrt_target "${this_script}" "$PREV"
124 #
125 # If $pkg_tarball isn't empty, we've got a package...
126 #
127 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
128 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = 3 ]] && wrt_makeflags "${name}"
129 #
130 LUSER_wrt_RunAsUser "${file}"
131 #
132 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
133 #
134 # Include a touch of the target name so make can check if it's already been made.
135 wrt_touch
136 #
137 #--------------------------------------------------------------------#
138 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
139 #--------------------------------------------------------------------#
140 #
141 # Keep the script file name for Makefile dependencies.
142 PREV=$this_script
143
144 done # for file in ....
145}
146
147#--------------------------------------#
148temptools_Makefiles() { #
149#--------------------------------------#
150 echo "${tab_}${GREEN}Processing... ${L_arrow}temp system ( LUSER ) ${R_arrow}"
151
152 for file in temp-system/* ; do
153 # Keep the script file name
154 this_script=`basename $file`
155 #
156 # Deal with any odd scripts..
157 case $this_script in
158 *choose) # The choose script will fail if you cannot enter the new environment
159 # If the 'boot' build method was chosen don't run the script
160 [[ $METHOD = "boot" ]] && continue; ;;
161 *) ;;
162 esac
163
164 #
165 # First append each name of the script files to a list (this will become
166 # the names of the targets in the Makefile
167 temptools="$temptools $this_script"
168
169 #
170 # Grab the name of the target, strip id number, XXX-script
171 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
172 #
173 pkg_tarball=$(get_package_tarball_name $name)
174
175 #--------------------------------------------------------------------#
176 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
177 #--------------------------------------------------------------------#
178 #
179 # Drop in the name of the target on a new line, and the previous target
180 # as a dependency. Also call the echo_message function.
181 LUSER_wrt_target "${this_script}" "$PREV"
182 #
183 # If $pkg_tarball isn't empty, we've got a package...
184 # Insert instructions for unpacking the package and to set the PKGDIR variable.
185 #
186 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
187 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
188 #
189 LUSER_wrt_RunAsUser "${file}"
190 #
191 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
192 #
193 # Include a touch of the target name so make can check if it's already been made.
194 wrt_touch
195 #
196 #--------------------------------------------------------------------#
197 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
198 #--------------------------------------------------------------------#
199 #
200 # Keep the script file name for Makefile dependencies.
201 PREV=$this_script
202 done # for file in ....
203}
204
205
206#--------------------------------------#
207chroot_Makefiles() { #
208#--------------------------------------#
209 echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools CHROOT ( CHROOT ) ${R_arrow}"
210
211 for file in chroot/* ; do
212 # Keep the script file name
213 this_script=`basename $file`
214 #
215 # Skipping scripts is done now and not included in the build tree.
216 case $this_script in
217 *chroot*) continue ;;
218 esac
219
220 #
221 # First append each name of the script files to a list (this will become
222 # the names of the targets in the Makefile
223 case "${this_script}" in
224 *kernfs) orphan_scripts="${orphan_scripts} ${this_script}" ;;
225 *) chroottools="$chroottools $this_script" ;;
226 esac
227
228 # Grab the name of the target, strip id number, XXX-script
229 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
230
231 pkg_tarball=$(get_package_tarball_name $name)
232
233 # This is very ugly:: util-linux is in /chroot but must be run under LUSER
234 # Same for e2fsprogs (in CLFS 1.1.0)
235 # .. Customized makefile entry
236 case "${this_script}" in
237 *util-linux)
238 LUSER_wrt_target "${this_script}" "$PREV"
239 LUSER_wrt_unpack "$pkg_tarball"
240 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
241 LUSER_wrt_RunAsUser "${file}"
242 LUSER_RemoveBuildDirs "${name}"
243 wrt_touch
244 temptools="$temptools $this_script"
245 continue ;;
246 *util-linux-ng)
247 LUSER_wrt_target "${this_script}" "$PREV"
248 LUSER_wrt_unpack "$pkg_tarball"
249 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
250 LUSER_wrt_RunAsUser "${file}"
251 LUSER_RemoveBuildDirs "${name}"
252 wrt_touch
253 temptools="$temptools $this_script"
254 continue ;;
255 *util-linux-libs)
256 LUSER_wrt_target "${this_script}" "$PREV"
257 LUSER_wrt_unpack "$pkg_tarball"
258 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
259 LUSER_wrt_RunAsUser "${file}"
260 LUSER_RemoveBuildDirs "${name}"
261 wrt_touch
262 temptools="$temptools $this_script"
263 continue ;;
264 *e2fsprogs)
265 LUSER_wrt_target "${this_script}" "$PREV"
266 LUSER_wrt_unpack "$pkg_tarball"
267 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
268 LUSER_wrt_RunAsUser "${file}"
269 LUSER_RemoveBuildDirs "${name}"
270 wrt_touch
271 temptools="$temptools $this_script"
272 continue ;;
273 *e2fsprogs-libs)
274 LUSER_wrt_target "${this_script}" "$PREV"
275 LUSER_wrt_unpack "$pkg_tarball"
276 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
277 LUSER_wrt_RunAsUser "${file}"
278 LUSER_RemoveBuildDirs "${name}"
279 wrt_touch
280 temptools="$temptools $this_script"
281 continue ;;
282 esac
283
284
285 #--------------------------------------------------------------------#
286 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
287 #--------------------------------------------------------------------#
288 #
289 # Drop in the name of the target on a new line, and the previous target
290 # as a dependency. Also call the echo_message function.
291 CHROOT_wrt_target "${this_script}" "$PREV"
292 #
293 # If $pkg_tarball isn't empty, we've got a package...
294 # Insert instructions for unpacking the package and changing directories
295 #
296 if [ "$pkg_tarball" != "" ] ; then
297 CHROOT_Unpack "$pkg_tarball"
298 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
299 fi
300 #
301 # Select a script execution method
302 case $this_script in
303 *kernfs) wrt_RunAsRoot "${file}" ;;
304 *) CHROOT_wrt_RunAsRoot "${file}" ;;
305 esac
306 #
307 # Housekeeping...remove the build directory(ies), except if the package build fails.
308 [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}"
309 #
310 # Include a touch of the target name so make can check if it's already been made.
311 wrt_touch
312 #
313 #--------------------------------------------------------------------#
314 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
315 #--------------------------------------------------------------------#
316 #
317 # Keep the script file name for Makefile dependencies.
318 PREV=$this_script
319
320 done # for file in...
321}
322
323
324#--------------------------------------#
325boot_Makefiles() { #
326#--------------------------------------#
327
328 echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools BOOT ( LUSER ) ${R_arrow}"
329 #
330 # Create a target bootable partition containing a compile environment. Later
331 # on we boot into this environment and contine the build.
332 #
333 for file in boot/* ; do
334 # Keep the script file name
335 this_script=`basename $file`
336
337 # A little housekeeping on the scripts
338 case $this_script in
339 *grub | *aboot | *colo | *silo | *arcload | *lilo | *introduction ) continue ;;
340 *how-to-view*) continue ;;
341 *whatnext*) continue ;;
342 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
343 *kernel) # if there is no kernel config file do not build the kernel
344 [[ -z $CONFIG ]] && continue
345 # Copy the config file to /sources with a standardized name
346 cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
347 ;;
348 esac
349 #
350 # First append each name of the script files to a list (this will become
351 # the names of the targets in the Makefile). Those names differ depending
352 # on the version of the book. What makes the difference between those
353 # versions is the presence of "how-to-view" in the boot chapter.
354 if [ -f boot/*how-to-view ]; then
355 case "${this_script}" in
356 *changingowner)
357 orphan_scripts="${orphan_scripts} ${this_script}"
358 ;;
359 *creatingdirs)
360 orphan_scripts="${orphan_scripts} ${this_script}"
361 ;;
362 *createfiles)
363 orphan_scripts="${orphan_scripts} ${this_script}"
364 ;;
365 *devices)
366 orphan_scripts="${orphan_scripts} ${this_script}"
367 ;;
368 *flags)
369 orphan_scripts="${orphan_scripts} ${this_script}"
370 ;;
371 *fstab)
372 orphan_scripts="${orphan_scripts} ${this_script}"
373 ;;
374 *pwdgroup)
375 orphan_scripts="${orphan_scripts} ${this_script}"
376 ;;
377 *settingenvironment)
378 orphan_scripts="${orphan_scripts} ${this_script}"
379 ;;
380 *)
381 boottools="$boottools $this_script"
382 ;;
383 esac
384 else
385 case "${this_script}" in
386 *changingowner)
387 orphan_scripts="${orphan_scripts} ${this_script}"
388 ;;
389 *devices)
390 orphan_scripts="${orphan_scripts} ${this_script}"
391 ;;
392 *)
393 boottools="$boottools $this_script"
394 ;;
395 esac
396 fi
397 #
398 # Grab the name of the target, strip id number and misc words.
399 case $this_script in
400 *kernel) name=linux ;;
401 *bootscripts) name="bootscripts-cross-lfs" ;;
402 *boot-scripts) name="boot-scripts-cross-lfs" ;;
403 *udev-rules) name="udev-cross-lfs" ;;
404 *grub-build) name=grub ;;
405 *-aboot-build) name=aboot ;;
406 *yaboot-build) name=yaboot ;;
407 *colo-build) name=colo ;;
408 *silo-build) name=silo ;;
409 *arcload-build) name=arcload ;;
410 *lilo-build) name=lilo ;;
411 *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
412 esac
413 # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
414 pkg_tarball=$(get_package_tarball_name $name)
415
416 #--------------------------------------------------------------------#
417 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
418 #--------------------------------------------------------------------#
419 #
420 # Drop in the name of the target on a new line, and the previous target
421 # as a dependency. Also call the echo_message function.
422 LUSER_wrt_target "${this_script}" "$PREV"
423 #
424 # If $pkg_tarball isn't empty, we've got a package...
425 # Insert instructions for unpacking the package and changing directories
426 #
427 [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
428 [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
429 #
430 # Select a script execution method
431 if [ -f boot/*how-to-view ]; then
432 case $this_script in
433 # The following 8 scripts are defined in the /boot directory but need
434 # to be run as a root user. Set them up here but run them in another
435 # phase
436 *changingowner) wrt_RunAsRoot "${file}" ;;
437 *creatingdirs) wrt_RunAsRoot "${file}" ;;
438 *createfiles) wrt_RunAsRoot "${file}" ;;
439 *devices) wrt_RunAsRoot "${file}" ;;
440 *flags) wrt_RunAsRoot "${file}" ;;
441 *fstab)
442 if [[ -n "$FSTAB" ]]; then
443 LUSER_wrt_CopyFstab
444 else
445 wrt_RunAsRoot "${file}"
446 fi
447 ;;
448 *pwdgroup) wrt_RunAsRoot "${file}" ;;
449 *settingenvironment) wrt_RunAsRoot "${file}" ;;
450 *) LUSER_wrt_RunAsUser "${file}" ;;
451 esac
452 else
453 case $this_script in
454 # The following 2 scripts are defined in the /boot directory but need
455 # to be run as a root user. Set them up here but run them in another
456 # phase
457 *changingowner) wrt_RunAsRoot "${file}" ;;
458 *devices) wrt_RunAsRoot "${file}" ;;
459 *fstab)
460 if [[ -n "$FSTAB" ]]; then
461 LUSER_wrt_CopyFstab
462 else
463 LUSER_wrt_RunAsUser "${file}"
464 fi
465 ;;
466 *) LUSER_wrt_RunAsUser "${file}" ;;
467 esac
468 fi
469 #
470 # Housekeeping...remove any build directory(ies) except if the package build fails.
471 [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
472 #
473 # Include a touch of the target name so make can check if it's already been made.
474 wrt_touch
475 #
476 #--------------------------------------------------------------------#
477 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
478 #--------------------------------------------------------------------#
479 #
480 # Keep the script file name for Makefile dependencies.
481 PREV=$this_script
482
483 done
484}
485
486
487#--------------------------------------#
488testsuite_tools_Makefiles() { #
489#--------------------------------------#
490
491 if [[ "${METHOD}" = "chroot" ]]; then
492 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools ( CHROOT ) ${R_arrow}"
493 else
494 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools ( ROOT ) ${R_arrow}"
495 PREV=""
496 fi
497
498 for file in testsuite-tools/* ; do
499 # Keep the script file name
500 this_script=`basename $file`
501
502 # First append each name of the script files to a list (this will become
503 # the names of the targets in the Makefile
504 testsuitetools="$testsuitetools $this_script"
505
506 # Grab the name of the target, strip id number, XXX-script
507 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
508 -e 's@-64bit@@' \
509 -e 's@-64@@' \
510 -e 's@64@@' \
511 -e 's@n32@@'`
512
513 pkg_tarball=$(get_package_tarball_name $name)
514
515 #--------------------------------------------------------------------#
516 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
517 #--------------------------------------------------------------------#
518 #
519 # Drop in the name of the target on a new line, and the previous target
520 # as a dependency. Also call the echo_message function.
521 CHROOT_wrt_target "${this_script}" "$PREV"
522 #
523 CHROOT_Unpack "$pkg_tarball"
524 [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
525 #
526 CHROOT_wrt_RunAsRoot "${file}"
527 #
528 CHROOT_wrt_RemoveBuildDirs "${name}"
529 #
530 # Include a touch of the target name so make can check if it's already been made.
531 wrt_touch
532 #
533 #--------------------------------------------------------------------#
534 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
535 #--------------------------------------------------------------------#
536 #
537 # Keep the script file name for Makefile dependencies.
538 PREV=$this_script
539
540 done
541}
542
543
544#--------------------------------------#
545final_system_Makefiles() { #
546#--------------------------------------#
547 # Set envars and scripts for iteration targets
548 if [[ -z "$1" ]] ; then
549 local N=""
550 # In boot method the makesys phase was initiated in testsuite_tools_makefile
551 [[ "${METHOD}" = "boot" ]] && [[ "$TEST" = 0 ]] && PREV=""
552 else
553 local N=-build_$1
554 local basicsystem=""
555 mkdir final-system$N
556 cp final-system/* final-system$N
557 for script in final-system$N/* ; do
558 # Overwrite existing symlinks, files, and dirs
559 sed -e 's/ln -sv/&f/g' \
560 -e 's/mv -v/&f/g' \
561 -e 's/mkdir -v/&p/g' -i ${script}
562 # Rename the scripts
563 mv ${script} ${script}$N
564 done
565 # Remove Bzip2 binaries before make install (CLFS-1.0 compatibility)
566 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2$N
567 # Delete *old Readline libraries just after make install
568 sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline$N
569 fi
570
571 if [[ "${METHOD}" = "chroot" ]]; then
572 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N ( CHROOT ) ${R_arrow}"
573 else
574 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N ( ROOT ) ${R_arrow}"
575 fi
576
577 for file in final-system$N/* ; do
578 # Keep the script file name
579 this_script=`basename $file`
580
581 # Test if the stripping phase must be skipped.
582 # Skip also temp-perl for iterative runs
583 case $this_script in
584 *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
585 *temp-perl*) [[ -n "$N" ]] && continue ;;
586 esac
587
588 # Grab the name of the target, strip id number, XXX-script.
589 # name1 is partially stripped and should be used for logging files.
590 # name is completely stripped and is used for grabbing
591 # the package name.
592 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
593 -e 's,'$N',,'`
594 name=`echo $name1 | sed -e 's@temp-@@' \
595 -e 's@-64bit@@' \
596 -e 's@-64@@' \
597 -e 's@64@@' \
598 -e 's@n32@@'`
599
600 # Find the version of the command files, if it corresponds with the building of
601 # a specific package. We need this here to can skip scripts not needed for
602 # iterations rebuilds
603 pkg_tarball=$(get_package_tarball_name $name)
604
605 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
606 case "${this_script}" in
607 *stripping*) ;;
608 *) continue ;;
609 esac
610 fi
611
612 # Append each name of the script files to a list (this will become
613 # the names of the targets in the Makefile
614 basicsystem="$basicsystem ${this_script}"
615
616 #--------------------------------------------------------------------#
617 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
618 #--------------------------------------------------------------------#
619 #
620 # Drop in the name of the target on a new line, and the previous target
621 # as a dependency. Also call the echo_message function.
622 CHROOT_wrt_target "${this_script}" "$PREV"
623
624 # If $pkg_tarball isn't empty, we've got a package...
625 if [ "$pkg_tarball" != "" ] ; then
626 # Touch timestamp file if installed files logs will be created.
627 # But only for the firt build when running iterative builds.
628 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
629 CHROOT_wrt_TouchTimestamp
630 fi
631 CHROOT_Unpack "$pkg_tarball"
632 # If the testsuites must be run, initialize the log file
633 case $name in
634 binutils | gcc | glibc | eglibc | gmp | mpfr | mpc | isl | cloog )
635 [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
636 ;;
637 * )
638 [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
639 ;;
640 esac
641 # If using optimizations, write the instructions
642 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
643 fi
644 #
645 CHROOT_wrt_RunAsRoot "${file}"
646 #
647 # Write installed files log and remove the build directory(ies)
648 # except if the package build fails.
649 if [ "$pkg_tarball" != "" ] ; then
650 CHROOT_wrt_RemoveBuildDirs "$name"
651 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
652 CHROOT_wrt_LogNewFiles "$name1"
653 fi
654 fi
655 #
656 # Include a touch of the target name so make can check
657 # if it's already been made.
658 wrt_touch
659 #
660 #--------------------------------------------------------------------#
661 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
662 #--------------------------------------------------------------------#
663 #
664 # Keep the script file name for Makefile dependencies.
665 PREV=${this_script}
666 # Set system_build envar for iteration targets
667 system_build=$basicsystem
668 done # for file in final-system/* ...
669}
670
671#--------------------------------------#
672bootscripts_Makefiles() { #
673#--------------------------------------#
674
675# New versions of the book do not have bootscripts anymore
676# (use systemd configuration files)
677# Define a variable to be used for the right script directory to parse
678 if [ -d bootscripts ]; then
679 config="bootscripts"
680 else
681 config="system-config"
682 fi
683
684 if [[ "${METHOD}" = "chroot" ]]; then
685 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) $config ( CHROOT ) ${R_arrow}"
686 else
687 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) $config ( ROOT ) ${R_arrow}"
688 fi
689
690 for file in $config/* ; do
691 # Keep the script file name
692 this_script=`basename $file`
693
694 case $this_script in
695 *udev) continue ;; # This is not a script but a commentary, we want udev-rules
696 *console*) continue ;; # Use the files that came with the bootscripts
697 *) ;;
698 esac
699
700 # First append each name of the script files to a list (this will become
701 # the names of the targets in the Makefile
702 bootscripttools="$bootscripttools $this_script"
703
704 # Grab the name of the target, strip id number, XXX-script.
705 # name1 is partially stripped and should be used for logging files.
706 # name is completely stripped and is used for grabbing
707 # the package name.
708 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
709 name=`echo $name1 | sed -e 's@-64bit@@' \
710 -e 's@-64@@' \
711 -e 's@64@@' \
712 -e 's@n32@@'`
713 case $name in
714 *bootscripts*) name=bootscripts-cross-lfs ;;
715 *udev-rules) name=udev-cross-lfs ;;
716 esac
717
718 pkg_tarball=$(get_package_tarball_name $name)
719
720 #--------------------------------------------------------------------#
721 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
722 #--------------------------------------------------------------------#
723 #
724 # Drop in the name of the target on a new line, and the previous target
725 # as a dependency. Also call the echo_message function.
726 CHROOT_wrt_target "${this_script}" "$PREV"
727 #
728 # If $pkg_tarball isn't empty, we've got a package...
729 #
730 if [ "$pkg_tarball" != "" ] ; then
731 if [ "${INSTALL_LOG}" = "y" ] ; then
732 CHROOT_wrt_TouchTimestamp
733 fi
734 CHROOT_Unpack "$pkg_tarball"
735 fi
736 #
737 CHROOT_wrt_RunAsRoot "${file}"
738 #
739 # Write installed files log and remove the build directory(ies)
740 # except if the package build fails.
741 if [ "$pkg_tarball" != "" ] ; then
742 CHROOT_wrt_RemoveBuildDirs "$name"
743 if [ "${INSTALL_LOG}" = "y" ] ; then
744 CHROOT_wrt_LogNewFiles "$name1"
745 fi
746 fi
747 #
748 # Include a touch of the target name so make can check if it's already been made.
749 wrt_touch
750 #
751 #--------------------------------------------------------------------#
752 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
753 #--------------------------------------------------------------------#
754 #
755 # Keep the script file name for Makefile dependencies.
756 PREV=$this_script
757
758 done # for file in bootscripts/* ...
759}
760
761#--------------------------------------#
762network_Makefiles() { #
763#--------------------------------------#
764
765 if [[ "${METHOD}" = "chroot" ]]; then
766 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) network ( CHROOT ) ${R_arrow}"
767 else
768 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) network ( ROOT ) ${R_arrow}"
769 fi
770
771 for file in network/* ; do
772 # Keep the script file name
773 this_script=`basename $file`
774
775 case $this_script in
776 *choose) continue ;; # This is not a script but a commentary.
777 *dhcp) continue ;; # Assume static networking.
778 *dhcpcd) continue ;; # Assume static networking.
779 *) ;;
780 esac
781
782 # First append each name of the script files to a list (this will become
783 # the names of the targets in the Makefile
784 networktools="$networktools $this_script"
785
786 # Grab the name of the target, strip id number, XXX-script
787 # name1 is partially stripped and should be used for logging files.
788 # name is completely stripped and is used for grabbing
789 # the package name.
790 name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
791 name=`echo $name1 | sed -e 's@-64bit@@' \
792 -e 's@-64@@' \
793 -e 's@64@@' \
794 -e 's@n32@@'`
795 case $name in
796 network-scripts) name=clfs-network-scripts ;;
797 esac
798
799 pkg_tarball=$(get_package_tarball_name $name)
800
801 #--------------------------------------------------------------------#
802 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
803 #--------------------------------------------------------------------#
804 #
805 # Drop in the name of the target on a new line, and the previous target
806 # as a dependency. Also call the echo_message function.
807 CHROOT_wrt_target "${this_script}" "$PREV"
808 #
809 # If $pkg_tarball isn't empty, we've got a package...
810 #
811 if [ "$pkg_tarball" != "" ] ; then
812 if [ "${INSTALL_LOG}" = "y" ] ; then
813 CHROOT_wrt_TouchTimestamp
814 fi
815 CHROOT_Unpack "$pkg_tarball"
816 fi
817 #
818 CHROOT_wrt_RunAsRoot "${file}"
819 #
820 # Write installed files log and remove the build directory(ies)
821 # except if the package build fails.
822 if [ "$pkg_tarball" != "" ] ; then
823 CHROOT_wrt_RemoveBuildDirs "$name"
824 if [ "${INSTALL_LOG}" = "y" ] ; then
825 CHROOT_wrt_LogNewFiles "$name1"
826 fi
827 fi
828 #
829 # Include a touch of the target name so make can check if it's already been made.
830 wrt_touch
831 #
832 #--------------------------------------------------------------------#
833 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
834 #--------------------------------------------------------------------#
835 #
836 # Keep the script file name for Makefile dependencies.
837 PREV=$this_script
838
839 done # for file in network/* ...
840}
841
842#--------------------------------------#
843bootable_Makefiles() { #
844#--------------------------------------#
845
846 if [[ "${METHOD}" = "chroot" ]]; then
847 echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}"
848 else
849 echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable ( ROOT ) ${R_arrow}"
850 fi
851
852
853 for file in bootable/* ; do
854 # Keep the script file name
855 this_script=`basename $file`
856
857 # A little housekeeping on the scripts
858 case $this_script in
859 *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
860 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
861 *kernel) # if there is no kernel config file do not build the kernel
862 [[ -z $CONFIG ]] && continue
863 # Copy the config file to /sources with a standardized name
864 cp $CONFIG $BUILDDIR/sources/kernel-config
865 ;;
866 esac
867 #
868 # First append each name of the script files to a list (this will become
869 # the names of the targets in the Makefile
870 bootabletools="$bootabletools $this_script"
871 #
872 # Grab the name of the target, strip id number and misc words.
873 name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
874 case $this_script in
875 *kernel*) name=linux
876 ;;
877 esac
878
879 pkg_tarball=$(get_package_tarball_name $name)
880
881 #--------------------------------------------------------------------#
882 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
883 #--------------------------------------------------------------------#
884 #
885 # Drop in the name of the target on a new line, and the previous target
886 # as a dependency. Also call the echo_message function.
887 CHROOT_wrt_target "${this_script}" "$PREV"
888 #
889 # If $pkg_tarball isn't empty, we've got a package...
890 # Insert instructions for unpacking the package and changing directories
891 #
892 if [ "$pkg_tarball" != "" ] ; then
893 if [ "${INSTALL_LOG}" = "y" ] ; then
894 CHROOT_wrt_TouchTimestamp
895 fi
896 CHROOT_Unpack "$pkg_tarball"
897 fi
898 #
899 # Select a script execution method
900 case $this_script in
901 *fstab*) if [[ -n "$FSTAB" ]]; then
902 CHROOT_wrt_CopyFstab
903 else
904 CHROOT_wrt_RunAsRoot "${file}"
905 fi
906 ;;
907 *) CHROOT_wrt_RunAsRoot "${file}"
908 ;;
909 esac
910 #
911 # Write installed files log and remove the build directory(ies)
912 # except if the package build fails.
913 if [ "$pkg_tarball" != "" ] ; then
914 CHROOT_wrt_RemoveBuildDirs "$name"
915 if [ "${INSTALL_LOG}" = "y" ] ; then
916 CHROOT_wrt_LogNewFiles "$name"
917 fi
918 fi
919 #
920 # Include a touch of the target name so make can check if it's already been made.
921 wrt_touch
922 #
923 #--------------------------------------------------------------------#
924 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
925 #--------------------------------------------------------------------#
926 #
927 # Keep the script file name for Makefile dependencies.
928 PREV=$this_script
929
930 done
931
932}
933
934
935#--------------------------------------#
936build_Makefile() { # Construct a Makefile from the book scripts
937#--------------------------------------#
938
939 echo "...Creating Makefile... ${BOLD}START${OFF}"
940
941 cd $JHALFSDIR/${PROGNAME}-commands
942 # Start with clean files
943 >$MKFILE
944 >$MKFILE.tmp
945
946 method_cmds=${METHOD}_Makefiles
947
948 host_prep_Makefiles # mk_SETUP (SETUP) $host_prep
949 cross_tools_Makefiles # mk_CROSS (LUSER) $cross_tools
950 temptools_Makefiles # mk_TEMP (LUSER) $temptools
951 $method_cmds # mk_SYSTOOLS (CHROOT) $chroottools/$boottools
952 if [[ ! $TEST = "0" ]]; then
953 testsuite_tools_Makefiles # mk_SYSTOOLS (CHROOT) $testsuitetools
954 fi
955 final_system_Makefiles # mk_FINAL (CHROOT) $basicsystem
956 # Add the iterations targets, if needed
957 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
958 bootscripts_Makefiles # mk_BOOTSCRIPT (CHROOT) $bootscripttools
959 if [ -d network ]; then
960 network_Makefiles # If present, process network setup.
961 fi
962 bootable_Makefiles # mk_BOOTABLE (CHROOT) $bootabletools
963
964 # Add the CUSTOM_TOOLS targets, if needed
965 [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
966
967 # Add a header, some variables and include the function file
968 # to the top of the real Makefile.
969 wrt_Makefile_header
970
971 # Add chroot commands
972 if [ "$METHOD" = "chroot" ] ; then
973 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
974 chroot=`cat chroot/???-chroot | \
975 sed -e "s@chroot@$CHROOT_LOC@" \
976 -e '/#!\/bin\/bash/d' \
977 -e '/^export/d' \
978 -e '/^logout/d' \
979 -e 's@ \\\@ @g' | \
980 tr -d '\n' | \
981 sed -e 's/ */ /g' \
982 -e 's|\\$|&&|g' \
983 -e 's|exit||g' \
984 -e 's|$| -c|' \
985 -e 's|"$${CLFS}"|$(MOUNT_PT)|'\
986 -e 's|set -e||' \
987 -e 's|set +h||'`
988 echo -e "CHROOT1= $chroot\n" >> $MKFILE
989 fi
990
991################## CHROOT ####################
992
993if [[ "${METHOD}" = "chroot" ]]; then
994(
995cat << EOF
996
997all: ck_UID mk_SETUP mk_CROSS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
998 @sudo make do-housekeeping
999 @echo "$VERSION - jhalfs build" > clfs-release && \\
1000 sudo mv clfs-release \$(MOUNT_PT)/etc && \\
1001 sudo chown root:root \$(MOUNT_PT)/etc/clfs-release
1002 @\$(call echo_finished,$VERSION)
1003
1004ck_UID:
1005 @if [ \`id -u\` = "0" ]; then \\
1006 echo "+--------------------------------------------------+"; \\
1007 echo "|You cannot run this makefile from the root account|"; \\
1008 echo "+--------------------------------------------------+"; \\
1009 exit 1; \\
1010 fi
1011
1012#---------------AS ROOT
1013mk_SETUP:
1014 @\$(call echo_SU_request)
1015 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
1016 @touch \$@
1017
1018#---------------AS LUSER
1019mk_CROSS: mk_SETUP
1020 @\$(call echo_PHASE,Cross and Temporary Tools)
1021 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
1022 @sudo make restore-luser-env
1023 @touch \$@
1024
1025mk_SUDO: mk_CROSS
1026 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
1027 @touch \$@
1028
1029#---------------CHROOT JAIL
1030mk_SYSTOOLS: mk_SUDO
1031 @\$(call echo_CHROOT_request)
1032 @\$(call echo_PHASE, CHROOT JAIL )
1033 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) PREP_CHROOT_JAIL")
1034 @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT_JAIL")
1035 @touch \$@
1036
1037mk_BLFS_TOOL: create-sbu_du-report
1038 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
1039 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
1040 (sudo \$(CHROOT1) "make -C $BLFS_ROOT/work"); \\
1041 fi;
1042 @touch \$@
1043
1044mk_CUSTOM_TOOLS: mk_BLFS_TOOL
1045 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
1046 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
1047 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
1048 (sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
1049 fi;
1050 @touch \$@
1051
1052SETUP: $host_prep
1053AS_LUSER: $cross_tools $temptools
1054SUDO: $orphan_scripts
1055PREP_CHROOT_JAIL: SHELL=/tools/bin/bash
1056PREP_CHROOT_JAIL: ${chroottools}
1057CHROOT_JAIL: SHELL=/tools/bin/bash
1058CHROOT_JAIL: $testsuitetools $basicsystem $bootscripttools $bootabletools
1059CUSTOM_TOOLS: $custom_list
1060
1061
1062create-sbu_du-report: mk_SYSTOOLS
1063 @\$(call echo_message, Building)
1064 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
1065 ./create-sbu_du-report.sh logs $VERSION; \\
1066 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
1067 fi;
1068 @touch \$@
1069
1070do-housekeeping:
1071 @-umount \$(MOUNT_PT)/dev/pts
1072 @-if [ -h \$(MOUNT_PT)/dev/shm ]; then \\
1073 link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
1074 umount \$(MOUNT_PT)/\$\$link; \\
1075 unset link; \\
1076 else \\
1077 umount \$(MOUNT_PT)/dev/shm; \\
1078 fi
1079 @-umount \$(MOUNT_PT)/dev
1080 @-umount \$(MOUNT_PT)/sys
1081 @-umount \$(MOUNT_PT)/proc
1082 @-rm /tools /cross-tools
1083 @-if [ ! -f luser-exist ]; then \\
1084 userdel \$(LUSER); \\
1085 rm -rf \$(LUSER_HOME); \\
1086 fi;
1087
1088EOF
1089) >> $MKFILE
1090
1091fi
1092
1093################### BOOT #####################
1094
1095if [[ "${METHOD}" = "boot" ]]; then
1096(
1097cat << EOF
1098
1099all: ck_UID mk_SETUP mk_CROSS mk_SUDO
1100 @sudo make restore-luser-env
1101 @sudo make do-housekeeping
1102 @\$(call echo_boot_finished,$VERSION)
1103
1104makesys: mk_FINAL mk_CUSTOM_TOOLS mk_BLFS_TOOL
1105 @echo "$VERSION - jhalfs build" > /etc/clfs-release
1106 @\$(call echo_finished,$VERSION)
1107
1108
1109ck_UID:
1110 @if [ \`id -u\` = "0" ]; then \\
1111 echo "+--------------------------------------------------+"; \\
1112 echo "|You cannot run this makefile from the root account|"; \\
1113 echo "|However, if this is the boot environment |"; \\
1114 echo "| the command you are looking for is |"; \\
1115 echo "| make makesys |"; \\
1116 echo "| to complete the build |"; \\
1117 echo "+--------------------------------------------------+"; \\
1118 exit 1; \\
1119 fi
1120
1121#---------------AS ROOT
1122
1123mk_SETUP:
1124 @\$(call echo_SU_request)
1125 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
1126 @touch \$@
1127
1128#---------------AS LUSER
1129
1130mk_CROSS: mk_SETUP
1131 @\$(call echo_PHASE,Cross Tool)
1132 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
1133 @touch \$@
1134
1135mk_SUDO: mk_CROSS
1136 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
1137 @touch \$@
1138
1139#---------------AS ROOT
1140
1141mk_FINAL:
1142 @\$(call echo_PHASE,Final System)
1143 @( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) AS_ROOT )
1144 @touch \$@
1145
1146mk_BLFS_TOOL: mk_FINAL
1147 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
1148 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
1149 ( make -C $BLFS_ROOT/work ); \\
1150 fi;
1151 @touch \$@
1152
1153mk_CUSTOM_TOOLS: mk_BLFS_TOOL
1154 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
1155 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
1156 mkdir -p ${TRACKING_DIR}; \\
1157 ( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS ); \\
1158 fi;
1159 @touch \$@
1160
1161SETUP: $host_prep
1162AS_LUSER: $cross_tools $temptools ${boottools}
1163SUDO: $orphan_scripts
1164AS_ROOT: SHELL=/tools/bin/bash
1165AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools
1166CUSTOM_TOOLS: $custom_list
1167
1168do-housekeeping:
1169 @-rm /tools /cross-tools
1170 @-if [ ! -f luser-exist ]; then \\
1171 userdel \$(LUSER); \\
1172 rm -rf \$(LUSER_HOME); \\
1173 fi;
1174
1175EOF
1176) >> $MKFILE
1177fi
1178
1179(
1180 cat << EOF
1181
1182restore-luser-env:
1183 @\$(call echo_message, Building)
1184 @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
1185 mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
1186 fi;
1187 @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
1188 mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
1189 fi;
1190 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
1191 touch \$@ && \\
1192 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
1193 echo --------------------------------------------------------------------------------\$(WHITE)
1194
1195########################################################
1196
1197
1198EOF
1199) >> $MKFILE
1200
1201 # Bring over the items from the Makefile.tmp
1202 cat $MKFILE.tmp >> $MKFILE
1203 rm $MKFILE.tmp
1204
1205 echo "Creating Makefile... ${BOLD}DONE${OFF}"
1206}
Note: See TracBrowser for help on using the repository browser.