1 | #!/bin/bash
|
---|
2 | # $Id$
|
---|
3 |
|
---|
4 | ###################################
|
---|
5 | ### FUNCTIONS ###
|
---|
6 | ###################################
|
---|
7 |
|
---|
8 |
|
---|
9 | #----------------------------#
|
---|
10 | host_prep_Makefiles() { # Initialization of the system
|
---|
11 | #----------------------------#
|
---|
12 | local CLFS_HOST
|
---|
13 |
|
---|
14 | echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
|
---|
15 |
|
---|
16 | # defined here, only for ease of reading
|
---|
17 | CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
|
---|
18 | (
|
---|
19 | cat << EOF
|
---|
20 |
|
---|
21 | 025-addinguser:
|
---|
22 | @\$(call echo_message, Building)
|
---|
23 | @if [ ! -d /home/\$(LUSER) ]; then \\
|
---|
24 | groupadd \$(LGROUP); \\
|
---|
25 | useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
---|
26 | else \\
|
---|
27 | touch luser-exist; \\
|
---|
28 | fi;
|
---|
29 | @touch \$@ && \\
|
---|
30 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
31 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
32 |
|
---|
33 | 026-settingenvironment: 025-addinguser
|
---|
34 | @\$(call echo_message, Building)
|
---|
35 | @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
---|
36 | mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
---|
37 | fi;
|
---|
38 | @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
---|
39 | mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
---|
40 | fi;
|
---|
41 | @echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
---|
42 | echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
---|
43 | echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
---|
44 | echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
---|
45 | echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
---|
46 | echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
---|
47 | echo "" >> /home/\$(LUSER)/.bashrc && \\
|
---|
48 | echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
---|
49 | echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
---|
50 | echo "" >> /home/\$(LUSER)/.bashrc && \\
|
---|
51 | echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\
|
---|
52 | echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\
|
---|
53 | echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
---|
54 | @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
---|
55 | touch envars && \\
|
---|
56 | chown \$(LUSER):\$(LGROUP) envars
|
---|
57 | @touch \$@ && \\
|
---|
58 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
59 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
60 |
|
---|
61 | 027-create-directories: 026-settingenvironment
|
---|
62 | @\$(call echo_message, Building)
|
---|
63 |
|
---|
64 | @mkdir -p \$(MOUNT_PT)/{bin,boot,dev,{etc/,}opt,home,lib,mnt}
|
---|
65 | @mkdir -p \$(MOUNT_PT)/{proc,media/{floppy,cdrom},sbin,srv,sys}
|
---|
66 | @mkdir -p \$(MOUNT_PT)/var/{lock,log,mail,run,spool}
|
---|
67 | @mkdir -p \$(MOUNT_PT)/var/{opt,cache,lib/{misc,locate},local}
|
---|
68 | @install -d -m 0750 \$(MOUNT_PT)/root
|
---|
69 | @install -d -m 1777 \$(MOUNT_PT){/var,}/tmp
|
---|
70 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}{bin,include,lib,sbin,src}
|
---|
71 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{doc,info,locale,man}
|
---|
72 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{misc,terminfo,zoneinfo}
|
---|
73 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8}
|
---|
74 | @for dir in \$(MOUNT_PT)/usr{,/local}; do \\
|
---|
75 | ln -s share/{man,doc,info} \$\$dir ; \\
|
---|
76 | done
|
---|
77 |
|
---|
78 | @touch \$@ && \\
|
---|
79 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
80 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
81 |
|
---|
82 | 028-creating-sysfile: 027-create-directories
|
---|
83 | @\$(call echo_message, Building)
|
---|
84 |
|
---|
85 | @touch \$(MOUNT_PT)/etc/mtab
|
---|
86 | @echo "root::0:0:root:/root:/bin/bash" >> \$(MOUNT_PT)/etc/passwd
|
---|
87 | @echo "root:x:0:" >> \$(MOUNT_PT)/etc/group
|
---|
88 | @echo "bin:x:1:" >> \$(MOUNT_PT)/etc/group
|
---|
89 | @echo "sys:x:2:" >> \$(MOUNT_PT)/etc/group
|
---|
90 | @echo "kmem:x:3" >> \$(MOUNT_PT)/etc/group
|
---|
91 | @echo "tty:x:4:" >> \$(MOUNT_PT)/etc/group
|
---|
92 | @echo "tape:x:5:" >> \$(MOUNT_PT)/etc/group
|
---|
93 | @echo "daemon:x:6:" >> \$(MOUNT_PT)/etc/group
|
---|
94 | @echo "floppy:x:7:" >> \$(MOUNT_PT)/etc/group
|
---|
95 | @echo "disk:x:8:" >> \$(MOUNT_PT)/etc/group
|
---|
96 | @echo "lp:x:9:" >> \$(MOUNT_PT)/etc/group
|
---|
97 | @echo "dialout:x:10:" >> \$(MOUNT_PT)/etc/group
|
---|
98 | @echo "audio:x:11:" >> \$(MOUNT_PT)/etc/group
|
---|
99 | @echo "video:x:12:" >> \$(MOUNT_PT)/etc/group
|
---|
100 | @echo "utmp:x:13:" >> \$(MOUNT_PT)/etc/group
|
---|
101 | @echo "usb:x:14:" >> \$(MOUNT_PT)/etc/group
|
---|
102 | @echo "cdrom:x:15:" >> \$(MOUNT_PT)/etc/group
|
---|
103 |
|
---|
104 | @touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
|
---|
105 | @chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
|
---|
106 | @chown -R \$(LUSER) \$(MOUNT_PT)
|
---|
107 |
|
---|
108 | @touch \$@ && \\
|
---|
109 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
110 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
111 |
|
---|
112 | EOF
|
---|
113 | ) >> $MKFILE.tmp
|
---|
114 |
|
---|
115 | host_prep=" 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile"
|
---|
116 | }
|
---|
117 |
|
---|
118 |
|
---|
119 | #-----------------------------#
|
---|
120 | cross_tools_Makefiles() { #
|
---|
121 | #-----------------------------#
|
---|
122 | echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
|
---|
123 |
|
---|
124 | for file in cross-tools/* ; do
|
---|
125 | # Keep the script file name
|
---|
126 | this_script=`basename $file`
|
---|
127 | #
|
---|
128 | # Skip this script...
|
---|
129 | case $this_script in
|
---|
130 | *cflags* | *variables* ) # work done in host_prep_Makefiles
|
---|
131 | continue ;;
|
---|
132 | *) ;;
|
---|
133 | esac
|
---|
134 |
|
---|
135 | #
|
---|
136 | # Set the dependency for the first target.
|
---|
137 | if [ -z $PREV ] ; then PREV=028-creating-sysfile ; fi
|
---|
138 |
|
---|
139 | # First append each name of the script files to a list (this will become
|
---|
140 | # the names of the targets in the Makefile
|
---|
141 | cross_tools="$cross_tools $this_script"
|
---|
142 |
|
---|
143 | # Grab the name of the target (minus the -headers or -cross in the case of gcc
|
---|
144 | # and binutils in chapter 5)
|
---|
145 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
146 | -e 's@-static@@' \
|
---|
147 | -e 's@-final@@' \
|
---|
148 | -e 's@-64@@' \
|
---|
149 | -e 's@-n32@@'`
|
---|
150 | case $name in
|
---|
151 | glibc-headers) name="glibc" ;;
|
---|
152 | esac
|
---|
153 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
154 | #--------------------------------------------------------------------#
|
---|
155 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
156 | #--------------------------------------------------------------------#
|
---|
157 | #
|
---|
158 | # Drop in the name of the target on a new line, and the previous target
|
---|
159 | # as a dependency. Also call the echo_message function.
|
---|
160 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
161 | #
|
---|
162 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
163 | if [ "$pkg_tarball" != "" ] ; then
|
---|
164 | LUSER_wrt_unpack "$pkg_tarball"
|
---|
165 | # If using optimizations, write the instructions
|
---|
166 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
167 | fi
|
---|
168 | #
|
---|
169 | LUSER_wrt_RunAsUser "${file}"
|
---|
170 | #
|
---|
171 | [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
---|
172 | #
|
---|
173 | # Include a touch of the target name so make can check if it's already been made.
|
---|
174 | wrt_touch
|
---|
175 | #
|
---|
176 | #--------------------------------------------------------------------#
|
---|
177 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
178 | #--------------------------------------------------------------------#
|
---|
179 | #
|
---|
180 | # Keep the script file name for Makefile dependencies.
|
---|
181 | PREV=$this_script
|
---|
182 |
|
---|
183 | done # for file in ....
|
---|
184 | }
|
---|
185 |
|
---|
186 |
|
---|
187 |
|
---|
188 | #-----------------------------#
|
---|
189 | final_system_Makefiles() { #
|
---|
190 | #-----------------------------#
|
---|
191 | echo "${tab_}${GREEN}Processing... ${L_arrow}final system ( LUSER ) ${R_arrow}"
|
---|
192 |
|
---|
193 | for file in final-system/* ; do
|
---|
194 | # Keep the script file name
|
---|
195 | this_script=`basename $file`
|
---|
196 |
|
---|
197 | # Test if the stripping phase must be skipped.
|
---|
198 | # Skip alsp temp-perl for iterative runs
|
---|
199 | case $this_script in
|
---|
200 | *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
|
---|
201 | esac
|
---|
202 |
|
---|
203 | # Grab the name of the target, strip id number, XXX-script
|
---|
204 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
205 | -e 's@temp-@@' \
|
---|
206 | -e 's@-64bit@@' \
|
---|
207 | -e 's@-64@@' \
|
---|
208 | -e 's@64@@' \
|
---|
209 | -e 's@n32@@'`
|
---|
210 |
|
---|
211 | # Find the version of the command files, if it corresponds with the building of
|
---|
212 | # a specific package.
|
---|
213 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
214 |
|
---|
215 | # Append each name of the script files to a list (this will become
|
---|
216 | # the names of the targets in the Makefile
|
---|
217 | basicsystem="$basicsystem ${this_script}"
|
---|
218 |
|
---|
219 | #--------------------------------------------------------------------#
|
---|
220 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
221 | #--------------------------------------------------------------------#
|
---|
222 | #
|
---|
223 | # Drop in the name of the target on a new line, and the previous target
|
---|
224 | # as a dependency. Also call the echo_message function.
|
---|
225 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
226 | #
|
---|
227 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
228 | if [ "$pkg_tarball" != "" ] ; then
|
---|
229 | LUSER_wrt_unpack "$pkg_tarball"
|
---|
230 | # If using optimizations, write the instructions
|
---|
231 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
232 | fi
|
---|
233 | #
|
---|
234 | LUSER_wrt_RunAsUser "${file}"
|
---|
235 | #
|
---|
236 | [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
---|
237 | #
|
---|
238 | # Include a touch of the target name so make can check if it's already been made.
|
---|
239 | wrt_touch
|
---|
240 | #
|
---|
241 | #--------------------------------------------------------------------#
|
---|
242 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
243 | #--------------------------------------------------------------------#
|
---|
244 | #
|
---|
245 | # Keep the script file name for Makefile dependencies.
|
---|
246 | PREV=${this_script}
|
---|
247 | done # for file in final-system/* ...
|
---|
248 | }
|
---|
249 |
|
---|
250 |
|
---|
251 |
|
---|
252 | #-----------------------------#
|
---|
253 | bootscripts_Makefiles() { #
|
---|
254 | #-----------------------------#
|
---|
255 | echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts ( LUSER ) ${R_arrow}"
|
---|
256 |
|
---|
257 | for file in bootscripts/* ; do
|
---|
258 | # Keep the script file name
|
---|
259 | this_script=`basename $file`
|
---|
260 |
|
---|
261 | case $this_script in
|
---|
262 | *udev) continue ;; # This is not a script but a commentary, we want udev-rules
|
---|
263 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
264 | *network*) continue ;; # Manually create these files
|
---|
265 | *) ;;
|
---|
266 | esac
|
---|
267 |
|
---|
268 | # First append each name of the script files to a list (this will become
|
---|
269 | # the names of the targets in the Makefile
|
---|
270 | bootscripttools="$bootscripttools $this_script"
|
---|
271 |
|
---|
272 | # Grab the name of the target, strip id number, XXX-script
|
---|
273 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
274 | -e 's@-64bit@@' \
|
---|
275 | -e 's@-64@@' \
|
---|
276 | -e 's@64@@' \
|
---|
277 | -e 's@n32@@'`
|
---|
278 | case $name in
|
---|
279 | *bootscripts*) name=bootscripts-cross-lfs ;;
|
---|
280 | *udev-rules) name=udev-cross-lfs ;;
|
---|
281 | esac
|
---|
282 |
|
---|
283 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
284 |
|
---|
285 | #--------------------------------------------------------------------#
|
---|
286 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
287 | #--------------------------------------------------------------------#
|
---|
288 | #
|
---|
289 | # Drop in the name of the target on a new line, and the previous target
|
---|
290 | # as a dependency. Also call the echo_message function.
|
---|
291 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
292 | #
|
---|
293 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
294 | [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
---|
295 | #
|
---|
296 | LUSER_wrt_RunAsUser "${file}"
|
---|
297 | #
|
---|
298 | [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
---|
299 | #
|
---|
300 | # Include a touch of the target name so make can check if it's already been made.
|
---|
301 | wrt_touch
|
---|
302 | #
|
---|
303 | #--------------------------------------------------------------------#
|
---|
304 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
305 | #--------------------------------------------------------------------#
|
---|
306 | #
|
---|
307 | # Keep the script file name for Makefile dependencies.
|
---|
308 | PREV=$this_script
|
---|
309 |
|
---|
310 | done # for file in bootscripts/* ...
|
---|
311 |
|
---|
312 | }
|
---|
313 |
|
---|
314 |
|
---|
315 | #-----------------------------#
|
---|
316 | bootable_Makefiles() { #
|
---|
317 | #-----------------------------#
|
---|
318 | echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable ( LUSER ) ${R_arrow}"
|
---|
319 |
|
---|
320 | for file in bootable/* ; do
|
---|
321 | # Keep the script file name
|
---|
322 | this_script=`basename $file`
|
---|
323 |
|
---|
324 | # A little housekeeping on the scripts
|
---|
325 | case $this_script in
|
---|
326 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
---|
327 | *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
---|
328 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
329 | [[ -z $CONFIG ]] && continue
|
---|
330 | # Copy the config file to /sources with a standardized name
|
---|
331 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
332 | ;;
|
---|
333 | esac
|
---|
334 | #
|
---|
335 | # First append each name of the script files to a list (this will become
|
---|
336 | # the names of the targets in the Makefile
|
---|
337 | # NOTE: new makfile format forces the last script, *chowning, into a separate
|
---|
338 | # phase.
|
---|
339 | case ${this_script} in
|
---|
340 | *chowning) chowning=${this_script} ;;
|
---|
341 | *) bootable="$bootable $this_script" ;;
|
---|
342 | esac
|
---|
343 | #
|
---|
344 | # Grab the name of the target, strip id number and misc words.
|
---|
345 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
346 | case $this_script in
|
---|
347 | *kernel*) name=linux
|
---|
348 | ;;
|
---|
349 | esac
|
---|
350 |
|
---|
351 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
352 |
|
---|
353 | #--------------------------------------------------------------------#
|
---|
354 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
355 | #--------------------------------------------------------------------#
|
---|
356 | #
|
---|
357 | # Drop in the name of the target on a new line, and the previous target
|
---|
358 | # as a dependency. Also call the echo_message function.
|
---|
359 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
360 | #
|
---|
361 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
362 | [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
---|
363 | #
|
---|
364 | # Select a script execution method
|
---|
365 | case $this_script in
|
---|
366 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
367 | LUSER_wrt_CopyFstab
|
---|
368 | else
|
---|
369 | LUSER_wrt_RunAsUser "${file}"
|
---|
370 | fi
|
---|
371 | ;;
|
---|
372 | *chowning) wrt_RunAsRoot "${file}"
|
---|
373 | ;;
|
---|
374 | *) LUSER_wrt_RunAsUser "${file}"
|
---|
375 | ;;
|
---|
376 | esac
|
---|
377 | #
|
---|
378 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
379 | [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
---|
380 | #
|
---|
381 | # Include a touch of the target name so make can check if it's already been made.
|
---|
382 | wrt_touch
|
---|
383 | #
|
---|
384 | #--------------------------------------------------------------------#
|
---|
385 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
386 | #--------------------------------------------------------------------#
|
---|
387 | #
|
---|
388 | # Keep the script file name for Makefile dependencies.
|
---|
389 | PREV=$this_script
|
---|
390 |
|
---|
391 | done
|
---|
392 |
|
---|
393 | }
|
---|
394 |
|
---|
395 |
|
---|
396 | #-----------------------------#
|
---|
397 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
398 | #-----------------------------#
|
---|
399 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
400 |
|
---|
401 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
402 | # Start with a clean Makefile.tmp file
|
---|
403 | >$MKFILE.tmp
|
---|
404 |
|
---|
405 | host_prep_Makefiles
|
---|
406 | cross_tools_Makefiles # $cross_tools
|
---|
407 | final_system_Makefiles # $basicsystem
|
---|
408 | bootscripts_Makefiles # $bootscripttools
|
---|
409 | bootable_Makefiles # $bootable
|
---|
410 |
|
---|
411 | # Add a header, some variables and include the function file
|
---|
412 | # to the top of the real Makefile.
|
---|
413 | wrt_Makefile_header
|
---|
414 |
|
---|
415 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
416 | # as a dependency.
|
---|
417 | (
|
---|
418 | cat << EOF
|
---|
419 |
|
---|
420 | all: ck_UID mk_SETUP mk_LUSER mk_ROOT create-sbu_du-report
|
---|
421 | @sudo make do-housekeeping
|
---|
422 | @\$(call echo_finished,$VERSION)
|
---|
423 |
|
---|
424 | ck_UID:
|
---|
425 | @if [ \`id -u\` = "0" ]; then \\
|
---|
426 | echo "--------------------------------------------------"; \\
|
---|
427 | echo "You cannot run this makefile from the root account"; \\
|
---|
428 | echo "--------------------------------------------------"; \\
|
---|
429 | exit 1; \\
|
---|
430 | fi
|
---|
431 |
|
---|
432 | mk_SETUP:
|
---|
433 | @\$(call echo_SU_request)
|
---|
434 | @sudo make SHELL=/bin/bash SETUP
|
---|
435 | @touch \$@
|
---|
436 |
|
---|
437 | mk_LUSER: mk_SETUP
|
---|
438 | @\$(call echo_SULUSER_request)
|
---|
439 | @(sudo \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make SHELL=/bin/bash LUSER" )
|
---|
440 | @sudo make restore-luser-env
|
---|
441 | @touch \$@
|
---|
442 |
|
---|
443 | mk_ROOT:
|
---|
444 | @sudo make SHELL=/bin/bash ROOT
|
---|
445 | @touch \$@
|
---|
446 |
|
---|
447 | SETUP: $host_prep
|
---|
448 | LUSER: $cross_tools $basicsystem $bootscripttools $bootable
|
---|
449 | ROOT: $chowning
|
---|
450 |
|
---|
451 |
|
---|
452 | create-sbu_du-report: ROOT
|
---|
453 | @\$(call echo_message, Building)
|
---|
454 | @if [ "\$(ADD_REPORT)" = "y" ]; then \\
|
---|
455 | ./create-sbu_du-report.sh logs $VERSION; \\
|
---|
456 | \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
|
---|
457 | fi;
|
---|
458 | @touch \$@
|
---|
459 |
|
---|
460 | restore-luser-env:
|
---|
461 | @\$(call echo_message, Building)
|
---|
462 | @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
---|
463 | mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
---|
464 | fi;
|
---|
465 | @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
---|
466 | mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
---|
467 | fi;
|
---|
468 | @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
---|
469 | touch \$@ && \\
|
---|
470 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
471 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
472 |
|
---|
473 | do-housekeeping:
|
---|
474 | @-if [ ! -f luser-exist ]; then \\
|
---|
475 | userdel \$(LUSER); \\
|
---|
476 | rm -rf /home/\$(LUSER); \\
|
---|
477 | fi;
|
---|
478 |
|
---|
479 | EOF
|
---|
480 | ) >> $MKFILE
|
---|
481 |
|
---|
482 | # Bring over the items from the Makefile.tmp
|
---|
483 | cat $MKFILE.tmp >> $MKFILE
|
---|
484 | rm $MKFILE.tmp
|
---|
485 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
486 |
|
---|
487 | }
|
---|