source: LFS/master.sh@ 67c3df4

ablfs-more legacy trunk
Last change on this file since 67c3df4 was 84a3fda, checked in by Pierre Labastie <pierre@…>, 7 years ago

Do not optimize binutils-pass1 in order to measure the SBU:

  • introduce REALSBU variable if Config.in and jhalfs, and display it
  • Adpat LFS/master.sh
  • Property mode set to 100644
File size: 20.6 KB
Line 
1#!/bin/bash
2
3# $Id$
4
5###################################
6### FUNCTIONS ###
7###################################
8
9
10#############################################################
11
12
13#----------------------------#
14chapter4_Makefiles() { #
15#----------------------------#
16 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}"
17
18# If $LUSER_HOME is already present in the host, we asume that the
19# lfs user and group are also presents in the host, and a backup
20# of their bash init files is made.
21(
22 cat << EOF
23020-creatingtoolsdir:
24 @\$(call echo_message, Building)
25 @mkdir \$(MOUNT_PT)/tools && \\
26 rm -f /tools && \\
27 ln -s \$(MOUNT_PT)/tools /
28 @\$(call housekeeping)
29
30021-addinguser: 020-creatingtoolsdir
31 @\$(call echo_message, Building)
32 @-if [ ! -d \$(LUSER_HOME) ]; then \\
33 groupadd \$(LGROUP); \\
34 useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
35 else \\
36 touch luser-exist; \\
37 fi;
38 @chown \$(LUSER) \$(MOUNT_PT)/tools && \\
39 chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
40 chmod a+wt \$(SRCSDIR)
41 @\$(call housekeeping)
42
43022-settingenvironment: 021-addinguser
44 @\$(call echo_message, Building)
45 @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
46 mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
47 fi;
48 @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
49 mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
50 fi;
51 @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
52 echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
53 echo "LFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
54 echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
55 echo "LFS_TGT=`uname -m`-lfs-linux-gnu" >> \$(LUSER_HOME)/.bashrc && \\
56 echo "PATH=/tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
57 echo "export LFS LC_ALL LFS_TGT PATH" >> \$(LUSER_HOME)/.bashrc && \\
58 echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc && \\
59 chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
60 touch envars && \\
61 chown \$(LUSER) envars
62 @\$(call housekeeping)
63EOF
64) > $MKFILE.tmp
65
66 chapter4=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
67}
68
69
70
71#----------------------------#
72chapter5_Makefiles() {
73#----------------------------#
74 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}"
75
76 for file in chapter05/* ; do
77 # Keep the script file name
78 this_script=`basename $file`
79
80 # If no testsuites are run, then TCL, Expect, DejaGNU and Check
81 # aren't needed (but building them does not hurt).
82 # Fix also locales creation when running chapter05 testsuites (ugly)
83 case "${this_script}" in
84# *tcl) [[ "${TEST}" = "0" ]] && continue ;;
85# *expect) [[ "${TEST}" = "0" ]] && continue ;;
86# *dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
87# *check) [[ "${TEST}" = "0" ]] && continue ;;
88# We now do that in LFS.xsl, because stripping.xml contains other cleaning
89# instructions
90# *stripping) [[ "${STRIP}" = "n" ]] && continue ;;
91 *glibc) [[ "${TEST}" = "3" ]] && \
92 sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
93 esac
94
95 # First append each name of the script files to a list (this will become
96 # the names of the targets in the Makefile
97 # DO NOT append the changingowner script, it need be run as root.
98 # A hack is necessary: create script in chap5 BUT run as a dependency for
99 # SUDO target
100 case "${this_script}" in
101 *changingowner) runasroot="$runasroot ${this_script}" ;;
102 *) chapter5="$chapter5 ${this_script}" ;;
103 esac
104
105 # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
106 # and binutils in chapter 5)
107 name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' \
108 -e 's@-pass[0-9]\{1\}@@' \
109 -e 's@-libstdc++@@'`
110
111 # Set the dependency for the first target.
112 if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
113
114 #--------------------------------------------------------------------#
115 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
116 #--------------------------------------------------------------------#
117 #
118 # Find the name of the tarball and the version of the package
119 pkg_tarball=$(get_package_tarball_name $name)
120 pkg_version=$(get_package_version $pkg_tarball)
121
122 # Drop in the name of the target on a new line, and the previous target
123 # as a dependency. Also call the echo_message function.
124 LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version"
125
126 # If $pkg_tarball isn't empty, we've got a package...
127 if [ "$pkg_tarball" != "" ] ; then
128 # Insert instructions for unpacking the package and to set the PKGDIR variable.
129 LUSER_wrt_unpack "$pkg_tarball"
130 # Always initialize the log file, since the test instructions may be
131 # "uncommented" by the user
132 LUSER_wrt_test_log "${this_script}" "$pkg_version"
133 # If using optimizations, write the instructions
134 case "${OPTIMIZE}${this_script}${REALSBU}" in
135 *binutils-pass1y) ;;
136 2*) wrt_optimize "$name" && wrt_makeflags "$name" ;;
137 *) ;;
138 esac
139 fi
140
141 # Insert date and disk usage at the top of the log file, the script run
142 # and date and disk usage again at the bottom of the log file.
143 # The changingowner script must be run as root.
144 case "${this_script}" in
145 *changingowner) wrt_RunAsRoot "$file" "$pkg_version" ;;
146 *) LUSER_wrt_RunAsUser "$file" "$pkg_version" ;;
147 esac
148
149 # Remove the build directory(ies) except if the package build fails
150 # (so we can review config.cache, config.log, etc.)
151 if [ "$pkg_tarball" != "" ] ; then
152 case "${name}" in
153 *xz-utils) LUSER_RemoveBuildDirs "xz" ;;
154 *) LUSER_RemoveBuildDirs "$name" ;;
155 esac
156 fi
157
158 # Include a touch of the target name so make can check
159 # if it's already been made.
160 wrt_touch
161 #
162 #--------------------------------------------------------------------#
163 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
164 #--------------------------------------------------------------------#
165
166 # Keep the script file name for Makefile dependencies.
167 PREV=${this_script}
168 done # end for file in chapter05/*
169}
170
171
172#----------------------------#
173chapter6_Makefiles() {
174#----------------------------#
175
176 # Set envars and scripts for iteration targets
177 if [[ -z "$1" ]] ; then
178 local N=""
179 else
180 local N=-build_$1
181 local chapter6=""
182 mkdir chapter06$N
183 cp chapter06/* chapter06$N
184 for script in chapter06$N/* ; do
185 # Overwrite existing symlinks, files, and dirs
186 sed -e 's/ln *-sv/&f/g' \
187 -e 's/mv *-v/&f/g' \
188 -e 's/mkdir *-v/&p/g' -i ${script}
189 # Suppress the mod of "test-installation.pl" because now
190 # the library path points to /usr/lib
191 if [[ ${script} =~ glibc ]]; then
192 sed '/DL=/,/unset DL/d' -i ${script}
193 fi
194 # Rename the scripts
195 mv ${script} ${script}$N
196 done
197 # Remove Bzip2 binaries before make install (LFS-6.2 compatibility)
198 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2$N
199 fi
200
201 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
202
203 for file in chapter06$N/* ; do
204 # Keep the script file name
205 this_script=`basename $file`
206
207 # Skip the "stripping" scripts if the user does not want to strip.
208 # Skip also linux-headers in iterative builds.
209 case "${this_script}" in
210 *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
211 *linux-headers*) [[ -n "$N" ]] && continue ;;
212 esac
213
214 # Grab the name of the target.
215 name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`
216
217 # Find the tarball corresponding to our script.
218 # If it doesn't, we skip it in iterations rebuilds (except stripping).
219 pkg_tarball=$(get_package_tarball_name $name)
220 pkg_version=$(get_package_version $pkg_tarball)
221
222 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
223 case "${this_script}" in
224 *stripping*) ;;
225 *) continue ;;
226 esac
227 fi
228
229 # Append each name of the script files to a list (this will become
230 # the names of the targets in the Makefile)
231 # The kernfs script must be run as part of SUDO target.
232 case "${this_script}" in
233 *kernfs) runasroot="$runasroot ${this_script}" ;;
234 *) chapter6="$chapter6 ${this_script}" ;;
235 esac
236
237 #--------------------------------------------------------------------#
238 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
239 #--------------------------------------------------------------------#
240 #
241 # Drop in the name of the target on a new line, and the previous target
242 # as a dependency. Also call the echo_message function.
243 # In the mount of kernel filesystems we need to set LFS
244 # and not to use chroot.
245 case "${this_script}" in
246 *kernfs) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
247 *) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
248 esac
249
250 # If $pkg_tarball isn't empty, we've got a package...
251 # Insert instructions for unpacking the package and changing directories
252 if [ "$pkg_tarball" != "" ] ; then
253 # Touch timestamp file if installed files logs will be created.
254 # But only for the firt build when running iterative builds.
255 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
256 CHROOT_wrt_TouchTimestamp
257 fi
258 CHROOT_Unpack "$pkg_tarball"
259 # Always initialize the log file, so that the use may reinstate a
260 # commented out test
261 CHROOT_wrt_test_log "${this_script}" "$pkg_version"
262 # If using optimizations, write the instructions
263 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
264 fi
265
266 # In the mount of kernel filesystems we need to set LFS
267 # and not to use chroot.
268 case "${this_script}" in
269 *kernfs) wrt_RunAsRoot "$file" "$pkg_version" ;;
270 *) CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
271 esac
272
273 # Write installed files log and remove the build directory(ies)
274 # except if the package build fails.
275 if [ "$pkg_tarball" != "" ] ; then
276 case "${name}" in
277 *xz-utils) CHROOT_wrt_RemoveBuildDirs "xz" ;;
278 *) CHROOT_wrt_RemoveBuildDirs "$name" ;;
279 esac
280 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
281 CHROOT_wrt_LogNewFiles "$name"
282 fi
283 fi
284
285 # Include a touch of the target name so make can check
286 # if it's already been made.
287 wrt_touch
288 #
289 #--------------------------------------------------------------------#
290 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
291 #--------------------------------------------------------------------#
292
293 # Keep the script file name for Makefile dependencies.
294 PREV=${this_script}
295 # Set system_build envar for iteration targets
296 system_build=$chapter6
297 done # end for file in chapter06/*
298}
299
300#----------------------------#
301chapter78_Makefiles() {
302#----------------------------#
303 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8 ( BOOT ) ${R_arrow}"
304
305 for file in chapter0{7,8}/* ; do
306 # Keep the script file name
307 this_script=`basename $file`
308
309 # Grub must be configured manually.
310 # Handle fstab creation.
311 # If no .config file is supplied, the kernel build is skipped
312 case ${this_script} in
313 *grub) continue ;;
314 *fstab) [[ -z "${FSTAB}" ]] ||
315 [[ ${FSTAB} == $BUILDDIR/sources/fstab ]] ||
316 cp ${FSTAB} $BUILDDIR/sources/fstab ;;
317 *kernel) [[ -z ${CONFIG} ]] && continue
318 [[ ${CONFIG} == $BUILDDIR/sources/kernel-config ]] ||
319 cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
320 esac
321
322 # First append each name of the script files to a list (this will become
323 # the names of the targets in the Makefile
324 chapter78="$chapter78 ${this_script}"
325
326 #--------------------------------------------------------------------#
327 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
328 #--------------------------------------------------------------------#
329 #
330 # Drop in the name of the target on a new line, and the previous target
331 # as a dependency. Also call the echo_message function.
332 CHROOT_wrt_target "${this_script}" "$PREV"
333
334 # Find the bootscripts or networkscripts (for systemd)
335 # and kernel package names
336 case "${this_script}" in
337 *bootscripts)
338 name="lfs-bootscripts"
339 pkg_tarball=$(get_package_tarball_name $name)
340 if [ "${INSTALL_LOG}" = "y" ] ; then
341 CHROOT_wrt_TouchTimestamp
342 fi
343 CHROOT_Unpack "$pkg_tarball"
344 ;;
345 *network-scripts)
346 name="lfs-network-scripts"
347 pkg_tarball=$(get_package_tarball_name $name)
348 if [ "${INSTALL_LOG}" = "y" ] ; then
349 CHROOT_wrt_TouchTimestamp
350 fi
351 CHROOT_Unpack "$pkg_tarball"
352 ;;
353 *kernel)
354 name="linux"
355 pkg_tarball=$(get_package_tarball_name $name)
356 if [ "${INSTALL_LOG}" = "y" ] ; then
357 CHROOT_wrt_TouchTimestamp
358 fi
359 CHROOT_Unpack "$pkg_tarball"
360 # If using optimizations, use MAKEFLAGS (unless blacklisted)
361 # no setting of CFLAGS and friends.
362 [[ "$OPTIMIZE" != "0" ]] && wrt_makeflags "$name"
363 ;;
364 esac
365
366 # Check if we have a real /etc/fstab file
367 case "${this_script}" in
368 *fstab) if [[ -n "$FSTAB" ]]; then
369 CHROOT_wrt_CopyFstab
370 else
371 CHROOT_wrt_RunAsRoot "$file"
372 fi
373 ;;
374 *) CHROOT_wrt_RunAsRoot "$file"
375 ;;
376 esac
377
378 case "${this_script}" in
379 *bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy"
380 if [ "${INSTALL_LOG}" = "y" ] ; then
381 CHROOT_wrt_LogNewFiles "$name"
382 fi ;;
383 *network-scripts) CHROOT_wrt_RemoveBuildDirs "dummy"
384 if [ "${INSTALL_LOG}" = "y" ] ; then
385 CHROOT_wrt_LogNewFiles "$name"
386 fi ;;
387 *kernel) CHROOT_wrt_RemoveBuildDirs "dummy"
388 if [ "${INSTALL_LOG}" = "y" ] ; then
389 CHROOT_wrt_LogNewFiles "$name"
390 fi ;;
391 esac
392
393 # Include a touch of the target name so make can check
394 # if it's already been made.
395 wrt_touch
396 #
397 #--------------------------------------------------------------------#
398 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
399 #--------------------------------------------------------------------#
400
401 # Keep the script file name for Makefile dependencies.
402 PREV=${this_script}
403 done # for file in chapter0{7,8}/*
404
405}
406
407
408
409#----------------------------#
410build_Makefile() { #
411#----------------------------#
412
413 echo "Creating Makefile... ${BOLD}START${OFF}"
414
415 cd $JHALFSDIR/${PROGNAME}-commands
416
417 # Start with a clean Makefile.tmp file
418 >$MKFILE
419
420 chapter4_Makefiles
421 chapter5_Makefiles
422 chapter6_Makefiles
423 # Add the iterations targets, if needed
424 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
425 chapter78_Makefiles
426 # Add the CUSTOM_TOOLS targets, if needed
427 [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
428
429 # Add a header, some variables and include the function file
430 # to the top of the real Makefile.
431 wrt_Makefile_header
432
433 # Add chroot commands
434 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
435 i=1
436 for file in ../chroot-scripts/*chroot* ; do
437 chroot=`cat $file | \
438 perl -pe 's|\\\\\n||g' | \
439 tr -s [:space:] | \
440 grep chroot | \
441 sed -e "s|chroot|$CHROOT_LOC|" \
442 -e 's|\\$|&&|g' \
443 -e 's|"$$LFS"|$(MOUNT_PT)|'`
444 echo -e "CHROOT$i= $chroot\n" >> $MKFILE
445 i=`expr $i + 1`
446 done
447
448 # Drop in the main target 'all:' and the chapter targets with each sub-target
449 # as a dependency.
450(
451 cat << EOF
452
453all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
454 @sudo make do_housekeeping
455EOF
456) >> $MKFILE
457if [ "$INITSYS" = systemd ]; then
458(
459 cat << EOF
460 @/bin/echo -e -n \\
461 NAME=\\"Linux From Scratch\\"\\\\n\\
462 VERSION=\\"$VERSION\\"\\\\n\\
463 ID=lfs\\\\n\\
464 PRETTY_NAME=\\"Linux From Scratch $VERSION\\"\\\\n\\
465 VERSION_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
466 > os-release && \\
467 sudo mv os-release \$(MOUNT_PT)/etc && \\
468 sudo chown root:root \$(MOUNT_PT)/etc/os-release
469EOF
470) >> $MKFILE
471fi
472(
473 cat << EOF
474 @echo $VERSION > lfs-release && \\
475 sudo mv lfs-release \$(MOUNT_PT)/etc && \\
476 sudo chown root:root \$(MOUNT_PT)/etc/lfs-release
477 @/bin/echo -e -n \\
478 DISTRIB_ID=\\"Linux From Scratch\\"\\\\n\\
479 DISTRIB_RELEASE=\\"$VERSION\\"\\\\n\\
480 DISTRIB_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
481 DISTRIB_DESCRIPTION=\\"Linux From Scratch\\"\\\\n\\
482 > lsb-release && \\
483 sudo mv lsb-release \$(MOUNT_PT)/etc && \\
484 sudo chown root:root \$(MOUNT_PT)/etc/lsb-release
485 @\$(call echo_finished,$VERSION)
486
487ck_UID:
488 @if [ \`id -u\` = "0" ]; then \\
489 echo "--------------------------------------------------"; \\
490 echo "You cannot run this makefile from the root account"; \\
491 echo "--------------------------------------------------"; \\
492 exit 1; \\
493 fi
494
495mk_SETUP:
496 @\$(call echo_SU_request)
497 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
498 @touch \$@
499
500mk_LUSER: mk_SETUP
501 @\$(call echo_SULUSER_request)
502 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) LUSER" )
503 @sudo make restore-luser-env
504 @touch \$@
505
506mk_SUDO: mk_LUSER
507 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
508 @touch \$@
509
510mk_CHROOT: mk_SUDO
511 @\$(call echo_CHROOT_request)
512 @( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
513 @touch \$@
514
515mk_BOOT: mk_CHROOT
516 @\$(call echo_CHROOT_request)
517 @( sudo \$(CHROOT2) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
518 @touch \$@
519
520mk_BLFS_TOOL: create-sbu_du-report
521 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
522 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
523 (sudo \$(CHROOT2) -c "make -C $BLFS_ROOT/work"); \\
524 fi;
525 @touch \$@
526
527mk_CUSTOM_TOOLS: mk_BLFS_TOOL
528 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
529 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
530 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
531 (sudo \$(CHROOT2) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
532 fi;
533 @touch \$@
534
535devices: ck_UID
536 sudo mount -v --bind /dev \$(MOUNT_PT)/dev
537 sudo mount -vt devpts devpts \$(MOUNT_PT)/dev/pts
538 sudo mount -vt proc proc \$(MOUNT_PT)/proc
539 sudo mount -vt sysfs sysfs \$(MOUNT_PT)/sys
540 sudo mount -vt tmpfs tmpfs \$(MOUNT_PT)/run
541 if [ -h \$(MOUNT_PT)/dev/shm ]; then \\
542 sudo mkdir -p \$(MOUNT_PT)/\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
543 fi
544
545teardown:
546 sudo umount -v \$(MOUNT_PT)/sys
547 sudo umount -v \$(MOUNT_PT)/proc
548 sudo umount -v \$(MOUNT_PT)/dev/pts
549 if mountpoint -q \$(MOUNT_PT)/run; then \\
550 sudo umount -v \$(MOUNT_PT)/run; \\
551 elif [ -h \$(MOUNT_PT)/dev/shm ]; then \\
552 link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
553 sudo umount -v \$(MOUNT_PT)/\$\$link; \\
554 unset link; \\
555 else \\
556 sudo umount -v \$(MOUNT_PT)/dev/shm; \\
557 fi
558 sudo umount -v \$(MOUNT_PT)/dev
559
560chroot: devices
561 sudo \$(CHROOT2)
562 \$(MAKE) teardown
563
564SETUP: $chapter4
565LUSER: $chapter5
566SUDO: $runasroot
567CHROOT: SHELL=/tools/bin/bash
568CHROOT: $chapter6
569BOOT: $chapter78
570CUSTOM_TOOLS: $custom_list
571
572
573create-sbu_du-report: mk_BOOT
574 @\$(call echo_message, Building)
575 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
576 sudo ./create-sbu_du-report.sh logs $VERSION $(date --iso-8601); \\
577 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
578 fi;
579 @touch \$@
580
581restore-luser-env:
582 @\$(call echo_message, Building)
583 @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
584 mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
585 fi;
586 @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
587 mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
588 fi;
589 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash*
590 @\$(call housekeeping)
591
592do_housekeeping:
593 @-umount \$(MOUNT_PT)/sys
594 @-umount \$(MOUNT_PT)/proc
595 @-if mountpoint -q \$(MOUNT_PT)/run; then \\
596 umount \$(MOUNT_PT)/run; \\
597 elif [ -h \$(MOUNT_PT)/dev/shm ]; then \\
598 link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
599 umount \$(MOUNT_PT)/\$\$link; \\
600 unset link; \\
601 else \\
602 umount \$(MOUNT_PT)/dev/shm; \\
603 fi
604 @-umount \$(MOUNT_PT)/dev/pts
605 @-umount \$(MOUNT_PT)/dev
606 @-rm /tools
607 @-if [ ! -f luser-exist ]; then \\
608 userdel \$(LUSER); \\
609 rm -rf \$(LUSER_HOME); \\
610 fi;
611
612
613EOF
614) >> $MKFILE
615
616 # Bring over the items from the Makefile.tmp
617 cat $MKFILE.tmp >> $MKFILE
618 rm $MKFILE.tmp
619 echo "Creating Makefile... ${BOLD}DONE${OFF}"
620}
Note: See TracBrowser for help on using the repository browser.