1 | #!/bin/bash
|
---|
2 |
|
---|
3 | ###################################
|
---|
4 | ### FUNCTIONS ###
|
---|
5 | ###################################
|
---|
6 |
|
---|
7 |
|
---|
8 | #############################################################
|
---|
9 |
|
---|
10 |
|
---|
11 | #-------------------------#
|
---|
12 | chapter_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 |
|
---|
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}"
|
---|
43 |
|
---|
44 | for file in ${dir}$N/* ; do
|
---|
45 | # Keep the script file name
|
---|
46 | this_script=`basename $file`
|
---|
47 |
|
---|
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
|
---|
52 | # - do not reinstall linux-headers when rebuilding
|
---|
53 | # - grub config: must be done manually; skip it
|
---|
54 | # - handle fstab and .config. Skip kernel if .config not supplied
|
---|
55 | case "${this_script}" in
|
---|
56 | *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
|
---|
57 | *linux-headers*) [[ -n "$N" ]] && continue ;;
|
---|
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 ;;
|
---|
66 | esac
|
---|
67 | # Grab the name of the target
|
---|
68 | # This is only used to check the name in "opt_override" or "BLACKLIST"
|
---|
69 | name=`echo ${this_script} | sed -e 's@[0-9]\{3,4\}-@@' \
|
---|
70 | -e 's@-pass[0-9]\{1\}@@' \
|
---|
71 | -e 's@-libstdc++@@' \
|
---|
72 | -e 's,'$N',,' \
|
---|
73 | -e 's@-32@@'`
|
---|
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
|
---|
83 | *stripping*|*cleanup*|*revised*) ;;
|
---|
84 | *) continue ;;
|
---|
85 | esac
|
---|
86 | fi
|
---|
87 |
|
---|
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 |
|
---|
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.
|
---|
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.
|
---|
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
|
---|
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
|
---|
127 |
|
---|
128 | # If using optimizations, write the instructions
|
---|
129 | case "${OPTIMIZE}$1${nb_chaps}${this_script}${REALSBU}" in
|
---|
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" ;;
|
---|
136 | esac
|
---|
137 | fi
|
---|
138 |
|
---|
139 | # Some scriptlet have a special treatment; otherwise standard
|
---|
140 | case "${this_script}" in
|
---|
141 | *addinguser)
|
---|
142 | (
|
---|
143 | # /var/lib may already exist and be owned by root if blfs tools
|
---|
144 | # have been installed.
|
---|
145 | cat << 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
|
---|
155 | @if [ -d "\$(MOUNT_PT)/var/lib" ]; then \\
|
---|
156 | chown \$(LUSER):\$(LGROUP) \$(MOUNT_PT)/var/lib; \\
|
---|
157 | fi
|
---|
158 | @chmod -R a+wt $JHALFSDIR
|
---|
159 | @chmod a+wt \$(SRCSDIR)
|
---|
160 | EOF
|
---|
161 | ) >> $MKFILE.tmp
|
---|
162 | ;;
|
---|
163 | *settingenvironment)
|
---|
164 | (
|
---|
165 | cat << 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/\$@
|
---|
173 | EOF
|
---|
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 |
|
---|
183 | *)
|
---|
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 | ;;
|
---|
192 | esac
|
---|
193 |
|
---|
194 | # Write installed files log and remove the build directory(ies)
|
---|
195 | # except if the package build fails.
|
---|
196 | if [ "$pkg_tarball" != "" ] ; then
|
---|
197 | if [ "${INSTALL_LOG}" = "y" ] &&
|
---|
198 | (( 1+nb_chaps <= $1 )) &&
|
---|
199 | [ "x${N}" = "x" ] ; then
|
---|
200 | CHROOT_wrt_LogNewFiles "${this_script}"
|
---|
201 | fi
|
---|
202 | fi
|
---|
203 |
|
---|
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}
|
---|
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 |
|
---|
219 | done # end for file in $dir/*
|
---|
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
|
---|
225 | }
|
---|
226 |
|
---|
227 | #----------------------------#
|
---|
228 | build_Makefile() { #
|
---|
229 | #----------------------------#
|
---|
230 |
|
---|
231 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
232 |
|
---|
233 | cd "$JHALFSDIR/$COMMANDS"
|
---|
234 |
|
---|
235 | # Start with empty files
|
---|
236 | >$MKFILE
|
---|
237 | >$MKFILE.tmp
|
---|
238 |
|
---|
239 | # Ensure the first dependency is empty
|
---|
240 | unset PREV
|
---|
241 |
|
---|
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
|
---|
248 | chaps=($(echo chapter*))
|
---|
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
|
---|
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
|
---|
266 | done
|
---|
267 | # Add the CUSTOM_TOOLS targets, if needed
|
---|
268 | [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
|
---|
269 |
|
---|
270 | # Add a header, some variables and include the function file
|
---|
271 | # to the top of the real Makefile.
|
---|
272 | wrt_Makefile_header
|
---|
273 |
|
---|
274 | # Add chroot commands
|
---|
275 | CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
---|
276 | i=1
|
---|
277 | for file in ../chroot-scripts/*chroot* ; do
|
---|
278 | chroot=`cat $file | \
|
---|
279 | perl -pe 's|\\\\\n||g' | \
|
---|
280 | tr -s [:space:] | \
|
---|
281 | grep chroot | \
|
---|
282 | sed -e "s|chroot|$CHROOT_LOC|" \
|
---|
283 | -e 's|\\$|&&|g' \
|
---|
284 | -e 's|"$$LFS"|$(MOUNT_PT)|'`
|
---|
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
|
---|
290 | # as a dependency.
|
---|
291 | (
|
---|
292 | cat << EOF
|
---|
293 |
|
---|
294 | all: ck_UID ck_terminal mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL mk_CUSTOM_TOOLS
|
---|
295 | @sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
|
---|
296 | @sudo make do_housekeeping
|
---|
297 | @echo $VERSION > lfs-release && \\
|
---|
298 | sudo mv lfs-release \$(MOUNT_PT)/etc && \\
|
---|
299 | sudo chown root:root \$(MOUNT_PT)/etc/lfs-release
|
---|
300 | @/bin/echo -e -n \\
|
---|
301 | DISTRIB_ID=\\"Linux From Scratch\\"\\\\n\\
|
---|
302 | DISTRIB_RELEASE=\\"$VERSION\\"\\\\n\\
|
---|
303 | DISTRIB_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
|
---|
304 | DISTRIB_DESCRIPTION=\\"Linux From Scratch\\"\\\\n\\
|
---|
305 | > lsb-release && \\
|
---|
306 | sudo mv lsb-release \$(MOUNT_PT)/etc && \\
|
---|
307 | sudo chown root:root \$(MOUNT_PT)/etc/lsb-release
|
---|
308 | @/bin/echo -e -n \\
|
---|
309 | NAME=\\"Linux From Scratch\\"\\\\n\\
|
---|
310 | VERSION=\\"$VERSION\\"\\\\n\\
|
---|
311 | ID=lfs\\\\n\\
|
---|
312 | PRETTY_NAME=\\"Linux From Scratch $VERSION\\"\\\\n\\
|
---|
313 | VERSION_CODENAME=\\"$(whoami)-jhalfs\\"\\\\n\\
|
---|
314 | > os-release && \\
|
---|
315 | sudo mv os-release \$(MOUNT_PT)/etc && \\
|
---|
316 | sudo chown root:root \$(MOUNT_PT)/etc/os-release
|
---|
317 | @\$(call echo_finished,$VERSION)
|
---|
318 |
|
---|
319 | ck_UID:
|
---|
320 | @if [ \`id -u\` = "0" ]; then \\
|
---|
321 | echo "--------------------------------------------------"; \\
|
---|
322 | echo "You cannot run this makefile from the root account"; \\
|
---|
323 | echo "--------------------------------------------------"; \\
|
---|
324 | exit 1; \\
|
---|
325 | fi
|
---|
326 |
|
---|
327 | ck_terminal:
|
---|
328 | @stty size | ( read L C; \\
|
---|
329 | if (( L < 24 )) || (( C < 80 )) ; then \\
|
---|
330 | echo "--------------------------------------------------"; \\
|
---|
331 | echo "Terminal too small: \$\$C columns x \$\$L lines";\\
|
---|
332 | echo "Minimum: 80 columns x 24 lines";\\
|
---|
333 | echo "--------------------------------------------------"; \\
|
---|
334 | exit 1; \\
|
---|
335 | fi )
|
---|
336 |
|
---|
337 | mk_SETUP:
|
---|
338 | @\$(call echo_SU_request)
|
---|
339 | @sudo make save-luser
|
---|
340 | @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
|
---|
341 | @touch \$@
|
---|
342 |
|
---|
343 | mk_LUSER: mk_SETUP
|
---|
344 | @\$(call echo_SULUSER_request)
|
---|
345 | @\$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) LUSER"
|
---|
346 | @sudo make restore-luser
|
---|
347 | @touch \$@
|
---|
348 |
|
---|
349 | mk_SUDO: mk_LUSER
|
---|
350 | @sudo rm -f envars
|
---|
351 | @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
|
---|
352 | @touch \$@
|
---|
353 |
|
---|
354 | mk_CHROOT: mk_SUDO
|
---|
355 | @\$(call echo_CHROOT_request)
|
---|
356 | @( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT")
|
---|
357 | @touch \$@
|
---|
358 |
|
---|
359 | mk_BOOT: mk_CHROOT
|
---|
360 | @\$(call echo_CHROOT_request)
|
---|
361 | @( sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) BOOT")
|
---|
362 | @touch \$@
|
---|
363 |
|
---|
364 | mk_BLFS_TOOL: create-sbu_du-report
|
---|
365 | @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
|
---|
366 | \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
|
---|
367 | (sudo \$(CHROOT1) -c "make -C $BLFS_ROOT/work"); \\
|
---|
368 | fi;
|
---|
369 | @touch \$@
|
---|
370 |
|
---|
371 | mk_CUSTOM_TOOLS: mk_BLFS_TOOL
|
---|
372 | @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
|
---|
373 | \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
|
---|
374 | sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
|
---|
375 | (sudo \$(CHROOT1) -c "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
|
---|
376 | fi;
|
---|
377 | @touch \$@
|
---|
378 |
|
---|
379 | devices: ck_UID
|
---|
380 | sudo env LFS=\$(MOUNT_PT) kernfs-scripts/devices.sh
|
---|
381 | EOF
|
---|
382 | ) >> $MKFILE
|
---|
383 | if [ "$INITSYS" = systemd ]; then
|
---|
384 | (
|
---|
385 | cat << EOF
|
---|
386 | sudo mkdir -pv \$(MOUNT_PT)/run/systemd/resolve
|
---|
387 | sudo cp -v /etc/resolv.conf \$(MOUNT_PT)/run/systemd/resolve
|
---|
388 | EOF
|
---|
389 | ) >> $MKFILE
|
---|
390 | fi
|
---|
391 | (
|
---|
392 | cat << EOF
|
---|
393 |
|
---|
394 | teardown:
|
---|
395 | sudo env LFS=\$(MOUNT_PT) kernfs-scripts/teardown.sh
|
---|
396 |
|
---|
397 | chroot1: devices
|
---|
398 | sudo \$(CHROOT1)
|
---|
399 | \$(MAKE) teardown
|
---|
400 |
|
---|
401 | chroot: devices
|
---|
402 | sudo \$(CHROOT1)
|
---|
403 | \$(MAKE) teardown
|
---|
404 |
|
---|
405 | SETUP: $SETUP_TGT
|
---|
406 | LUSER: $LUSER_TGT
|
---|
407 | SUDO: $SUDO_TGT
|
---|
408 | EOF
|
---|
409 | ) >> $MKFILE
|
---|
410 | if [ "$INITSYS" = systemd ]; then
|
---|
411 | (
|
---|
412 | cat << EOF
|
---|
413 | mkdir -pv \$(MOUNT_PT)/run/systemd/resolve
|
---|
414 | cp -v /etc/resolv.conf \$(MOUNT_PT)/run/systemd/resolve
|
---|
415 |
|
---|
416 | EOF
|
---|
417 | ) >> $MKFILE
|
---|
418 | fi
|
---|
419 | (
|
---|
420 | cat << EOF
|
---|
421 | CHROOT: SHELL=\$(filter %bash,\$(CHROOT1))
|
---|
422 | CHROOT: $CHROOT_TGT
|
---|
423 | BOOT: $BOOT_TGT
|
---|
424 | CUSTOM_TOOLS: $custom_list
|
---|
425 |
|
---|
426 | create-sbu_du-report: mk_BOOT
|
---|
427 | @\$(call echo_message, Building)
|
---|
428 | @if [ "\$(ADD_REPORT)" = "y" ]; then \\
|
---|
429 | sudo ./create-sbu_du-report.sh logs $VERSION $(date --iso-8601); \\
|
---|
430 | \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
|
---|
431 | fi
|
---|
432 | @touch \$@
|
---|
433 |
|
---|
434 | save-luser:
|
---|
435 | @\$(call echo_message, Building)
|
---|
436 | @LUSER_ID=\$\$(grep '^\$(LUSER):' /etc/passwd | cut -d: -f3); \\
|
---|
437 | if [ -n "\$\$LUSER_ID" ]; then \\
|
---|
438 | if [ ! -d \$(LUSER_HOME).XXX ]; then \\
|
---|
439 | mv \$(LUSER_HOME){,.XXX}; \\
|
---|
440 | mkdir \$(LUSER_HOME); \\
|
---|
441 | chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME); \\
|
---|
442 | fi; \\
|
---|
443 | echo "\$\$LUSER_ID" > luser-id; \\
|
---|
444 | echo User \$(LUSER) exists with ID \$\$LUSER_ID; \\
|
---|
445 | else \\
|
---|
446 | rm -f luser-id; \\
|
---|
447 | echo User \$(LUSER) does not exist; \\
|
---|
448 | echo It will be created with book instructions.; \\
|
---|
449 | fi
|
---|
450 | @\$(call housekeeping)
|
---|
451 |
|
---|
452 | restore-luser:
|
---|
453 | @\$(call echo_message, Building)
|
---|
454 | @if [ -f luser-id ]; then \\
|
---|
455 | rm -rf \$(LUSER_HOME); \\
|
---|
456 | mv \$(LUSER_HOME){.XXX,}; \\
|
---|
457 | rm luser-id; \\
|
---|
458 | else \\
|
---|
459 | userdel \$(LUSER); \\
|
---|
460 | groupdel \$(LGROUP); \\
|
---|
461 | rm -rf \$(LUSER_HOME); \\
|
---|
462 | fi
|
---|
463 | @\$(call housekeeping)
|
---|
464 |
|
---|
465 | do_housekeeping:
|
---|
466 | @-rm -f /tools
|
---|
467 |
|
---|
468 | EOF
|
---|
469 | ) >> $MKFILE
|
---|
470 |
|
---|
471 | # Bring over the items from the Makefile.tmp
|
---|
472 | cat $MKFILE.tmp >> $MKFILE
|
---|
473 | rm $MKFILE.tmp
|
---|
474 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
475 | }
|
---|