source: LFS/master.sh@ dc7fd7b

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

Add .la file removal to LFS and BLFS scripts

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