source: LFS/master.sh@ 0f7a988

ablfs-more trunk
Last change on this file since 0f7a988 was c552eab, checked in by Pierre Labastie <pierre.labastie@…>, 14 months ago

Always run "teardown" after chroot

If the shell exits with an error, teardown is not run in target
chroot, which may lead to unwanted effects, such as preventing
unmounting the $BUILD_DIR. Tell make to ignore the error.

  • Property mode set to 100644
File size: 16.5 KB
RevLine 
[91ff6a9]1#!/bin/bash
[877cc6a]2
3###################################
4### FUNCTIONS ###
5###################################
6
7
[045b2dc]8#############################################################
9
10
[ebe1ba6]11#-------------------------#
12chapter_targets() { #
13#-------------------------#
14# $1 is the chapter number. Pad it with 0 to the left to obtain a 2-digit
15# number:
16 printf -v dir chapter%02d $1
17
[3da8c49]18# $2 contains the build number if rebuilding for ICA
19 if [[ -z "$2" ]] ; then
20 local N=""
21 else
22 local N=-build_$2
23 local CHROOT_TGT=""
24 mkdir ${dir}$N
25 cp ${dir}/* ${dir}$N
26 for script in ${dir}$N/* ; do
27 # Overwrite existing symlinks, files, and dirs
28 sed -e 's/ln *-sv/&f/g' \
29 -e 's/mv *-v/&f/g' \
30 -e 's/mkdir *-v/&p/g' -i ${script}
31 # Rename the scripts
32 mv ${script} ${script}$N
33 done
34 # Remove Bzip2 binaries before make install (LFS-6.2 compatibility)
35 sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i ${dir}$N/*-bzip2$N
36 # Remove openssl-<version> from /usr/share/doc (LFS-9.x), because
37 # otherwise the mv command creates an openssl directory.
38 sed -e 's@mv -v@rm -rfv /usr/share/doc/openssl-*\n&@' \
39 -i ${dir}$N/*-openssl$N
40 fi
41
42 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter $1$N${R_arrow}"
[877cc6a]43
[3da8c49]44 for file in ${dir}$N/* ; do
[903eefd]45 # Keep the script file name
46 this_script=`basename $file`
[877cc6a]47
[ebe1ba6]48 # Some scripts need peculiar actions:
49 # - Stripping at the end of system build: lfs.xsl does not generate
50 # correct commands if the user does not want to strip, so skip it
51 # in this case
[3da8c49]52 # - do not reinstall linux-headers when rebuilding
[ebe1ba6]53 # - grub config: must be done manually; skip it
54 # - handle fstab and .config. Skip kernel if .config not supplied
[903eefd]55 case "${this_script}" in
[84d0d39]56 *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
[3da8c49]57 *linux-headers*) [[ -n "$N" ]] && continue ;;
[ebe1ba6]58 8*grub) (( nb_chaps == 5 )) && continue ;;
59 10*grub) continue ;;
60 *fstab) [[ -z "${FSTAB}" ]] ||
61 [[ ${FSTAB} == $BUILDDIR/sources/fstab ]] ||
62 cp ${FSTAB} $BUILDDIR/sources/fstab ;;
63 *kernel) [[ -z ${CONFIG} ]] && continue
64 [[ ${CONFIG} == $BUILDDIR/sources/kernel-config ]] ||
65 cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
[903eefd]66 esac
[3da8c49]67 # Grab the name of the target
[93814d1]68 # This is only used to check the name in "opt_override" or "BLACKLIST"
[3da8c49]69 name=`echo ${this_script} | sed -e 's@[0-9]\{3,4\}-@@' \
70 -e 's@-pass[0-9]\{1\}@@' \
71 -e 's@-libstdc++@@' \
[706e5bf]72 -e 's,'$N',,' \
73 -e 's@-32@@'`
[3da8c49]74
75 # Find the name of the tarball and the version of the package
76 # If it doesn't exist, we skip it in iterations rebuilds (except stripping
77 # and revisedchroot, where .a and .la files are removed).
78 pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
79 pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
80
81 if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
82 case "${this_script}" in
[756863b]83 *stripping*|*cleanup*|*revised*) ;;
[3da8c49]84 *) continue ;;
85 esac
86 fi
[877cc6a]87
[ebe1ba6]88 # Append the name of the script to a list. The name of the
89 # list is contained in the variable Makefile_target. We adjust this
90 # variable at various points. Note that it is initialized to "SETUP"
91 # in the main function, before calling this function for the first time.
92 case "${this_script}" in
93 *settingenvironment) Makefile_target=LUSER_TGT ;;
94 *changingowner ) Makefile_target=SUDO_TGT ;;
95 *creatingdirs ) Makefile_target=CHROOT_TGT ;;
96 *bootscripts ) Makefile_target=BOOT_TGT ;; # case of sysv book
97 *network ) Makefile_target=BOOT_TGT ;; # case of systemd book
98 esac
99 eval $Makefile_target=\"\$$Makefile_target ${this_script}\"
100
[903eefd]101 #--------------------------------------------------------------------#
102 # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
103 #--------------------------------------------------------------------#
104
105 # Drop in the name of the target on a new line, and the previous target
106 # as a dependency. Also call the echo_message function.
[ebe1ba6]107 case $Makefile_target in
108 CHROOT_TGT) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
109 *) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
110 esac
111
112 # If $pkg_tarball isn't empty, we've got a package...
113 if [ "$pkg_tarball" != "" ] ; then
114 # Touch timestamp file if installed files logs shall be created.
[3da8c49]115 # But only for the final install chapter and not when rebuilding it
116 if [ "${INSTALL_LOG}" = "y" ] &&
117 (( 1+nb_chaps <= $1 )) &&
118 [ "x$N" = x ] ; then
[ebe1ba6]119 CHROOT_wrt_TouchTimestamp
120 fi
121 # Always initialize the test log file, since the test instructions may
122 # be "uncommented" by the user
123 case $Makefile_target in
124 CHROOT_TGT) CHROOT_wrt_test_log "${this_script}" "$pkg_version" ;;
125 LUSER_TGT ) LUSER_wrt_test_log "${this_script}" "$pkg_version" ;;
126 esac
[903eefd]127
[ebe1ba6]128 # If using optimizations, write the instructions
129 case "${OPTIMIZE}$1${nb_chaps}${this_script}${REALSBU}" in
[d3dbebe]130 0* | *binutils-pass1y | 15* | 167* | 177*)
131 wrt_makeflags "$name" "-j1" "1" ;;
132 *kernel*) # No CFLAGS for kernel
133 wrt_makeflags "$name" "$JH_MAKEFLAGS" "$N_PARALLEL" ;;
134 *) wrt_optimize "$name" &&
135 wrt_makeflags "$name" "$JH_MAKEFLAGS" "$N_PARALLEL" ;;
[ebe1ba6]136 esac
137 fi
138
139# Some scriptlet have a special treatment; otherwise standard
[903eefd]140 case "${this_script}" in
141 *addinguser)
142(
[088130f]143# /var/lib may already exist and be owned by root if blfs tools
144# have been installed.
[903eefd]145cat << EOF
146 @if [ -f luser-id ]; then \\
147 function useradd() { true; }; \\
148 function groupadd() { true; }; \\
149 export -f useradd groupadd; \\
150 fi; \\
151 export LFS=\$(MOUNT_PT) && \\
152 \$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@ 2>&1; \\
153 \$(PRT_DU) >>logs/\$@
154 @chown \$(LUSER):\$(LGROUP) envars
[5562bf1]155 @if [ -d "\$(MOUNT_PT)/var/lib" ]; then \\
156 chown \$(LUSER):\$(LGROUP) \$(MOUNT_PT)/var/lib; \\
157 fi
[903eefd]158 @chmod -R a+wt $JHALFSDIR
159 @chmod a+wt \$(SRCSDIR)
[877cc6a]160EOF
[903eefd]161) >> $MKFILE.tmp
162 ;;
[ebe1ba6]163 *settingenvironment)
164(
165cat << EOF
166 @cd && \\
167 function source() { true; } && \\
168 export -f source && \\
169 \$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@ 2>&1 && \\
170 sed 's|/mnt/lfs|\$(MOUNT_PT)|' -i .bashrc && \\
171 echo source $JHALFSDIR/envars >> .bashrc
172 @\$(PRT_DU) >>logs/\$@
173EOF
174) >> $MKFILE.tmp
175 ;;
176 *fstab) if [[ -n "$FSTAB" ]]; then
177 CHROOT_wrt_CopyFstab
178 else
179 CHROOT_wrt_RunAsRoot "$file"
180 fi
181 ;;
182
[0a0753d]183 *)
[ebe1ba6]184 # Insert date and disk usage at the top of the log file, the script
185 # run and date and disk usage again at the bottom of the log file.
186 case "${Makefile_target}" in
187 SETUP_TGT | SUDO_TGT) wrt_RunAsRoot "$file" "$pkg_version" ;;
188 LUSER_TGT) LUSER_wrt_RunAsUser "$file" "$pkg_version" ;;
189 CHROOT_TGT | BOOT_TGT) CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
190 esac
191 ;;
[903eefd]192 esac
[045b2dc]193
[ebe1ba6]194 # Write installed files log and remove the build directory(ies)
195 # except if the package build fails.
196 if [ "$pkg_tarball" != "" ] ; then
[3da8c49]197 if [ "${INSTALL_LOG}" = "y" ] &&
198 (( 1+nb_chaps <= $1 )) &&
199 [ "x${N}" = "x" ] ; then
[706e5bf]200 CHROOT_wrt_LogNewFiles "${this_script}"
[ebe1ba6]201 fi
202 fi
203
[903eefd]204 # Include a touch of the target name so make can check
205 # if it's already been made.
206 wrt_touch
207 #
208 #--------------------------------------------------------------------#
209 # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
210 #--------------------------------------------------------------------#
211
212 # Keep the script file name for Makefile dependencies.
213 PREV=${this_script}
[3da8c49]214 # Set "system_build" var for iteration targets
215 if [ -z "$N" ] && (( 1+nb_chaps == $1 )); then
216 system_build="$system_build $this_script"
217 fi
218
[ebe1ba6]219 done # end for file in $dir/*
[3da8c49]220 # Set "system_build" when rebuilding: note the CHROOT_TGT is local
221 # in that case.
222 if [ -n "$N" ]; then
223 system_build="$CHROOT_TGT"
224 fi
[877cc6a]225}
226
227#----------------------------#
[045b2dc]228build_Makefile() { #
[877cc6a]229#----------------------------#
[045b2dc]230
[c7c5a53]231 echo "Creating Makefile... ${BOLD}START${OFF}"
[045b2dc]232
[2bd2fb8]233 cd "$JHALFSDIR/$COMMANDS"
[877cc6a]234
[ebe1ba6]235 # Start with empty files
[045b2dc]236 >$MKFILE
[ebe1ba6]237 >$MKFILE.tmp
238
239 # Ensure the first dependency is empty
240 unset PREV
[877cc6a]241
[ebe1ba6]242 # We begin with the SETUP target; successive targets will be assigned in
243 # the chapter_targets function.
244 Makefile_target=SETUP_TGT
245
246 # We need to know the chapter numbering, which depends on the version
247 # of the book. Use the number of subdirs to know which version we have
[6f74ca1]248 chaps=($(echo chapter*))
[ebe1ba6]249 nb_chaps=${#chaps[*]} # 5 if classical version, 7 if new version
250# DEBUG
251# echo chaps: ${chaps[*]}
252# echo nb_chaps: $nb_chaps
253# end DEBUG
254
255 # Make a temporary file with all script targets
256 for (( i = 4; i < nb_chaps+4; i++ )); do
257 chapter_targets $i
258 if (( i == nb_chaps )); then : # we have finished temporary tools
259 # Add the save target, if needed
260 [[ "$SAVE_CH5" = "y" ]] && wrt_save_target $Makefile_target
261 fi
[3da8c49]262 if (( i == 1+nb_chaps )); then : # we have finished final system
263 # Add the iterations targets, if needed
264 [[ "$COMPARE" = "y" ]] && wrt_compare_targets $i
265 fi
[ebe1ba6]266 done
[3e7ceed]267 # Add the CUSTOM_TOOLS targets, if needed
268 [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
[877cc6a]269
270 # Add a header, some variables and include the function file
271 # to the top of the real Makefile.
[195ed9f]272 wrt_Makefile_header
[877cc6a]273
274 # Add chroot commands
[6ad5a2f]275 CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
[877cc6a]276 i=1
[d68eb1b]277 for file in ../chroot-scripts/*chroot* ; do
[6ad5a2f]278 chroot=`cat $file | \
[abc8b27]279 perl -pe 's|\\\\\n||g' | \
280 tr -s [:space:] | \
281 grep chroot | \
282 sed -e "s|chroot|$CHROOT_LOC|" \
[6ad5a2f]283 -e 's|\\$|&&|g' \
[abc8b27]284 -e 's|"$$LFS"|$(MOUNT_PT)|'`
[877cc6a]285 echo -e "CHROOT$i= $chroot\n" >> $MKFILE
286 i=`expr $i + 1`
287 done
288
289 # Drop in the main target 'all:' and the chapter targets with each sub-target
[fd90f80]290 # as a dependency. Also prevent running targets in parallel.
[877cc6a]291(
292 cat << EOF
[045b2dc]293
[fd90f80]294.NOTPARALLEL:
295
[9728b23]296all: ck_UID ck_terminal mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
[3722d31]297 @sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
[262e174]298EOF
299) >> $MKFILE
300# With systemd, the commands in chapter 9 do not create a
301# valid /etc/resolv.conf, so that if blfs_tools are installed, and
302# make-ca is run, it cannot connect. In this case, resolv.conf
303# from the host has been copied, and we need to remove it now.
304if [ "$INITSYS" = systemd ]; then
305(
306 cat << EOF
307 @sudo rm -v \$(MOUNT_PT)/etc/resolv.conf
308EOF
309) >> $MKFILE
310fi
311(
312 cat << EOF
[045b2dc]313 @sudo make do_housekeeping
[e1fc855]314 @echo $VERSION > lfs-release && \\
[9096853]315 sudo mv lfs-release \$(MOUNT_PT)/etc && \\
316 sudo chown root:root \$(MOUNT_PT)/etc/lfs-release
[e1fc855]317 @/bin/echo -e -n \\
318 DISTRIB_ID=\\"Linux From Scratch\\"\\\\n\\
319 DISTRIB_RELEASE=\\"$VERSION\\"\\\\n\\
320 DISTRIB_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
321 DISTRIB_DESCRIPTION=\\"Linux From Scratch\\"\\\\n\\
322 > lsb-release && \\
323 sudo mv lsb-release \$(MOUNT_PT)/etc && \\
324 sudo chown root:root \$(MOUNT_PT)/etc/lsb-release
[56c1fff]325 @/bin/echo -e -n \\
326 NAME=\\"Linux From Scratch\\"\\\\n\\
327 VERSION=\\"$VERSION\\"\\\\n\\
328 ID=lfs\\\\n\\
329 PRETTY_NAME=\\"Linux From Scratch $VERSION\\"\\\\n\\
330 VERSION_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
331 > os-release && \\
332 sudo mv os-release \$(MOUNT_PT)/etc && \\
333 sudo chown root:root \$(MOUNT_PT)/etc/os-release
[877cc6a]334 @\$(call echo_finished,$VERSION)
335
[045b2dc]336ck_UID:
337 @if [ \`id -u\` = "0" ]; then \\
338 echo "--------------------------------------------------"; \\
339 echo "You cannot run this makefile from the root account"; \\
340 echo "--------------------------------------------------"; \\
341 exit 1; \\
342 fi
343
[9728b23]344ck_terminal:
[7e0a1b8]345 @stty size | ( read L C; \\
346 if (( L < 24 )) || (( C < 80 )) ; then \\
[9728b23]347 echo "--------------------------------------------------"; \\
[7e0a1b8]348 echo "Terminal too small: \$\$C columns x \$\$L lines";\\
[9728b23]349 echo "Minimum: 80 columns x 24 lines";\\
350 echo "--------------------------------------------------"; \\
351 exit 1; \\
[7e0a1b8]352 fi )
[9728b23]353
[045b2dc]354mk_SETUP:
355 @\$(call echo_SU_request)
[dd7e0f67]356 @sudo make save-luser
[dbcdfd7]357 @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
[045b2dc]358 @touch \$@
359
360mk_LUSER: mk_SETUP
361 @\$(call echo_SULUSER_request)
[903eefd]362 @\$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) LUSER"
363 @sudo make restore-luser
[045b2dc]364 @touch \$@
365
366mk_SUDO: mk_LUSER
[a73ed74]367 @sudo rm -f envars
[dbcdfd7]368 @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
[1330ebc]369 @touch \$@
370
[200cc01]371mk_CHROOT: mk_SUDO devices
[045b2dc]372 @\$(call echo_CHROOT_request)
[d68eb1b]373 @( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
[045b2dc]374 @touch \$@
[877cc6a]375
[200cc01]376mk_BOOT: mk_CHROOT devices
[045b2dc]377 @\$(call echo_CHROOT_request)
[20051e0]378 @( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
[045b2dc]379 @touch \$@
[877cc6a]380
[200cc01]381mk_BLFS_TOOL: create-sbu_du-report devices
[ac9bdc7]382 @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
383 \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
[20051e0]384 (sudo \$(CHROOT1) -c "make -C $BLFS_ROOT/work"); \\
[ac9bdc7]385 fi;
386 @touch \$@
387
[200cc01]388mk_CUSTOM_TOOLS: mk_BLFS_TOOL devices
[3e7ceed]389 @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
[3bc6078]390 \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
[3e7ceed]391 sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
[20051e0]392 (sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
[3e7ceed]393 fi;
394 @touch \$@
395
[f60a8b7]396devices: ck_UID
[3722d31]397 sudo env LFS=\$(MOUNT_PT) kernfs-scripts/devices.sh
[d39252b]398EOF
399) >> $MKFILE
[262e174]400# With systemd, the commands in chapter 9 do not create a
401# valid /etc/resolv.conf, so that if we want to enter chroot,
402# and systemd has not yet been run (otherwise /etc/resolv.conf
403# exists), we just copy resolv.conf from the host.
[d39252b]404if [ "$INITSYS" = systemd ]; then
405(
406 cat << EOF
[262e174]407 if ! [ -e \$(MOUNT_PT)/etc/resolv.conf ]; then \\
408 sudo cp -v /etc/resolv.conf \$(MOUNT_PT)/etc; \\
409 sudo touch \$(MOUNT_PT)/etc/.host-resolvconf; \\
410 fi
[d39252b]411EOF
412) >> $MKFILE
413fi
414(
415 cat << EOF
[13c475b]416
[2e1c1c3]417teardown:
[3722d31]418 sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
[262e174]419EOF
420) >> $MKFILE
421# With systemd, the commands in chapter 9 do not create a
422# valid /etc/resolv.conf, so that if we want to enter chroot,
423# and systemd has not yet been run (otherwise /etc/resolv.conf
424# exists), we just copy resolv.conf from the host.
425# We need to remove it now, if it has been created.
426if [ "$INITSYS" = systemd ]; then
427(
428 cat << EOF
429 if [ -e \$(MOUNT_PT)/etc/.host-resolvconf ]; then \\
430 sudo rm -v \$(MOUNT_PT)/etc/resolv.conf; \\
431 sudo rm -v \$(MOUNT_PT)/etc/.host-resolvconf; \\
432 fi
433EOF
434) >> $MKFILE
435fi
436(
437 cat << EOF
[d39252b]438
439chroot1: devices
[c552eab]440 -sudo \$(CHROOT1)
[d39252b]441 \$(MAKE) teardown
[7c17066]442
443chroot: devices
[c552eab]444 -sudo \$(CHROOT1)
[7c17066]445 \$(MAKE) teardown
[877cc6a]446
[ebe1ba6]447SETUP: $SETUP_TGT
448LUSER: $LUSER_TGT
449SUDO: $SUDO_TGT
[13c475b]450EOF
451) >> $MKFILE
[262e174]452# With systemd, the commands in chapter 9 do not create a
453# valid /etc/resolv.conf, so that if blfs_tools are installed, and
454# make-ca is run, it cannot connect. We just copy resolv.conf
455# from the host. We'll remove it at the end.
[13c475b]456if [ "$INITSYS" = systemd ]; then
457(
458 cat << EOF
[262e174]459 @cp -v /etc/resolv.conf \$(MOUNT_PT)/etc
[13c475b]460
461EOF
462) >> $MKFILE
463fi
464(
465 cat << EOF
[a73ed74]466CHROOT: SHELL=\$(filter %bash,\$(CHROOT1))
[ebe1ba6]467CHROOT: $CHROOT_TGT
468BOOT: $BOOT_TGT
[3e7ceed]469CUSTOM_TOOLS: $custom_list
[fe24ca6]470
[1838bc7]471create-sbu_du-report: mk_BOOT
472 @\$(call echo_message, Building)
473 @if [ "\$(ADD_REPORT)" = "y" ]; then \\
[c57747d]474 sudo ./create-sbu_du-report.sh logs $VERSION $(date --iso-8601); \\
[1838bc7]475 \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
[903eefd]476 fi
[1838bc7]477 @touch \$@
[045b2dc]478
[903eefd]479save-luser:
[877cc6a]480 @\$(call echo_message, Building)
[49e2745]481 @LUSER_ID=\$\$(grep '^\$(LUSER):' /etc/passwd | cut -d: -f3); \\
[dd7e0f67]482 if [ -n "\$\$LUSER_ID" ]; then \\
[903eefd]483 if [ ! -d \$(LUSER_HOME).XXX ]; then \\
484 mv \$(LUSER_HOME){,.XXX}; \\
485 mkdir \$(LUSER_HOME); \\
486 chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME); \\
487 fi; \\
[dd7e0f67]488 echo "\$\$LUSER_ID" > luser-id; \\
489 echo User \$(LUSER) exists with ID \$\$LUSER_ID; \\
[903eefd]490 else \\
[49e2745]491 rm -f luser-id; \\
[dd7e0f67]492 echo User \$(LUSER) does not exist; \\
493 echo It will be created with book instructions.; \\
[903eefd]494 fi
[dbcdfd7]495 @\$(call housekeeping)
[a858a78]496
[903eefd]497restore-luser:
498 @\$(call echo_message, Building)
499 @if [ -f luser-id ]; then \\
500 rm -rf \$(LUSER_HOME); \\
501 mv \$(LUSER_HOME){.XXX,}; \\
502 rm luser-id; \\
503 else \\
[6ad5a2f]504 userdel \$(LUSER); \\
[903eefd]505 groupdel \$(LGROUP); \\
[962793a]506 rm -rf \$(LUSER_HOME); \\
[903eefd]507 fi
508 @\$(call housekeeping)
509
510do_housekeeping:
[706e5bf]511 @-rm -f /tools
[a858a78]512
[877cc6a]513EOF
514) >> $MKFILE
515
516 # Bring over the items from the Makefile.tmp
517 cat $MKFILE.tmp >> $MKFILE
518 rm $MKFILE.tmp
[c7c5a53]519 echo "Creating Makefile... ${BOLD}DONE${OFF}"
520}
Note: See TracBrowser for help on using the repository browser.