source: LFS/master.sh@ 5a8939e

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

Really comment out test instructions+always define TESTLOG since the user
may "uncomment" some tests

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