source: LFS/master.sh@ 709eb74

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

Remove the /usr/share/doc/openssl-<version> dir before renaming
/usr/share/doc/openssl, otherwise it moves it as a subdirectory

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