1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # $Id$
|
---|
4 |
|
---|
5 | ###################################
|
---|
6 | ### FUNCTIONS ###
|
---|
7 | ###################################
|
---|
8 |
|
---|
9 |
|
---|
10 | #############################################################
|
---|
11 |
|
---|
12 |
|
---|
13 | #----------------------------#
|
---|
14 | chapter4_Makefiles() { #
|
---|
15 | #----------------------------#
|
---|
16 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}"
|
---|
17 |
|
---|
18 | # If /home/$LUSER 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
|
---|
23 | 020-creatingtoolsdir:
|
---|
24 | @\$(call echo_message, Building)
|
---|
25 | @mkdir \$(MOUNT_PT)/tools && \\
|
---|
26 | rm -f /tools && \\
|
---|
27 | ln -s \$(MOUNT_PT)/tools / && \\
|
---|
28 | touch \$@ && \\
|
---|
29 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
30 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
31 |
|
---|
32 | 021-addinguser: 020-creatingtoolsdir
|
---|
33 | @\$(call echo_message, Building)
|
---|
34 | @if [ ! -d /home/\$(LUSER) ]; then \\
|
---|
35 | groupadd \$(LGROUP); \\
|
---|
36 | useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
---|
37 | else \\
|
---|
38 | touch luser-exist; \\
|
---|
39 | fi;
|
---|
40 | @chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
---|
41 | chown -R \$(LUSER) \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
|
---|
42 | chmod -R a+wt \$(MOUNT_PT) && \\
|
---|
43 | touch \$@ && \\
|
---|
44 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
45 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
46 |
|
---|
47 | 022-settingenvironment: 021-addinguser
|
---|
48 | @\$(call echo_message, Building)
|
---|
49 | @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
---|
50 | mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
---|
51 | fi;
|
---|
52 | @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
---|
53 | mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
---|
54 | fi;
|
---|
55 | @echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
---|
56 | echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
---|
57 | echo "LFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
---|
58 | echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
---|
59 | echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
---|
60 | echo "export LFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
---|
61 | echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc && \\
|
---|
62 | chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
---|
63 | touch envars && \\
|
---|
64 | chown \$(LUSER) envars && \\
|
---|
65 | touch \$@ && \\
|
---|
66 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
67 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
68 | EOF
|
---|
69 | ) > $MKFILE.tmp
|
---|
70 |
|
---|
71 | chapter4=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment"
|
---|
72 | }
|
---|
73 |
|
---|
74 |
|
---|
75 |
|
---|
76 | #----------------------------#
|
---|
77 | chapter5_Makefiles() {
|
---|
78 | #----------------------------#
|
---|
79 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}"
|
---|
80 |
|
---|
81 | for file in chapter05/* ; do
|
---|
82 | # Keep the script file name
|
---|
83 | this_script=`basename $file`
|
---|
84 |
|
---|
85 | # If no testsuites will be run, then TCL, Expect and DejaGNU aren't needed
|
---|
86 | # Fix also locales creation when running chapter05 testsuites (ugly)
|
---|
87 | case "${this_script}" in
|
---|
88 | *tcl) [[ "${TEST}" = "0" ]] && continue ;;
|
---|
89 | *expect) [[ "${TEST}" = "0" ]] && continue ;;
|
---|
90 | *dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
|
---|
91 | *stripping) [[ "${STRIP}" = "n" ]] && continue ;;
|
---|
92 | *glibc) [[ "${TEST}" = "3" ]] && \
|
---|
93 | sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
|
---|
94 | esac
|
---|
95 |
|
---|
96 | # First append each name of the script files to a list (this will become
|
---|
97 | # the names of the targets in the Makefile
|
---|
98 | # DO NOT append the changingowner script.
|
---|
99 | # A hack is necessary: create script in chap5 BUT run as a dependency for
|
---|
100 | # chap6 CHROOT
|
---|
101 | case "${this_script}" in
|
---|
102 | *changingowner) : ;;
|
---|
103 | *) chapter5="$chapter5 ${this_script}" ;;
|
---|
104 | esac
|
---|
105 |
|
---|
106 | # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
|
---|
107 | # and binutils in chapter 5)
|
---|
108 | name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
|
---|
109 |
|
---|
110 | # Set the dependency for the first target.
|
---|
111 | if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
|
---|
112 |
|
---|
113 | #--------------------------------------------------------------------#
|
---|
114 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
115 | #--------------------------------------------------------------------#
|
---|
116 | #
|
---|
117 | # Drop in the name of the target on a new line, and the previous target
|
---|
118 | # as a dependency. Also call the echo_message function.
|
---|
119 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
120 |
|
---|
121 | # Find the version of the command files, if it corresponds with the building of
|
---|
122 | # a specific package
|
---|
123 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
124 |
|
---|
125 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
126 | if [ "$pkg_tarball" != "" ] ; then
|
---|
127 | # Insert instructions for unpacking the package and to set the PKGDIR variable.
|
---|
128 | LUSER_wrt_unpack "$pkg_tarball"
|
---|
129 | # If the testsuites must be run, initialize the log file
|
---|
130 | [[ "$TEST" = "3" ]] && LUSER_wrt_test_log "${this_script}"
|
---|
131 | # If using optimizations, write the instructions
|
---|
132 | [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
133 | fi
|
---|
134 |
|
---|
135 | # Insert date and disk usage at the top of the log file, the script run
|
---|
136 | # and date and disk usage again at the bottom of the log file.
|
---|
137 | # The changingowner script must be run as root.
|
---|
138 | case "${this_script}" in
|
---|
139 | *changingowner) wrt_RunAsRoot "$file" ;;
|
---|
140 | *) LUSER_wrt_RunAsUser "$file" ;;
|
---|
141 | esac
|
---|
142 |
|
---|
143 | # Remove the build directory(ies) except if the package build fails
|
---|
144 | # (so we can review config.cache, config.log, etc.)
|
---|
145 | if [ "$pkg_tarball" != "" ] ; then
|
---|
146 | LUSER_RemoveBuildDirs "$name"
|
---|
147 | fi
|
---|
148 |
|
---|
149 | # Include a touch of the target name so make can check
|
---|
150 | # if it's already been made.
|
---|
151 | wrt_touch
|
---|
152 | #
|
---|
153 | #--------------------------------------------------------------------#
|
---|
154 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
155 | #--------------------------------------------------------------------#
|
---|
156 |
|
---|
157 | # Keep the script file name for Makefile dependencies.
|
---|
158 | PREV=${this_script}
|
---|
159 | done # end for file in chapter05/*
|
---|
160 | }
|
---|
161 |
|
---|
162 |
|
---|
163 | #----------------------------#
|
---|
164 | chapter6_Makefiles() {
|
---|
165 | #----------------------------#
|
---|
166 |
|
---|
167 | # Set envars and scripts for iteration targets
|
---|
168 | LOGS="" # Start with an empty global LOGS envar
|
---|
169 | if [[ -z "$1" ]] ; then
|
---|
170 | local N=""
|
---|
171 | else
|
---|
172 | local N=-build_$1
|
---|
173 | local chapter6=""
|
---|
174 | mkdir chapter06$N
|
---|
175 | cp chapter06/* chapter06$N
|
---|
176 | for script in chapter06$N/* ; do
|
---|
177 | # Overwrite existing symlinks, files, and dirs
|
---|
178 | sed -e 's/ln -sv/&f/g' \
|
---|
179 | -e 's/mv -v/&f/g' \
|
---|
180 | -e 's/mkdir -v/&p/g' -i ${script}
|
---|
181 | done
|
---|
182 | # Remove Bzip2 binaries before make install
|
---|
183 | sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
|
---|
184 | fi
|
---|
185 |
|
---|
186 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}"
|
---|
187 |
|
---|
188 | for file in chapter06$N/* ; do
|
---|
189 | # Keep the script file name
|
---|
190 | this_script=`basename $file`
|
---|
191 |
|
---|
192 | # We'll run the chroot commands differently than the others, so skip them in the
|
---|
193 | # dependencies and target creation.
|
---|
194 | case "${this_script}" in
|
---|
195 | *chroot) continue ;;
|
---|
196 | *stripping*) [[ "${STRIP}" = "n" ]] && continue ;;
|
---|
197 | esac
|
---|
198 |
|
---|
199 | # Grab the name of the target
|
---|
200 | name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'`
|
---|
201 |
|
---|
202 | # Find the version of the command files, if it corresponds with the building of
|
---|
203 | # a specific package. We need this here to can skip scripts not needed for
|
---|
204 | # iterations rebuilds
|
---|
205 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
206 |
|
---|
207 | if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
|
---|
208 | case "${this_script}" in
|
---|
209 | *stripping*) ;;
|
---|
210 | *) continue ;;
|
---|
211 | esac
|
---|
212 | fi
|
---|
213 |
|
---|
214 | # Append each name of the script files to a list (this will become
|
---|
215 | # the names of the targets in the Makefile)
|
---|
216 | chapter6="$chapter6 ${this_script}${N}"
|
---|
217 |
|
---|
218 | # Append each name of the script files to a list (this will become
|
---|
219 | # the names of the logs to be moved for each iteration)
|
---|
220 | LOGS="$LOGS ${this_script}"
|
---|
221 |
|
---|
222 | #--------------------------------------------------------------------#
|
---|
223 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
224 | #--------------------------------------------------------------------#
|
---|
225 | #
|
---|
226 | # Drop in the name of the target on a new line, and the previous target
|
---|
227 | # as a dependency. Also call the echo_message function.
|
---|
228 | # In the mount of kernel filesystems we need to set LFS
|
---|
229 | # and not to use chroot.
|
---|
230 | case "${this_script}" in
|
---|
231 | *kernfs) LUSER_wrt_target "${this_script}" "$PREV" ;;
|
---|
232 | *) CHROOT_wrt_target "${this_script}${N}" "$PREV" ;;
|
---|
233 | esac
|
---|
234 |
|
---|
235 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
236 | # Insert instructions for unpacking the package and changing directories
|
---|
237 | if [ "$pkg_tarball" != "" ] ; then
|
---|
238 | CHROOT_Unpack "$pkg_tarball"
|
---|
239 | # If the testsuites must be run, initialize the log file
|
---|
240 | case $name in
|
---|
241 | binutils | gcc | glibc )
|
---|
242 | [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
|
---|
243 | ;;
|
---|
244 | * )
|
---|
245 | [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
|
---|
246 | ;;
|
---|
247 | esac
|
---|
248 | # If using optimizations, write the instructions
|
---|
249 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
250 | fi
|
---|
251 |
|
---|
252 | # In the mount of kernel filesystems we need to set LFS
|
---|
253 | # and not to use chroot.
|
---|
254 | case "${this_script}" in
|
---|
255 | *kernfs) wrt_RunAsRoot "$file" ;;
|
---|
256 | *) CHROOT_wrt_RunAsRoot "$file" ;;
|
---|
257 | esac
|
---|
258 |
|
---|
259 | # Remove the build directory(ies) except if the package build fails.
|
---|
260 | if [ "$pkg_tarball" != "" ] ; then
|
---|
261 | CHROOT_wrt_RemoveBuildDirs "$name"
|
---|
262 | fi
|
---|
263 |
|
---|
264 | # Include a touch of the target name so make can check
|
---|
265 | # if it's already been made.
|
---|
266 | wrt_touch
|
---|
267 | #
|
---|
268 | #--------------------------------------------------------------------#
|
---|
269 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
270 | #--------------------------------------------------------------------#
|
---|
271 |
|
---|
272 | # Keep the script file name for Makefile dependencies.
|
---|
273 | PREV=${this_script}${N}
|
---|
274 | # Set system_build envar for iteration targets
|
---|
275 | system_build=$chapter6
|
---|
276 | done # end for file in chapter06/*
|
---|
277 | }
|
---|
278 |
|
---|
279 | #----------------------------#
|
---|
280 | chapter789_Makefiles() {
|
---|
281 | #----------------------------#
|
---|
282 | echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7/8/9 ( BOOT ) ${R_arrow}"
|
---|
283 |
|
---|
284 | for file in chapter0{7,8,9}/* ; do
|
---|
285 | # Keep the script file name
|
---|
286 | this_script=`basename $file`
|
---|
287 |
|
---|
288 | # Grub must be configured manually.
|
---|
289 | # The filesystems can't be unmounted via Makefile and the user
|
---|
290 | # should enter the chroot environment to create the root
|
---|
291 | # password, edit several files and setup Grub.
|
---|
292 | #
|
---|
293 | # If no .config file is supplied, the kernel build is skipped
|
---|
294 | #
|
---|
295 | case ${this_script} in
|
---|
296 | *grub) continue ;;
|
---|
297 | *reboot) continue ;;
|
---|
298 | *console) continue ;; # Use the file generated by lfs-bootscripts
|
---|
299 | *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
---|
300 | *kernel) [[ -z ${CONFIG} ]] && continue
|
---|
301 | cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
|
---|
302 | esac
|
---|
303 |
|
---|
304 | # First append each name of the script files to a list (this will become
|
---|
305 | # the names of the targets in the Makefile
|
---|
306 | chapter789="$chapter789 ${this_script}"
|
---|
307 |
|
---|
308 | #--------------------------------------------------------------------#
|
---|
309 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
310 | #--------------------------------------------------------------------#
|
---|
311 | #
|
---|
312 | # Drop in the name of the target on a new line, and the previous target
|
---|
313 | # as a dependency. Also call the echo_message function.
|
---|
314 | CHROOT_wrt_target "${this_script}" "$PREV"
|
---|
315 |
|
---|
316 | # Find the bootscripts and kernel package names
|
---|
317 | case "${this_script}" in
|
---|
318 | *bootscripts)
|
---|
319 | name="lfs-bootscripts"
|
---|
320 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
321 | CHROOT_Unpack "$pkg_tarball"
|
---|
322 | ;;
|
---|
323 | *kernel)
|
---|
324 | name="linux"
|
---|
325 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
326 | CHROOT_Unpack "$pkg_tarball"
|
---|
327 | ;;
|
---|
328 | esac
|
---|
329 |
|
---|
330 | # Check if we have a real /etc/fstab file
|
---|
331 | case "${this_script}" in
|
---|
332 | *fstab) if [[ -n $FSTAB ]]; then
|
---|
333 | CHROOT_wrt_CopyFstab
|
---|
334 | else
|
---|
335 | CHROOT_wrt_RunAsRoot "$file"
|
---|
336 | fi
|
---|
337 | ;;
|
---|
338 | *) CHROOT_wrt_RunAsRoot "$file"
|
---|
339 | ;;
|
---|
340 | esac
|
---|
341 |
|
---|
342 | case "${this_script}" in
|
---|
343 | *bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy" ;;
|
---|
344 | *kernel) CHROOT_wrt_RemoveBuildDirs "dummy" ;;
|
---|
345 | esac
|
---|
346 |
|
---|
347 | # Include a touch of the target name so make can check
|
---|
348 | # if it's already been made.
|
---|
349 | wrt_touch
|
---|
350 | #
|
---|
351 | #--------------------------------------------------------------------#
|
---|
352 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
353 | #--------------------------------------------------------------------#
|
---|
354 |
|
---|
355 | # Keep the script file name for Makefile dependencies.
|
---|
356 | PREV=${this_script}
|
---|
357 | done # for file in chapter0{7,8,9}/*
|
---|
358 |
|
---|
359 | }
|
---|
360 |
|
---|
361 |
|
---|
362 |
|
---|
363 | #----------------------------#
|
---|
364 | build_Makefile() { #
|
---|
365 | #----------------------------#
|
---|
366 |
|
---|
367 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
368 |
|
---|
369 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
370 |
|
---|
371 | # Start with a clean Makefile.tmp file
|
---|
372 | >$MKFILE
|
---|
373 |
|
---|
374 | chapter4_Makefiles
|
---|
375 | chapter5_Makefiles
|
---|
376 | chapter6_Makefiles
|
---|
377 | # Add the iterations targets, if needed
|
---|
378 | [[ "$COMPARE" = "y" ]] && wrt_compare_targets
|
---|
379 | chapter789_Makefiles
|
---|
380 | # Add the BLFS_TOOL targets, if needed
|
---|
381 | [[ "$BLFS_TOOL" = "y" ]] && wrt_blfs_tool_targets
|
---|
382 |
|
---|
383 | # Add a header, some variables and include the function file
|
---|
384 | # to the top of the real Makefile.
|
---|
385 | wrt_Makefile_header
|
---|
386 |
|
---|
387 | # Add chroot commands
|
---|
388 | CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
---|
389 | i=1
|
---|
390 | for file in chapter06/*chroot* ; do
|
---|
391 | chroot=`cat $file | \
|
---|
392 | sed -e "s@chroot@$CHROOT_LOC@" \
|
---|
393 | -e '/#!\/bin\/bash/d' \
|
---|
394 | -e 's@ \\\@ @g' | \
|
---|
395 | tr -d '\n' | \
|
---|
396 | sed -e 's/ */ /g' \
|
---|
397 | -e 's|\\$|&&|g' \
|
---|
398 | -e 's|exit||g' \
|
---|
399 | -e 's|$| -c|' \
|
---|
400 | -e 's|"$$LFS"|$(MOUNT_PT)|' \
|
---|
401 | -e 's|set -e||'`
|
---|
402 | echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
---|
403 | i=`expr $i + 1`
|
---|
404 | done
|
---|
405 |
|
---|
406 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
407 | # as a dependency.
|
---|
408 | (
|
---|
409 | cat << EOF
|
---|
410 |
|
---|
411 | all: ck_UID mk_SETUP mk_LUSER mk_SUDO mk_CHROOT mk_BOOT create-sbu_du-report mk_BLFS_TOOL
|
---|
412 | @sudo make do_housekeeping
|
---|
413 | @\$(call echo_finished,$VERSION)
|
---|
414 |
|
---|
415 | ck_UID:
|
---|
416 | @if [ \`id -u\` = "0" ]; then \\
|
---|
417 | echo "--------------------------------------------------"; \\
|
---|
418 | echo "You cannot run this makefile from the root account"; \\
|
---|
419 | echo "--------------------------------------------------"; \\
|
---|
420 | exit 1; \\
|
---|
421 | fi
|
---|
422 |
|
---|
423 | mk_SETUP:
|
---|
424 | @\$(call echo_SU_request)
|
---|
425 | @sudo make SHELL=/bin/bash SETUP
|
---|
426 | @touch \$@
|
---|
427 |
|
---|
428 | mk_LUSER: mk_SETUP
|
---|
429 | @\$(call echo_SULUSER_request)
|
---|
430 | @( sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make SHELL=/bin/bash LUSER" )
|
---|
431 | @sudo make restore-luser-env
|
---|
432 | @touch \$@
|
---|
433 |
|
---|
434 | mk_SUDO: mk_LUSER
|
---|
435 | @sudo make SHELL=/bin/bash SUDO
|
---|
436 | touch \$@
|
---|
437 | #
|
---|
438 | # The convoluted piece of code below is necessary to provide 'make' with a valid shell in the
|
---|
439 | # chroot environment. (Unless someone knows a different way)
|
---|
440 | # Manually create the /bin directory and provide link to the /tools dir.
|
---|
441 | # Also change the original symlink creation to include (f)orce to prevent failure due to
|
---|
442 | # pre-existing links.
|
---|
443 | #
|
---|
444 | mk_CHROOT: mk_SUDO
|
---|
445 | @if [ ! -e \$(MOUNT_PT)/bin ]; then \\
|
---|
446 | mkdir \$(MOUNT_PT)/bin; \\
|
---|
447 | cd \$(MOUNT_PT)/bin && \\
|
---|
448 | ln -sf /tools/bin/bash bash; ln -sf bash sh; \\
|
---|
449 | sudo chown -R 0:0 \$(MOUNT_PT)/bin; \\
|
---|
450 | fi;
|
---|
451 | @sudo sed -e 's|^ln -sv |ln -svf |' -i \$(CMDSDIR)/chapter06/063-createfiles
|
---|
452 | @\$(call echo_CHROOT_request)
|
---|
453 | @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make CHROOT")
|
---|
454 | @touch \$@
|
---|
455 |
|
---|
456 | mk_BOOT: mk_CHROOT
|
---|
457 | @\$(call echo_CHROOT_request)
|
---|
458 | @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT")
|
---|
459 | @touch \$@
|
---|
460 |
|
---|
461 | mk_BLFS_TOOL: create-sbu_du-report
|
---|
462 | @\$(call echo_PHASE,Building BLFS-TOOLS)
|
---|
463 | @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
|
---|
464 | sudo mkdir -p $BUILDDIR$TRACKING_DIR; \\
|
---|
465 | sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BLFS_TOOL"; \\
|
---|
466 | fi;
|
---|
467 | @touch \$@
|
---|
468 |
|
---|
469 |
|
---|
470 | SETUP: $chapter4
|
---|
471 | LUSER: $chapter5
|
---|
472 | SUDO: 057-changingowner 059-kernfs
|
---|
473 | CHROOT: $chapter6
|
---|
474 | BOOT: $chapter789
|
---|
475 | BLFS_TOOL: $blfs_tool
|
---|
476 |
|
---|
477 |
|
---|
478 | create-sbu_du-report: mk_BOOT
|
---|
479 | @\$(call echo_message, Building)
|
---|
480 | @if [ "\$(ADD_REPORT)" = "y" ]; then \\
|
---|
481 | ./create-sbu_du-report.sh logs $VERSION; \\
|
---|
482 | \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
|
---|
483 | fi;
|
---|
484 | @touch \$@
|
---|
485 |
|
---|
486 | restore-luser-env:
|
---|
487 | @\$(call echo_message, Building)
|
---|
488 | @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
---|
489 | mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
---|
490 | fi;
|
---|
491 | @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
---|
492 | mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
---|
493 | fi;
|
---|
494 | @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
---|
495 | touch \$@ && \\
|
---|
496 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
497 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
498 |
|
---|
499 | do_housekeeping:
|
---|
500 | @-umount \$(MOUNT_PT)/sys
|
---|
501 | @-umount \$(MOUNT_PT)/proc
|
---|
502 | @-umount \$(MOUNT_PT)/dev/shm
|
---|
503 | @-umount \$(MOUNT_PT)/dev/pts
|
---|
504 | @-umount \$(MOUNT_PT)/dev
|
---|
505 | @-rm /tools
|
---|
506 | @-if [ ! -f luser-exist ]; then \\
|
---|
507 | userdel \$(LUSER); \\
|
---|
508 | rm -rf /home/\$(LUSER); \\
|
---|
509 | fi;
|
---|
510 |
|
---|
511 |
|
---|
512 | EOF
|
---|
513 | ) >> $MKFILE
|
---|
514 |
|
---|
515 | # Bring over the items from the Makefile.tmp
|
---|
516 | cat $MKFILE.tmp >> $MKFILE
|
---|
517 | rm $MKFILE.tmp
|
---|
518 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
519 | }
|
---|