source: LFS/master.sh@ 0835a10

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

Two fixes:"

  • use /etc/passwd to check whether LUSER exists
  • use sudo -H -u $(LUSER) to be sure that HOME is set (depends on distro)
  • Property mode set to 100644
File size: 21.0 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 fi
219
220 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
221
222# Initialize the Makefile target. In vanilla lfs, kernfs should be run as root,
223# then the others are run in chroot. If in new lfs, we should start in chroot.
224# this will be changed later because man-pages is the first script in
225# chapter 6. Note that this Makefile_target business is not really needed here
226# but we do it to have a similar structure to chapter 5 (we may merge all
227# those functions at some point).
228 Makefile_target=runasroot
229
230# Start loop
231 for file in chapter06$N/* ; do
232 # Keep the script file name
233 this_script=`basename $file`
234
235 # Skip the "stripping" scripts if the user does not want to strip.
236 # Skip also linux-headers in iterative builds.
237 case "${this_script}" in
238 *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
239 *linux-headers*) [[ -n "$N" ]] && continue ;;
240 esac
241
242 # Grab the name of the target.
243 name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's,'$N',,'`
244
245 # Find the tarball corresponding to our script.
246 # If it doesn't exist, we skip it in iterations rebuilds (except stripping).
247 pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
248 pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
249
250 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
251 case "${this_script}" in
252 *stripping*) ;;
253 *) continue ;;
254 esac
255 fi
256
257 # Append each name of the script files to a list (this will become
258 # the names of the targets in the Makefile)
259 # The kernfs script must be run as part of SUDO target.
260 case "${this_script}" in
261 *creatingdirs) Makefile_target=chapter6 ;;
262 *man-pages ) Makefile_target=chapter6 ;;
263 esac
264 eval $Makefile_target=\"\$$Makefile_target ${this_script}\"
265
266 #--------------------------------------------------------------------#
267 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
268 #--------------------------------------------------------------------#
269 #
270 # Drop in the name of the target on a new line, and the previous target
271 # as a dependency. Also call the echo_message function.
272 # In the mount of kernel filesystems we need to set LFS
273 # and not to use chroot.
274 case "${Makefile_target}" in
275 runasroot) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
276 *) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
277 esac
278
279 # If $pkg_tarball isn't empty, we've got a package...
280 # Insert instructions for unpacking the package and changing directories
281 if [ "$pkg_tarball" != "" ] ; then
282 # Touch timestamp file if installed files logs will be created.
283 # But only for the firt build when running iterative builds.
284 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
285 CHROOT_wrt_TouchTimestamp
286 fi
287 # Always initialize the log file, so that the user may reinstate a
288 # commented out test
289 CHROOT_wrt_test_log "${this_script}" "$pkg_version"
290 # If using optimizations, write the instructions
291 [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
292 fi
293
294 # In the mount of kernel filesystems we need to set LFS
295 # and not to use chroot.
296 case "${Makefile_target}" in
297 runasroot) wrt_RunAsRoot "$file" "$pkg_version" ;;
298 *) CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
299 esac
300
301 # Write installed files log and remove the build directory(ies)
302 # except if the package build fails.
303 if [ "$pkg_tarball" != "" ] ; then
304 if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
305 CHROOT_wrt_LogNewFiles "$name"
306 fi
307 fi
308
309 # Include a touch of the target name so make can check
310 # if it's already been made.
311 wrt_touch
312 #
313 #--------------------------------------------------------------------#
314 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
315 #--------------------------------------------------------------------#
316
317 # Keep the script file name for Makefile dependencies.
318 PREV=${this_script}
319 # Set system_build envar for iteration targets
320 system_build=$chapter6
321 done # end for file in chapter06/*
322}
323
324#----------------------------#
325chapter78_Makefiles() {
326#----------------------------#
327 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8 ( BOOT ) ${R_arrow}"
328
329 for file in chapter0{7,8}/* ; do
330 # Keep the script file name
331 this_script=`basename $file`
332
333 # Grub must be configured manually.
334 # Handle fstab creation.
335 # If no .config file is supplied, the kernel build is skipped
336 case ${this_script} in
337 *grub) continue ;;
338 *fstab) [[ -z "${FSTAB}" ]] ||
339 [[ ${FSTAB} == $BUILDDIR/sources/fstab ]] ||
340 cp ${FSTAB} $BUILDDIR/sources/fstab ;;
341 *kernel) [[ -z ${CONFIG} ]] && continue
342 [[ ${CONFIG} == $BUILDDIR/sources/kernel-config ]] ||
343 cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
344 esac
345
346 # First append each name of the script files to a list (this will become
347 # the names of the targets in the Makefile
348 chapter78="$chapter78 ${this_script}"
349
350 #--------------------------------------------------------------------#
351 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
352 #--------------------------------------------------------------------#
353 #
354 # Drop in the name of the target on a new line, and the previous target
355 # as a dependency. Also call the echo_message function.
356 CHROOT_wrt_target "${this_script}" "$PREV"
357
358 # Find the bootscripts or networkscripts (for systemd)
359 # and kernel package names
360 case "${this_script}" in
361 *bootscripts)
362 name="lfs-bootscripts"
363 if [ "${INSTALL_LOG}" = "y" ] ; then
364 CHROOT_wrt_TouchTimestamp
365 fi
366 ;;
367 *network-scripts)
368 name="lfs-network-scripts"
369 if [ "${INSTALL_LOG}" = "y" ] ; then
370 CHROOT_wrt_TouchTimestamp
371 fi
372 ;;
373 *kernel)
374 name="linux"
375 if [ "${INSTALL_LOG}" = "y" ] ; then
376 CHROOT_wrt_TouchTimestamp
377 fi
378 # If using optimizations, use MAKEFLAGS (unless blacklisted)
379 # no setting of CFLAGS and friends.
380 [[ "$OPTIMIZE" != "0" ]] && wrt_makeflags "$name"
381 ;;
382 esac
383
384 # Check if we have a real /etc/fstab file
385 case "${this_script}" in
386 *fstab) if [[ -n "$FSTAB" ]]; then
387 CHROOT_wrt_CopyFstab
388 else
389 CHROOT_wrt_RunAsRoot "$file"
390 fi
391 ;;
392 *) CHROOT_wrt_RunAsRoot "$file"
393 ;;
394 esac
395
396 case "${this_script}" in
397 *bootscripts|*network-scripts|*kernel)
398 if [ "${INSTALL_LOG}" = "y" ] ; then
399 CHROOT_wrt_LogNewFiles "$name"
400 fi ;;
401 esac
402 # Include a touch of the target name so make can check
403 # if it's already been made.
404 wrt_touch
405 #
406 #--------------------------------------------------------------------#
407 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
408 #--------------------------------------------------------------------#
409
410 # Keep the script file name for Makefile dependencies.
411 PREV=${this_script}
412 done # for file in chapter0{7,8}/*
413
414}
415
416
417
418#----------------------------#
419build_Makefile() { #
420#----------------------------#
421
422 echo "Creating Makefile... ${BOLD}START${OFF}"
423
424 cd $JHALFSDIR/${PROGNAME}-commands
425
426 # Start with a clean Makefile.tmp file
427 >$MKFILE
428
429 chapter4_Makefiles
430 chapter5_Makefiles
431 chapter6_Makefiles
432 # Add the iterations targets, if needed
433 [[ "$COMPARE" = "y" ]] && wrt_compare_targets
434 chapter78_Makefiles
435 # Add the CUSTOM_TOOLS targets, if needed
436 [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
437
438 # Add a header, some variables and include the function file
439 # to the top of the real Makefile.
440 wrt_Makefile_header
441
442 # Add chroot commands
443 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
444 i=1
445 for file in ../chroot-scripts/*chroot* ; do
446 chroot=`cat $file | \
447 perl -pe 's|\\\\\n||g' | \
448 tr -s [:space:] | \
449 grep chroot | \
450 sed -e "s|chroot|$CHROOT_LOC|" \
451 -e 's|\\$|&&|g' \
452 -e 's|"$$LFS"|$(MOUNT_PT)|'`
453 echo -e "CHROOT$i= $chroot\n" >> $MKFILE
454 i=`expr $i + 1`
455 done
456
457 # Store virtual kernel file systems commands:
458 devices=`cat ../kernfs-scripts/devices.sh | \
459 sed -e 's|^| |' \
460 -e 's|mount|sudo &|' \
461 -e 's|mkdir|sudo &|' \
462 -e 's|\\$|&&|g' \
463 -e 's|\$|; \\\\|' \
464 -e 's|then|& :|' \
465 -e 's|\$\$LFS|$(MOUNT_PT)|g'`
466 teardown=`cat ../kernfs-scripts/teardown.sh | \
467 sed -e 's|^| |' \
468 -e 's|umount|sudo &|' \
469 -e 's|\$LFS|$(MOUNT_PT)|'`
470 teardownat=`cat ../kernfs-scripts/teardown.sh | \
471 sed -e 's|^| |' \
472 -e 's|umount|@-sudo &|' \
473 -e 's|\$LFS|$(MOUNT_PT)|'`
474 # Drop in the main target 'all:' and the chapter targets with each sub-target
475 # as a dependency.
476(
477 cat << EOF
478
479all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
480$teardownat
481 @sudo make do_housekeeping
482EOF
483) >> $MKFILE
484if [ "$INITSYS" = systemd ]; then
485(
486 cat << EOF
487 @/bin/echo -e -n \\
488 NAME=\\"Linux From Scratch\\"\\\\n\\
489 VERSION=\\"$VERSION\\"\\\\n\\
490 ID=lfs\\\\n\\
491 PRETTY_NAME=\\"Linux From Scratch $VERSION\\"\\\\n\\
492 VERSION_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
493 > os-release && \\
494 sudo mv os-release \$(MOUNT_PT)/etc && \\
495 sudo chown root:root \$(MOUNT_PT)/etc/os-release
496EOF
497) >> $MKFILE
498fi
499(
500 cat << EOF
501 @echo $VERSION > lfs-release && \\
502 sudo mv lfs-release \$(MOUNT_PT)/etc && \\
503 sudo chown root:root \$(MOUNT_PT)/etc/lfs-release
504 @/bin/echo -e -n \\
505 DISTRIB_ID=\\"Linux From Scratch\\"\\\\n\\
506 DISTRIB_RELEASE=\\"$VERSION\\"\\\\n\\
507 DISTRIB_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
508 DISTRIB_DESCRIPTION=\\"Linux From Scratch\\"\\\\n\\
509 > lsb-release && \\
510 sudo mv lsb-release \$(MOUNT_PT)/etc && \\
511 sudo chown root:root \$(MOUNT_PT)/etc/lsb-release
512 @\$(call echo_finished,$VERSION)
513
514ck_UID:
515 @if [ \`id -u\` = "0" ]; then \\
516 echo "--------------------------------------------------"; \\
517 echo "You cannot run this makefile from the root account"; \\
518 echo "--------------------------------------------------"; \\
519 exit 1; \\
520 fi
521
522mk_SETUP:
523 @sudo make save-luser
524 @\$(call echo_SU_request)
525 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
526 @touch \$@
527
528mk_LUSER: mk_SETUP
529 @\$(call echo_SULUSER_request)
530 @\$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) LUSER"
531 @sudo make restore-luser
532 @touch \$@
533
534mk_SUDO: mk_LUSER
535 @sudo rm -f envars
536 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
537 @touch \$@
538
539mk_CHROOT: mk_SUDO
540 @\$(call echo_CHROOT_request)
541 @( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
542 @touch \$@
543
544mk_BOOT: mk_CHROOT
545 @\$(call echo_CHROOT_request)
546 @( sudo \$(CHROOT2) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
547 @touch \$@
548
549mk_BLFS_TOOL: create-sbu_du-report
550 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
551 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
552 (sudo \$(CHROOT2) -c "make -C $BLFS_ROOT/work"); \\
553 fi;
554 @touch \$@
555
556mk_CUSTOM_TOOLS: mk_BLFS_TOOL
557 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
558 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
559 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
560 (sudo \$(CHROOT2) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
561 fi;
562 @touch \$@
563
564devices: ck_UID
565$devices
566EOF
567) >> $MKFILE
568if [ "$INITSYS" = systemd ]; then
569(
570 cat << EOF
571 sudo mkdir -pv \$(MOUNT_PT)/run/systemd/resolve
572 sudo cp -v /etc/resolv.conf \$(MOUNT_PT)/run/systemd/resolve
573EOF
574) >> $MKFILE
575fi
576(
577 cat << EOF
578
579teardown:
580$teardown
581
582chroot1: devices
583 sudo \$(CHROOT1)
584 \$(MAKE) teardown
585
586chroot: devices
587 sudo \$(CHROOT2)
588 \$(MAKE) teardown
589
590SETUP: $chapter4
591LUSER: $chapter5
592SUDO: $runasroot
593EOF
594) >> $MKFILE
595if [ "$INITSYS" = systemd ]; then
596(
597 cat << EOF
598 mkdir -pv \$(MOUNT_PT)/run/systemd/resolve
599 cp -v /etc/resolv.conf \$(MOUNT_PT)/run/systemd/resolve
600
601EOF
602) >> $MKFILE
603fi
604(
605 cat << EOF
606CHROOT: SHELL=\$(filter %bash,\$(CHROOT1))
607CHROOT: $chapter6
608BOOT: $chapter78
609CUSTOM_TOOLS: $custom_list
610
611
612create-sbu_du-report: mk_BOOT
613 @\$(call echo_message, Building)
614 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
615 sudo ./create-sbu_du-report.sh logs $VERSION $(date --iso-8601); \\
616 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
617 fi
618 @touch \$@
619
620save-luser:
621 @\$(call echo_message, Building)
622 @LUSER_ID=\$(grep '^$(LUSER):' /etc/passwd | cut -d: -f3); \\
623 if [ -n "\$LUSER_ID" ]; then \\
624 if [ ! -d \$(LUSER_HOME).XXX ]; then \\
625 mv \$(LUSER_HOME){,.XXX}; \\
626 mkdir \$(LUSER_HOME); \\
627 chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME); \\
628 echo "\$LUSER_ID" > luser-id; \\
629 fi; \\
630 else \\
631 rm luser-id; \\
632 fi
633 @\$(call housekeeping)
634
635restore-luser:
636 @\$(call echo_message, Building)
637 @if [ -f luser-id ]; then \\
638 rm -rf \$(LUSER_HOME); \\
639 mv \$(LUSER_HOME){.XXX,}; \\
640 rm luser-id; \\
641 else \\
642 userdel \$(LUSER); \\
643 groupdel \$(LGROUP); \\
644 rm -rf \$(LUSER_HOME); \\
645 fi
646 @\$(call housekeeping)
647
648do_housekeeping:
649 @-rm /tools
650
651EOF
652) >> $MKFILE
653
654 # Bring over the items from the Makefile.tmp
655 cat $MKFILE.tmp >> $MKFILE
656 rm $MKFILE.tmp
657 echo "Creating Makefile... ${BOLD}DONE${OFF}"
658}
Note: See TracBrowser for help on using the repository browser.