source: LFS/master.sh@ 8010030

new_features
Last change on this file since 8010030 was 7e5ff87, checked in by Pierre Labastie <pierre@…>, 8 years ago

Merge trunk revs 3906-8

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