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