source: LFS/master.sh@ c6506aea

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

Remove sudo from commands run as root (and some DEBUG lines)

  • 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 # Store virtual kernel file systems commands:
449 devices=`cat ../kernfs-scripts/devices.sh | \
450 sed -e 's|^| |' \
451 -e 's|mount|sudo &|' \
452 -e 's|mkdir|sudo &|' \
453 -e 's|\\$|&&|g' \
454 -e 's|\$|; \\\\|' \
455 -e 's|then|& :|' \
456 -e 's|\$\$LFS|$(MOUNT_PT)|g'`
457 teardown=`cat ../kernfs-scripts/teardown.sh | \
458 sed -e 's|^| |' \
459 -e 's|umount|sudo &|' \
460 -e 's|\$LFS|$(MOUNT_PT)|'`
461 teardownat=`cat ../kernfs-scripts/teardown.sh | \
462 sed -e 's|^| |' \
463 -e 's|umount|@-sudo &|' \
464 -e 's|\$LFS|$(MOUNT_PT)|'`
465 # Drop in the main target 'all:' and the chapter targets with each sub-target
466 # as a dependency.
467(
468 cat << EOF
469
470all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
471$teardownat
472 @sudo make do_housekeeping
473EOF
474) >> $MKFILE
475if [ "$INITSYS" = systemd ]; then
476(
477 cat << EOF
478 @/bin/echo -e -n \\
479 NAME=\\"Linux From Scratch\\"\\\\n\\
480 VERSION=\\"$VERSION\\"\\\\n\\
481 ID=lfs\\\\n\\
482 PRETTY_NAME=\\"Linux From Scratch $VERSION\\"\\\\n\\
483 VERSION_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
484 > os-release && \\
485 sudo mv os-release \$(MOUNT_PT)/etc && \\
486 sudo chown root:root \$(MOUNT_PT)/etc/os-release
487EOF
488) >> $MKFILE
489fi
490(
491 cat << EOF
492 @echo $VERSION > lfs-release && \\
493 sudo mv lfs-release \$(MOUNT_PT)/etc && \\
494 sudo chown root:root \$(MOUNT_PT)/etc/lfs-release
495 @/bin/echo -e -n \\
496 DISTRIB_ID=\\"Linux From Scratch\\"\\\\n\\
497 DISTRIB_RELEASE=\\"$VERSION\\"\\\\n\\
498 DISTRIB_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
499 DISTRIB_DESCRIPTION=\\"Linux From Scratch\\"\\\\n\\
500 > lsb-release && \\
501 sudo mv lsb-release \$(MOUNT_PT)/etc && \\
502 sudo chown root:root \$(MOUNT_PT)/etc/lsb-release
503 @\$(call echo_finished,$VERSION)
504
505ck_UID:
506 @if [ \`id -u\` = "0" ]; then \\
507 echo "--------------------------------------------------"; \\
508 echo "You cannot run this makefile from the root account"; \\
509 echo "--------------------------------------------------"; \\
510 exit 1; \\
511 fi
512
513mk_SETUP:
514 @\$(call echo_SU_request)
515 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
516 @touch \$@
517
518mk_LUSER: mk_SETUP
519 @\$(call echo_SULUSER_request)
520 @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) LUSER" )
521 @sudo make restore-luser-env
522 @touch \$@
523
524mk_SUDO: mk_LUSER
525 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
526 @touch \$@
527
528mk_CHROOT: mk_SUDO
529 @\$(call echo_CHROOT_request)
530 @( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
531 @touch \$@
532
533mk_BOOT: mk_CHROOT
534 @\$(call echo_CHROOT_request)
535 @( sudo \$(CHROOT2) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
536 @touch \$@
537
538mk_BLFS_TOOL: create-sbu_du-report
539 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
540 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
541 (sudo \$(CHROOT2) -c "make -C $BLFS_ROOT/work"); \\
542 fi;
543 @touch \$@
544
545mk_CUSTOM_TOOLS: mk_BLFS_TOOL
546 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
547 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
548 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
549 (sudo \$(CHROOT2) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
550 fi;
551 @touch \$@
552
553devices: ck_UID
554$devices
555EOF
556) >> $MKFILE
557if [ "$INITSYS" = systemd ]; then
558(
559 cat << EOF
560 sudo mkdir -pv \$(MOUNT_PT)/run/systemd/resolve
561 sudo cp -v /etc/resolv.conf \$(MOUNT_PT)/run/systemd/resolve
562EOF
563) >> $MKFILE
564fi
565(
566 cat << EOF
567
568teardown:
569$teardown
570
571chroot1: devices
572 sudo \$(CHROOT1)
573 \$(MAKE) teardown
574
575chroot: devices
576 sudo \$(CHROOT2)
577 \$(MAKE) teardown
578
579SETUP: $chapter4
580LUSER: $chapter5
581SUDO: $runasroot
582EOF
583) >> $MKFILE
584if [ "$INITSYS" = systemd ]; then
585(
586 cat << EOF
587 mkdir -pv \$(MOUNT_PT)/run/systemd/resolve
588 cp -v /etc/resolv.conf \$(MOUNT_PT)/run/systemd/resolve
589
590EOF
591) >> $MKFILE
592fi
593(
594 cat << EOF
595CHROOT: SHELL=/tools/bin/bash
596CHROOT: $chapter6
597BOOT: $chapter78
598CUSTOM_TOOLS: $custom_list
599
600
601create-sbu_du-report: mk_BOOT
602 @\$(call echo_message, Building)
603 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
604 sudo ./create-sbu_du-report.sh logs $VERSION $(date --iso-8601); \\
605 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
606 fi;
607 @touch \$@
608
609restore-luser-env:
610 @\$(call echo_message, Building)
611 @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
612 mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
613 fi;
614 @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
615 mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
616 fi;
617 @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash*
618 @\$(call housekeeping)
619
620do_housekeeping:
621 @-rm /tools
622 @-if [ ! -f luser-exist ]; then \\
623 userdel \$(LUSER); \\
624 rm -rf \$(LUSER_HOME); \\
625 fi;
626
627EOF
628) >> $MKFILE
629
630 # Bring over the items from the Makefile.tmp
631 cat $MKFILE.tmp >> $MKFILE
632 rm $MKFILE.tmp
633 echo "Creating Makefile... ${BOLD}DONE${OFF}"
634}
Note: See TracBrowser for help on using the repository browser.