[91ff6a9] | 1 | #!/bin/bash
|
---|
[877cc6a] | 2 | # $Id$
|
---|
| 3 |
|
---|
[045b2dc] | 4 |
|
---|
| 5 | orphan_scripts="" # 2 scripts do not fit BOOT_Makefiles LUSER environment
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | #--------------------------------------#
|
---|
| 9 | host_prep_Makefiles() { #
|
---|
| 10 | #--------------------------------------#
|
---|
[e2ec07a] | 11 | local CLFS_HOST
|
---|
[877cc6a] | 12 |
|
---|
[045b2dc] | 13 | echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files ( SETUP ) ${R_arrow}"
|
---|
[877cc6a] | 14 |
|
---|
| 15 | # defined here, only for ease of reading
|
---|
[ff4d1ab] | 16 | CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
|
---|
[877cc6a] | 17 | (
|
---|
| 18 | cat << EOF
|
---|
| 19 | 023-creatingtoolsdir:
|
---|
| 20 | @\$(call echo_message, Building)
|
---|
[269d81c] | 21 | @install -dv \$(MOUNT_PT)/tools && \\
|
---|
[e314f7e] | 22 | rm -f /tools && \\
|
---|
[dbcdfd7] | 23 | ln -s \$(MOUNT_PT)/tools /
|
---|
| 24 | @\$(call housekeeping)
|
---|
[877cc6a] | 25 |
|
---|
| 26 | 024-creatingcrossdir: 023-creatingtoolsdir
|
---|
[9ae0875] | 27 | @\$(call echo_message, Building)
|
---|
[269d81c] | 28 | @install -dv \$(MOUNT_PT)/cross-tools && \\
|
---|
[e314f7e] | 29 | rm -f /cross-tools && \\
|
---|
[dbcdfd7] | 30 | ln -s \$(MOUNT_PT)/cross-tools /
|
---|
| 31 | @\$(call housekeeping)
|
---|
[877cc6a] | 32 |
|
---|
| 33 | 025-addinguser: 024-creatingcrossdir
|
---|
| 34 | @\$(call echo_message, Building)
|
---|
[962793a] | 35 | @if [ ! -d \$(LUSER_HOME) ]; then \\
|
---|
[269d81c] | 36 | groupadd \$(LGROUP); \\
|
---|
| 37 | useradd -s /bin/bash -g \$(LGROUP) -d \$(LUSER_HOME) \$(LUSER); \\
|
---|
| 38 | mkdir -pv \$(LUSER_HOME); \\
|
---|
| 39 | chown -v \$(LUSER):\$(LGROUP) \$(LUSER_HOME); \\
|
---|
[877cc6a] | 40 | else \\
|
---|
[269d81c] | 41 | touch luser-exist; \\
|
---|
| 42 | fi
|
---|
| 43 | @chown -v \$(LUSER) \$(MOUNT_PT)/tools && \\
|
---|
| 44 | chown -v \$(LUSER) \$(MOUNT_PT)/cross-tools && \\
|
---|
[9ae0875] | 45 | chmod -R a+wt \$(MOUNT_PT)/\$(SCRIPT_ROOT) && \\
|
---|
[dbcdfd7] | 46 | chmod a+wt \$(SRCSDIR)
|
---|
| 47 | @\$(call housekeeping)
|
---|
[877cc6a] | 48 |
|
---|
| 49 | 026-settingenvironment: 025-addinguser
|
---|
| 50 | @\$(call echo_message, Building)
|
---|
[962793a] | 51 | @if [ -f \$(LUSER_HOME)/.bashrc -a ! -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
---|
| 52 | mv \$(LUSER_HOME)/.bashrc \$(LUSER_HOME)/.bashrc.XXX; \\
|
---|
[269d81c] | 53 | fi
|
---|
[962793a] | 54 | @if [ -f \$(LUSER_HOME)/.bash_profile -a ! -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
---|
| 55 | mv \$(LUSER_HOME)/.bash_profile \$(LUSER_HOME)/.bash_profile.XXX; \\
|
---|
[877cc6a] | 56 | fi;
|
---|
[962793a] | 57 | @echo "set +h" > \$(LUSER_HOME)/.bashrc && \\
|
---|
| 58 | echo "umask 022" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 59 | echo "CLFS=\$(MOUNT_PT)" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 60 | echo "LC_ALL=POSIX" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 61 | echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 62 | echo "export CLFS LC_ALL PATH" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 63 | echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 64 | echo "unset CFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 65 | echo "unset CXXFLAGS" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 66 | echo "" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
[3f83cb0] | 67 | EOF
|
---|
| 68 | ) >> $MKFILE.tmp
|
---|
| 69 | if ! [ -e final-preps/*variables ]; then
|
---|
| 70 | (
|
---|
| 71 | cat << EOF
|
---|
[962793a] | 72 | echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 73 | echo "export CLFS_TARGET=\"${TARGET}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
| 74 | echo "export CLFS_TARGET32=\"${TARGET32}\"" >> \$(LUSER_HOME)/.bashrc && \\
|
---|
[3f83cb0] | 75 | EOF
|
---|
| 76 | ) >> $MKFILE.tmp
|
---|
| 77 | fi
|
---|
| 78 | (
|
---|
| 79 | cat << EOF
|
---|
[962793a] | 80 | echo "source $JHALFSDIR/envars" >> \$(LUSER_HOME)/.bashrc
|
---|
| 81 | @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bashrc && \\
|
---|
[e18f80a] | 82 | chmod a+wt \$(MOUNT_PT) && \\
|
---|
[b2c7742] | 83 | if [ -d \$(MOUNT_PT)/var ]; then \\
|
---|
| 84 | chown -R \$(LUSER) \$(MOUNT_PT)/var; \\
|
---|
| 85 | fi && \\
|
---|
[877cc6a] | 86 | touch envars && \\
|
---|
[e18f80a] | 87 | chown \$(LUSER):\$(LGROUP) envars
|
---|
[dbcdfd7] | 88 | @\$(call housekeeping)
|
---|
[877cc6a] | 89 | EOF
|
---|
| 90 | ) >> $MKFILE.tmp
|
---|
[045b2dc] | 91 | host_prep=" 023-creatingtoolsdir 024-creatingcrossdir 026-settingenvironment"
|
---|
[877cc6a] | 92 |
|
---|
| 93 | }
|
---|
| 94 |
|
---|
[3f83cb0] | 95 | #--------------------------------------#
|
---|
| 96 | final_preps_Makefiles() {
|
---|
| 97 | #--------------------------------------#
|
---|
| 98 | echo "${tab_}${GREEN}Processing... ${L_arrow}variables ( LUSER ) ${R_arrow}"
|
---|
| 99 | for file in final-preps/* ; do
|
---|
| 100 | this_script=`basename $file`
|
---|
| 101 | case $this_script in
|
---|
| 102 | *variables )
|
---|
| 103 | ;;
|
---|
| 104 | *) continue; ;;
|
---|
| 105 | esac
|
---|
| 106 | # Set the dependency for the first target.
|
---|
| 107 | if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
|
---|
| 108 |
|
---|
| 109 | # First append each name of the script files to a list (this will become
|
---|
| 110 | # the names of the targets in the Makefile
|
---|
| 111 | final_preps="$final_preps $this_script"
|
---|
| 112 |
|
---|
| 113 | # No need to grab the package name
|
---|
| 114 |
|
---|
| 115 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
| 116 | LUSER_wrt_RunAsUser "${file}"
|
---|
| 117 | wrt_touch
|
---|
| 118 | PREV=$this_script
|
---|
| 119 | done # for file in ....
|
---|
| 120 | }
|
---|
| 121 |
|
---|
[045b2dc] | 122 | #--------------------------------------#
|
---|
| 123 | cross_tools_Makefiles() { #
|
---|
| 124 | #--------------------------------------#
|
---|
| 125 | echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools ( LUSER ) ${R_arrow}"
|
---|
[877cc6a] | 126 |
|
---|
| 127 | for file in cross-tools/* ; do
|
---|
| 128 | # Keep the script file name
|
---|
| 129 | this_script=`basename $file`
|
---|
| 130 | #
|
---|
| 131 | # Skip this script...
|
---|
| 132 | case $this_script in
|
---|
| 133 | *cflags* | *variables* ) # work done in host_prep_Makefiles
|
---|
| 134 | continue; ;;
|
---|
| 135 | *) ;;
|
---|
| 136 | esac
|
---|
| 137 | #
|
---|
| 138 | # Set the dependency for the first target.
|
---|
| 139 | if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
|
---|
| 140 |
|
---|
| 141 | # First append each name of the script files to a list (this will become
|
---|
| 142 | # the names of the targets in the Makefile
|
---|
| 143 | cross_tools="$cross_tools $this_script"
|
---|
| 144 |
|
---|
| 145 | # Grab the name of the target (minus the -headers or -cross in the case of gcc
|
---|
| 146 | # and binutils in chapter 5)
|
---|
| 147 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 148 | -e 's@-static@@' \
|
---|
| 149 | -e 's@-final@@' \
|
---|
[480295c] | 150 | -e 's@-64@@' \
|
---|
[82808d1] | 151 | -e 's@-n32@@' \
|
---|
| 152 | -e 's@-pass1@@'`
|
---|
[a160d86] | 153 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
[877cc6a] | 154 |
|
---|
| 155 | #--------------------------------------------------------------------#
|
---|
| 156 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 157 | #--------------------------------------------------------------------#
|
---|
| 158 | #
|
---|
| 159 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 160 | # as a dependency. Also call the echo_message function.
|
---|
[045b2dc] | 161 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
[877cc6a] | 162 | #
|
---|
[a160d86] | 163 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
[877cc6a] | 164 | #
|
---|
[045b2dc] | 165 | [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
---|
[ce262a7] | 166 | [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = 3 ]] && wrt_makeflags "${name}"
|
---|
[877cc6a] | 167 | #
|
---|
[045b2dc] | 168 | LUSER_wrt_RunAsUser "${file}"
|
---|
[877cc6a] | 169 | #
|
---|
[045b2dc] | 170 | [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
---|
[877cc6a] | 171 | #
|
---|
| 172 | # Include a touch of the target name so make can check if it's already been made.
|
---|
[93f38e7] | 173 | wrt_touch
|
---|
[877cc6a] | 174 | #
|
---|
| 175 | #--------------------------------------------------------------------#
|
---|
| 176 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 177 | #--------------------------------------------------------------------#
|
---|
| 178 | #
|
---|
| 179 | # Keep the script file name for Makefile dependencies.
|
---|
| 180 | PREV=$this_script
|
---|
| 181 |
|
---|
| 182 | done # for file in ....
|
---|
| 183 | }
|
---|
| 184 |
|
---|
[045b2dc] | 185 | #--------------------------------------#
|
---|
| 186 | temptools_Makefiles() { #
|
---|
| 187 | #--------------------------------------#
|
---|
| 188 | echo "${tab_}${GREEN}Processing... ${L_arrow}temp system ( LUSER ) ${R_arrow}"
|
---|
[877cc6a] | 189 |
|
---|
| 190 | for file in temp-system/* ; do
|
---|
| 191 | # Keep the script file name
|
---|
| 192 | this_script=`basename $file`
|
---|
[6f2cd96] | 193 | #
|
---|
| 194 | # Deal with any odd scripts..
|
---|
| 195 | case $this_script in
|
---|
| 196 | *choose) # The choose script will fail if you cannot enter the new environment
|
---|
| 197 | # If the 'boot' build method was chosen don't run the script
|
---|
| 198 | [[ $METHOD = "boot" ]] && continue; ;;
|
---|
| 199 | *) ;;
|
---|
| 200 | esac
|
---|
[e2ec07a] | 201 |
|
---|
[877cc6a] | 202 | #
|
---|
| 203 | # First append each name of the script files to a list (this will become
|
---|
| 204 | # the names of the targets in the Makefile
|
---|
| 205 | temptools="$temptools $this_script"
|
---|
| 206 |
|
---|
| 207 | #
|
---|
| 208 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 209 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 210 | #
|
---|
[a160d86] | 211 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
[877cc6a] | 212 |
|
---|
| 213 | #--------------------------------------------------------------------#
|
---|
| 214 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 215 | #--------------------------------------------------------------------#
|
---|
| 216 | #
|
---|
| 217 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 218 | # as a dependency. Also call the echo_message function.
|
---|
[045b2dc] | 219 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
[877cc6a] | 220 | #
|
---|
[a160d86] | 221 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
[877cc6a] | 222 | # Insert instructions for unpacking the package and to set the PKGDIR variable.
|
---|
| 223 | #
|
---|
[045b2dc] | 224 | [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
---|
[ce262a7] | 225 | [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[877cc6a] | 226 | #
|
---|
[045b2dc] | 227 | LUSER_wrt_RunAsUser "${file}"
|
---|
[877cc6a] | 228 | #
|
---|
[045b2dc] | 229 | [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
---|
[877cc6a] | 230 | #
|
---|
| 231 | # Include a touch of the target name so make can check if it's already been made.
|
---|
[93f38e7] | 232 | wrt_touch
|
---|
[877cc6a] | 233 | #
|
---|
| 234 | #--------------------------------------------------------------------#
|
---|
| 235 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 236 | #--------------------------------------------------------------------#
|
---|
| 237 | #
|
---|
| 238 | # Keep the script file name for Makefile dependencies.
|
---|
| 239 | PREV=$this_script
|
---|
| 240 | done # for file in ....
|
---|
| 241 | }
|
---|
| 242 |
|
---|
| 243 |
|
---|
[045b2dc] | 244 | #--------------------------------------#
|
---|
| 245 | chroot_Makefiles() { #
|
---|
| 246 | #--------------------------------------#
|
---|
| 247 | echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools CHROOT ( CHROOT ) ${R_arrow}"
|
---|
[877cc6a] | 248 |
|
---|
[045b2dc] | 249 | for file in chroot/* ; do
|
---|
[877cc6a] | 250 | # Keep the script file name
|
---|
| 251 | this_script=`basename $file`
|
---|
[045b2dc] | 252 | #
|
---|
| 253 | # Skipping scripts is done now and not included in the build tree.
|
---|
[877cc6a] | 254 | case $this_script in
|
---|
[045b2dc] | 255 | *chroot*) continue ;;
|
---|
[877cc6a] | 256 | esac
|
---|
[045b2dc] | 257 |
|
---|
[877cc6a] | 258 | #
|
---|
| 259 | # First append each name of the script files to a list (this will become
|
---|
| 260 | # the names of the targets in the Makefile
|
---|
[045b2dc] | 261 | case "${this_script}" in
|
---|
| 262 | *kernfs) orphan_scripts="${orphan_scripts} ${this_script}" ;;
|
---|
| 263 | *) chroottools="$chroottools $this_script" ;;
|
---|
[877cc6a] | 264 | esac
|
---|
[045b2dc] | 265 |
|
---|
| 266 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 267 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 268 |
|
---|
[a160d86] | 269 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
| 270 |
|
---|
[045b2dc] | 271 | # This is very ugly:: util-linux is in /chroot but must be run under LUSER
|
---|
[608fbe1] | 272 | # Same for e2fsprogs (in CLFS 1.1.0)
|
---|
[045b2dc] | 273 | # .. Customized makefile entry
|
---|
| 274 | case "${this_script}" in
|
---|
| 275 | *util-linux)
|
---|
| 276 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
| 277 | LUSER_wrt_unpack "$pkg_tarball"
|
---|
[ce262a7] | 278 | [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[045b2dc] | 279 | LUSER_wrt_RunAsUser "${file}"
|
---|
| 280 | LUSER_RemoveBuildDirs "${name}"
|
---|
| 281 | wrt_touch
|
---|
[480295c] | 282 | temptools="$temptools $this_script"
|
---|
| 283 | continue ;;
|
---|
[608fbe1] | 284 | *util-linux-ng)
|
---|
| 285 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
| 286 | LUSER_wrt_unpack "$pkg_tarball"
|
---|
[ce262a7] | 287 | [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[608fbe1] | 288 | LUSER_wrt_RunAsUser "${file}"
|
---|
| 289 | LUSER_RemoveBuildDirs "${name}"
|
---|
| 290 | wrt_touch
|
---|
| 291 | temptools="$temptools $this_script"
|
---|
| 292 | continue ;;
|
---|
| 293 | *util-linux-libs)
|
---|
| 294 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
| 295 | LUSER_wrt_unpack "$pkg_tarball"
|
---|
[ce262a7] | 296 | [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[608fbe1] | 297 | LUSER_wrt_RunAsUser "${file}"
|
---|
| 298 | LUSER_RemoveBuildDirs "${name}"
|
---|
| 299 | wrt_touch
|
---|
| 300 | temptools="$temptools $this_script"
|
---|
| 301 | continue ;;
|
---|
| 302 | *e2fsprogs)
|
---|
| 303 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
| 304 | LUSER_wrt_unpack "$pkg_tarball"
|
---|
[ce262a7] | 305 | [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[608fbe1] | 306 | LUSER_wrt_RunAsUser "${file}"
|
---|
| 307 | LUSER_RemoveBuildDirs "${name}"
|
---|
| 308 | wrt_touch
|
---|
| 309 | temptools="$temptools $this_script"
|
---|
| 310 | continue ;;
|
---|
| 311 | *e2fsprogs-libs)
|
---|
| 312 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
| 313 | LUSER_wrt_unpack "$pkg_tarball"
|
---|
[ce262a7] | 314 | [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[608fbe1] | 315 | LUSER_wrt_RunAsUser "${file}"
|
---|
| 316 | LUSER_RemoveBuildDirs "${name}"
|
---|
| 317 | wrt_touch
|
---|
| 318 | temptools="$temptools $this_script"
|
---|
| 319 | continue ;;
|
---|
[045b2dc] | 320 | esac
|
---|
| 321 |
|
---|
| 322 |
|
---|
[877cc6a] | 323 | #--------------------------------------------------------------------#
|
---|
| 324 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 325 | #--------------------------------------------------------------------#
|
---|
| 326 | #
|
---|
| 327 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 328 | # as a dependency. Also call the echo_message function.
|
---|
[045b2dc] | 329 | CHROOT_wrt_target "${this_script}" "$PREV"
|
---|
[877cc6a] | 330 | #
|
---|
[a160d86] | 331 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
[877cc6a] | 332 | # Insert instructions for unpacking the package and changing directories
|
---|
| 333 | #
|
---|
[045b2dc] | 334 | if [ "$pkg_tarball" != "" ] ; then
|
---|
[8f2c086] | 335 | CHROOT_Unpack "$pkg_tarball"
|
---|
[ce262a7] | 336 | [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[045b2dc] | 337 | fi
|
---|
[877cc6a] | 338 | #
|
---|
| 339 | # Select a script execution method
|
---|
| 340 | case $this_script in
|
---|
[8f2c086] | 341 | *kernfs) wrt_RunAsRoot "${file}" ;;
|
---|
[045b2dc] | 342 | *) CHROOT_wrt_RunAsRoot "${file}" ;;
|
---|
[877cc6a] | 343 | esac
|
---|
| 344 | #
|
---|
[045b2dc] | 345 | # Housekeeping...remove the build directory(ies), except if the package build fails.
|
---|
| 346 | [[ "$pkg_tarball" != "" ]] && CHROOT_wrt_RemoveBuildDirs "${name}"
|
---|
[877cc6a] | 347 | #
|
---|
| 348 | # Include a touch of the target name so make can check if it's already been made.
|
---|
[93f38e7] | 349 | wrt_touch
|
---|
[877cc6a] | 350 | #
|
---|
| 351 | #--------------------------------------------------------------------#
|
---|
| 352 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 353 | #--------------------------------------------------------------------#
|
---|
| 354 | #
|
---|
| 355 | # Keep the script file name for Makefile dependencies.
|
---|
| 356 | PREV=$this_script
|
---|
| 357 |
|
---|
[045b2dc] | 358 | done # for file in...
|
---|
[877cc6a] | 359 | }
|
---|
| 360 |
|
---|
| 361 |
|
---|
[045b2dc] | 362 | #--------------------------------------#
|
---|
| 363 | boot_Makefiles() { #
|
---|
| 364 | #--------------------------------------#
|
---|
[877cc6a] | 365 |
|
---|
[045b2dc] | 366 | echo "${tab_}${GREEN}Processing... ${L_arrow}tmptools BOOT ( LUSER ) ${R_arrow}"
|
---|
| 367 | #
|
---|
| 368 | # Create a target bootable partition containing a compile environment. Later
|
---|
| 369 | # on we boot into this environment and contine the build.
|
---|
| 370 | #
|
---|
| 371 | for file in boot/* ; do
|
---|
[877cc6a] | 372 | # Keep the script file name
|
---|
| 373 | this_script=`basename $file`
|
---|
[045b2dc] | 374 |
|
---|
| 375 | # A little housekeeping on the scripts
|
---|
[877cc6a] | 376 | case $this_script in
|
---|
[f940c29] | 377 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *introduction ) continue ;;
|
---|
[179ae85] | 378 | *how-to-view*) continue ;;
|
---|
[045b2dc] | 379 | *whatnext*) continue ;;
|
---|
| 380 | *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
---|
| 381 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
| 382 | [[ -z $CONFIG ]] && continue
|
---|
| 383 | # Copy the config file to /sources with a standardized name
|
---|
| 384 | cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
|
---|
| 385 | ;;
|
---|
[877cc6a] | 386 | esac
|
---|
| 387 | #
|
---|
| 388 | # First append each name of the script files to a list (this will become
|
---|
[179ae85] | 389 | # the names of the targets in the Makefile). Those names differ depending
|
---|
| 390 | # on the version of the book. What makes the difference between those
|
---|
| 391 | # versions is the presence of "how-to-view" in the boot chapter.
|
---|
| 392 | if [ -f boot/*how-to-view ]; then
|
---|
| 393 | case "${this_script}" in
|
---|
| 394 | *changingowner)
|
---|
| 395 | orphan_scripts="${orphan_scripts} ${this_script}"
|
---|
| 396 | ;;
|
---|
| 397 | *creatingdirs)
|
---|
| 398 | orphan_scripts="${orphan_scripts} ${this_script}"
|
---|
| 399 | ;;
|
---|
| 400 | *createfiles)
|
---|
| 401 | orphan_scripts="${orphan_scripts} ${this_script}"
|
---|
| 402 | ;;
|
---|
| 403 | *devices)
|
---|
| 404 | orphan_scripts="${orphan_scripts} ${this_script}"
|
---|
| 405 | ;;
|
---|
| 406 | *flags)
|
---|
| 407 | orphan_scripts="${orphan_scripts} ${this_script}"
|
---|
| 408 | ;;
|
---|
| 409 | *fstab)
|
---|
| 410 | orphan_scripts="${orphan_scripts} ${this_script}"
|
---|
| 411 | ;;
|
---|
| 412 | *pwdgroup)
|
---|
| 413 | orphan_scripts="${orphan_scripts} ${this_script}"
|
---|
| 414 | ;;
|
---|
| 415 | *settingenvironment)
|
---|
| 416 | orphan_scripts="${orphan_scripts} ${this_script}"
|
---|
| 417 | ;;
|
---|
| 418 | *)
|
---|
| 419 | boottools="$boottools $this_script"
|
---|
| 420 | ;;
|
---|
| 421 | esac
|
---|
| 422 | else
|
---|
| 423 | case "${this_script}" in
|
---|
| 424 | *changingowner)
|
---|
| 425 | orphan_scripts="${orphan_scripts} ${this_script}"
|
---|
| 426 | ;;
|
---|
| 427 | *devices)
|
---|
| 428 | orphan_scripts="${orphan_scripts} ${this_script}"
|
---|
| 429 | ;;
|
---|
| 430 | *)
|
---|
| 431 | boottools="$boottools $this_script"
|
---|
| 432 | ;;
|
---|
| 433 | esac
|
---|
| 434 | fi
|
---|
[045b2dc] | 435 | #
|
---|
| 436 | # Grab the name of the target, strip id number and misc words.
|
---|
| 437 | case $this_script in
|
---|
[179ae85] | 438 | *kernel) name=linux ;;
|
---|
| 439 | *bootscripts) name="bootscripts-cross-lfs" ;;
|
---|
| 440 | *boot-scripts) name="boot-scripts-cross-lfs" ;;
|
---|
| 441 | *udev-rules) name="udev-cross-lfs" ;;
|
---|
| 442 | *grub-build) name=grub ;;
|
---|
| 443 | *-aboot-build) name=aboot ;;
|
---|
| 444 | *yaboot-build) name=yaboot ;;
|
---|
| 445 | *colo-build) name=colo ;;
|
---|
| 446 | *silo-build) name=silo ;;
|
---|
| 447 | *arcload-build) name=arcload ;;
|
---|
| 448 | *lilo-build) name=lilo ;;
|
---|
[045b2dc] | 449 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
| 450 | esac
|
---|
| 451 | # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
|
---|
[a160d86] | 452 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
[877cc6a] | 453 |
|
---|
| 454 | #--------------------------------------------------------------------#
|
---|
| 455 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 456 | #--------------------------------------------------------------------#
|
---|
| 457 | #
|
---|
| 458 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 459 | # as a dependency. Also call the echo_message function.
|
---|
[045b2dc] | 460 | LUSER_wrt_target "${this_script}" "$PREV"
|
---|
[877cc6a] | 461 | #
|
---|
[a160d86] | 462 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
[877cc6a] | 463 | # Insert instructions for unpacking the package and changing directories
|
---|
| 464 | #
|
---|
[045b2dc] | 465 | [[ "$pkg_tarball" != "" ]] && LUSER_wrt_unpack "$pkg_tarball"
|
---|
[ce262a7] | 466 | [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[877cc6a] | 467 | #
|
---|
| 468 | # Select a script execution method
|
---|
[179ae85] | 469 | if [ -f boot/*how-to-view ]; then
|
---|
| 470 | case $this_script in
|
---|
| 471 | # The following 8 scripts are defined in the /boot directory but need
|
---|
| 472 | # to be run as a root user. Set them up here but run them in another
|
---|
| 473 | # phase
|
---|
| 474 | *changingowner) wrt_RunAsRoot "${file}" ;;
|
---|
| 475 | *creatingdirs) wrt_RunAsRoot "${file}" ;;
|
---|
| 476 | *createfiles) wrt_RunAsRoot "${file}" ;;
|
---|
| 477 | *devices) wrt_RunAsRoot "${file}" ;;
|
---|
| 478 | *flags) wrt_RunAsRoot "${file}" ;;
|
---|
| 479 | *fstab)
|
---|
| 480 | if [[ -n "$FSTAB" ]]; then
|
---|
| 481 | LUSER_wrt_CopyFstab
|
---|
| 482 | else
|
---|
| 483 | wrt_RunAsRoot "${file}"
|
---|
| 484 | fi
|
---|
| 485 | ;;
|
---|
| 486 | *pwdgroup) wrt_RunAsRoot "${file}" ;;
|
---|
| 487 | *settingenvironment) wrt_RunAsRoot "${file}" ;;
|
---|
| 488 | *) LUSER_wrt_RunAsUser "${file}" ;;
|
---|
| 489 | esac
|
---|
| 490 | else
|
---|
| 491 | case $this_script in
|
---|
| 492 | # The following 2 scripts are defined in the /boot directory but need
|
---|
| 493 | # to be run as a root user. Set them up here but run them in another
|
---|
| 494 | # phase
|
---|
| 495 | *changingowner) wrt_RunAsRoot "${file}" ;;
|
---|
| 496 | *devices) wrt_RunAsRoot "${file}" ;;
|
---|
| 497 | *fstab)
|
---|
| 498 | if [[ -n "$FSTAB" ]]; then
|
---|
| 499 | LUSER_wrt_CopyFstab
|
---|
| 500 | else
|
---|
| 501 | LUSER_wrt_RunAsUser "${file}"
|
---|
| 502 | fi
|
---|
| 503 | ;;
|
---|
| 504 | *) LUSER_wrt_RunAsUser "${file}" ;;
|
---|
| 505 | esac
|
---|
| 506 | fi
|
---|
[877cc6a] | 507 | #
|
---|
[045b2dc] | 508 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
| 509 | [[ "$pkg_tarball" != "" ]] && LUSER_RemoveBuildDirs "${name}"
|
---|
[877cc6a] | 510 | #
|
---|
| 511 | # Include a touch of the target name so make can check if it's already been made.
|
---|
[93f38e7] | 512 | wrt_touch
|
---|
[877cc6a] | 513 | #
|
---|
| 514 | #--------------------------------------------------------------------#
|
---|
| 515 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 516 | #--------------------------------------------------------------------#
|
---|
| 517 | #
|
---|
| 518 | # Keep the script file name for Makefile dependencies.
|
---|
| 519 | PREV=$this_script
|
---|
| 520 |
|
---|
[045b2dc] | 521 | done
|
---|
[877cc6a] | 522 | }
|
---|
| 523 |
|
---|
| 524 |
|
---|
[045b2dc] | 525 | #--------------------------------------#
|
---|
[d55a1a1] | 526 | testsuite_tools_Makefiles() { #
|
---|
[045b2dc] | 527 | #--------------------------------------#
|
---|
[877cc6a] | 528 |
|
---|
[d55a1a1] | 529 | if [[ "${METHOD}" = "chroot" ]]; then
|
---|
| 530 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools ( CHROOT ) ${R_arrow}"
|
---|
| 531 | else
|
---|
| 532 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools ( ROOT ) ${R_arrow}"
|
---|
[010627d] | 533 | PREV=""
|
---|
[d55a1a1] | 534 | fi
|
---|
[877cc6a] | 535 |
|
---|
| 536 | for file in testsuite-tools/* ; do
|
---|
| 537 | # Keep the script file name
|
---|
| 538 | this_script=`basename $file`
|
---|
| 539 |
|
---|
| 540 | # First append each name of the script files to a list (this will become
|
---|
| 541 | # the names of the targets in the Makefile
|
---|
| 542 | testsuitetools="$testsuitetools $this_script"
|
---|
| 543 |
|
---|
| 544 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 545 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 546 | -e 's@-64bit@@' \
|
---|
| 547 | -e 's@-64@@' \
|
---|
| 548 | -e 's@64@@' \
|
---|
| 549 | -e 's@n32@@'`
|
---|
| 550 |
|
---|
[a160d86] | 551 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
[877cc6a] | 552 |
|
---|
| 553 | #--------------------------------------------------------------------#
|
---|
| 554 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 555 | #--------------------------------------------------------------------#
|
---|
| 556 | #
|
---|
| 557 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 558 | # as a dependency. Also call the echo_message function.
|
---|
[ca6b261] | 559 | CHROOT_wrt_target "${this_script}" "$PREV"
|
---|
[877cc6a] | 560 | #
|
---|
[ca6b261] | 561 | CHROOT_Unpack "$pkg_tarball"
|
---|
[ce262a7] | 562 | [[ "$OPTIMIZE" -ge "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[877cc6a] | 563 | #
|
---|
[ca6b261] | 564 | CHROOT_wrt_RunAsRoot "${file}"
|
---|
[877cc6a] | 565 | #
|
---|
[ca6b261] | 566 | CHROOT_wrt_RemoveBuildDirs "${name}"
|
---|
[877cc6a] | 567 | #
|
---|
| 568 | # Include a touch of the target name so make can check if it's already been made.
|
---|
[93f38e7] | 569 | wrt_touch
|
---|
[877cc6a] | 570 | #
|
---|
| 571 | #--------------------------------------------------------------------#
|
---|
| 572 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 573 | #--------------------------------------------------------------------#
|
---|
| 574 | #
|
---|
| 575 | # Keep the script file name for Makefile dependencies.
|
---|
| 576 | PREV=$this_script
|
---|
| 577 |
|
---|
| 578 | done
|
---|
| 579 | }
|
---|
| 580 |
|
---|
| 581 |
|
---|
[045b2dc] | 582 | #--------------------------------------#
|
---|
[d55a1a1] | 583 | final_system_Makefiles() { #
|
---|
[045b2dc] | 584 | #--------------------------------------#
|
---|
[45f82718] | 585 | # Set envars and scripts for iteration targets
|
---|
| 586 | if [[ -z "$1" ]] ; then
|
---|
| 587 | local N=""
|
---|
[d55a1a1] | 588 | # In boot method the makesys phase was initiated in testsuite_tools_makefile
|
---|
| 589 | [[ "${METHOD}" = "boot" ]] && [[ "$TEST" = 0 ]] && PREV=""
|
---|
[45f82718] | 590 | else
|
---|
| 591 | local N=-build_$1
|
---|
| 592 | local basicsystem=""
|
---|
| 593 | mkdir final-system$N
|
---|
| 594 | cp final-system/* final-system$N
|
---|
| 595 | for script in final-system$N/* ; do
|
---|
| 596 | # Overwrite existing symlinks, files, and dirs
|
---|
| 597 | sed -e 's/ln -sv/&f/g' \
|
---|
| 598 | -e 's/mv -v/&f/g' \
|
---|
| 599 | -e 's/mkdir -v/&p/g' -i ${script}
|
---|
[10c8b78] | 600 | # Rename the scripts
|
---|
| 601 | mv ${script} ${script}$N
|
---|
[45f82718] | 602 | done
|
---|
[a5f52ba] | 603 | # Remove Bzip2 binaries before make install (CLFS-1.0 compatibility)
|
---|
[10c8b78] | 604 | sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2$N
|
---|
[45f82718] | 605 | # Delete *old Readline libraries just after make install
|
---|
[10c8b78] | 606 | sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline$N
|
---|
[45f82718] | 607 | fi
|
---|
| 608 |
|
---|
[d55a1a1] | 609 | if [[ "${METHOD}" = "chroot" ]]; then
|
---|
| 610 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N ( CHROOT ) ${R_arrow}"
|
---|
| 611 | else
|
---|
| 612 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N ( ROOT ) ${R_arrow}"
|
---|
| 613 | fi
|
---|
[877cc6a] | 614 |
|
---|
[45f82718] | 615 | for file in final-system$N/* ; do
|
---|
[877cc6a] | 616 | # Keep the script file name
|
---|
| 617 | this_script=`basename $file`
|
---|
| 618 |
|
---|
[45f82718] | 619 | # Test if the stripping phase must be skipped.
|
---|
[4384929] | 620 | # Skip also temp-perl for iterative runs
|
---|
[877cc6a] | 621 | case $this_script in
|
---|
[401f81e] | 622 | *stripping*) [[ "$STRIP" = "n" ]] && continue ;;
|
---|
[45f82718] | 623 | *temp-perl*) [[ -n "$N" ]] && continue ;;
|
---|
[877cc6a] | 624 | esac
|
---|
| 625 |
|
---|
[4384929] | 626 | # Grab the name of the target, strip id number, XXX-script.
|
---|
| 627 | # name1 is partially stripped and should be used for logging files.
|
---|
| 628 | # name is completely stripped and is used for grabbing
|
---|
| 629 | # the package name.
|
---|
| 630 | name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 631 | -e 's,'$N',,'`
|
---|
| 632 | name=`echo $name1 | sed -e 's@temp-@@' \
|
---|
| 633 | -e 's@-64bit@@' \
|
---|
| 634 | -e 's@-64@@' \
|
---|
| 635 | -e 's@64@@' \
|
---|
| 636 | -e 's@n32@@'`
|
---|
[877cc6a] | 637 |
|
---|
[45f82718] | 638 | # Find the version of the command files, if it corresponds with the building of
|
---|
| 639 | # a specific package. We need this here to can skip scripts not needed for
|
---|
| 640 | # iterations rebuilds
|
---|
[a160d86] | 641 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
[9d9ecf7] | 642 |
|
---|
[a160d86] | 643 | if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
|
---|
[45f82718] | 644 | case "${this_script}" in
|
---|
| 645 | *stripping*) ;;
|
---|
| 646 | *) continue ;;
|
---|
| 647 | esac
|
---|
| 648 | fi
|
---|
| 649 |
|
---|
| 650 | # Append each name of the script files to a list (this will become
|
---|
| 651 | # the names of the targets in the Makefile
|
---|
[10c8b78] | 652 | basicsystem="$basicsystem ${this_script}"
|
---|
[45f82718] | 653 |
|
---|
[877cc6a] | 654 | #--------------------------------------------------------------------#
|
---|
| 655 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 656 | #--------------------------------------------------------------------#
|
---|
| 657 | #
|
---|
| 658 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 659 | # as a dependency. Also call the echo_message function.
|
---|
[10c8b78] | 660 | CHROOT_wrt_target "${this_script}" "$PREV"
|
---|
[877cc6a] | 661 |
|
---|
[a160d86] | 662 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
| 663 | if [ "$pkg_tarball" != "" ] ; then
|
---|
[f546320] | 664 | # Touch timestamp file if installed files logs will be created.
|
---|
| 665 | # But only for the firt build when running iterative builds.
|
---|
| 666 | if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
---|
| 667 | CHROOT_wrt_TouchTimestamp
|
---|
| 668 | fi
|
---|
[045b2dc] | 669 | CHROOT_Unpack "$pkg_tarball"
|
---|
[a229600] | 670 | # If the testsuites must be run, initialize the log file
|
---|
| 671 | case $name in
|
---|
[269d81c] | 672 | binutils | gcc | glibc | eglibc | gmp | mpfr | mpc | isl | cloog )
|
---|
[10c8b78] | 673 | [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}"
|
---|
[a229600] | 674 | ;;
|
---|
| 675 | * )
|
---|
[10c8b78] | 676 | [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}"
|
---|
[a229600] | 677 | ;;
|
---|
| 678 | esac
|
---|
| 679 | # If using optimizations, write the instructions
|
---|
[1b65a84] | 680 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
[877cc6a] | 681 | fi
|
---|
| 682 | #
|
---|
[045b2dc] | 683 | CHROOT_wrt_RunAsRoot "${file}"
|
---|
[877cc6a] | 684 | #
|
---|
[f546320] | 685 | # Write installed files log and remove the build directory(ies)
|
---|
| 686 | # except if the package build fails.
|
---|
| 687 | if [ "$pkg_tarball" != "" ] ; then
|
---|
| 688 | CHROOT_wrt_RemoveBuildDirs "$name"
|
---|
| 689 | if [ "${INSTALL_LOG}" = "y" ] && [ "x${N}" = "x" ] ; then
|
---|
[4384929] | 690 | CHROOT_wrt_LogNewFiles "$name1"
|
---|
[f546320] | 691 | fi
|
---|
| 692 | fi
|
---|
[877cc6a] | 693 | #
|
---|
[f546320] | 694 | # Include a touch of the target name so make can check
|
---|
| 695 | # if it's already been made.
|
---|
[93f38e7] | 696 | wrt_touch
|
---|
[877cc6a] | 697 | #
|
---|
| 698 | #--------------------------------------------------------------------#
|
---|
| 699 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 700 | #--------------------------------------------------------------------#
|
---|
| 701 | #
|
---|
| 702 | # Keep the script file name for Makefile dependencies.
|
---|
[10c8b78] | 703 | PREV=${this_script}
|
---|
[45f82718] | 704 | # Set system_build envar for iteration targets
|
---|
| 705 | system_build=$basicsystem
|
---|
[877cc6a] | 706 | done # for file in final-system/* ...
|
---|
| 707 | }
|
---|
| 708 |
|
---|
[045b2dc] | 709 | #--------------------------------------#
|
---|
[d55a1a1] | 710 | bootscripts_Makefiles() { #
|
---|
[045b2dc] | 711 | #--------------------------------------#
|
---|
[d55a1a1] | 712 |
|
---|
[c6ee8ea] | 713 | # New versions of the book do not have bootscripts anymore
|
---|
| 714 | # (use systemd configuration files)
|
---|
| 715 | # Define a variable to be used for the right script directory to parse
|
---|
| 716 | if [ -d bootscripts ]; then
|
---|
| 717 | config="bootscripts"
|
---|
| 718 | else
|
---|
| 719 | config="system-config"
|
---|
| 720 | fi
|
---|
| 721 |
|
---|
[d55a1a1] | 722 | if [[ "${METHOD}" = "chroot" ]]; then
|
---|
[c6ee8ea] | 723 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) $config ( CHROOT ) ${R_arrow}"
|
---|
[45f82718] | 724 | else
|
---|
[c6ee8ea] | 725 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) $config ( ROOT ) ${R_arrow}"
|
---|
[45f82718] | 726 | fi
|
---|
[877cc6a] | 727 |
|
---|
[c6ee8ea] | 728 | for file in $config/* ; do
|
---|
[877cc6a] | 729 | # Keep the script file name
|
---|
| 730 | this_script=`basename $file`
|
---|
| 731 |
|
---|
| 732 | case $this_script in
|
---|
| 733 | *udev) continue ;; # This is not a script but a commentary, we want udev-rules
|
---|
| 734 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
[f0de954] | 735 | # fstab is now here (for 3.x.y)
|
---|
| 736 | *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
---|
[877cc6a] | 737 | *) ;;
|
---|
| 738 | esac
|
---|
| 739 |
|
---|
| 740 | # First append each name of the script files to a list (this will become
|
---|
| 741 | # the names of the targets in the Makefile
|
---|
| 742 | bootscripttools="$bootscripttools $this_script"
|
---|
| 743 |
|
---|
[4384929] | 744 | # Grab the name of the target, strip id number, XXX-script.
|
---|
| 745 | # name1 is partially stripped and should be used for logging files.
|
---|
| 746 | # name is completely stripped and is used for grabbing
|
---|
| 747 | # the package name.
|
---|
| 748 | name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 749 | name=`echo $name1 | sed -e 's@-64bit@@' \
|
---|
| 750 | -e 's@-64@@' \
|
---|
| 751 | -e 's@64@@' \
|
---|
| 752 | -e 's@n32@@'`
|
---|
[877cc6a] | 753 | case $name in
|
---|
[c044e3c] | 754 | *bootscripts*) name=bootscripts-cross-lfs ;;
|
---|
[877cc6a] | 755 | *udev-rules) name=udev-cross-lfs ;;
|
---|
| 756 | esac
|
---|
[c044e3c] | 757 |
|
---|
[a160d86] | 758 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
[877cc6a] | 759 |
|
---|
| 760 | #--------------------------------------------------------------------#
|
---|
| 761 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 762 | #--------------------------------------------------------------------#
|
---|
| 763 | #
|
---|
| 764 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 765 | # as a dependency. Also call the echo_message function.
|
---|
[045b2dc] | 766 | CHROOT_wrt_target "${this_script}" "$PREV"
|
---|
[877cc6a] | 767 | #
|
---|
[a160d86] | 768 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
[877cc6a] | 769 | #
|
---|
[f546320] | 770 | if [ "$pkg_tarball" != "" ] ; then
|
---|
| 771 | if [ "${INSTALL_LOG}" = "y" ] ; then
|
---|
[4384929] | 772 | CHROOT_wrt_TouchTimestamp
|
---|
[f546320] | 773 | fi
|
---|
| 774 | CHROOT_Unpack "$pkg_tarball"
|
---|
| 775 | fi
|
---|
[877cc6a] | 776 | #
|
---|
[f0de954] | 777 | case $this_script in
|
---|
| 778 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
| 779 | CHROOT_wrt_CopyFstab
|
---|
| 780 | else
|
---|
| 781 | CHROOT_wrt_RunAsRoot "${file}"
|
---|
| 782 | fi
|
---|
| 783 | ;;
|
---|
| 784 | *) CHROOT_wrt_RunAsRoot "${file}"
|
---|
| 785 | ;;
|
---|
| 786 | esac
|
---|
[877cc6a] | 787 | #
|
---|
[f546320] | 788 | # Write installed files log and remove the build directory(ies)
|
---|
| 789 | # except if the package build fails.
|
---|
| 790 | if [ "$pkg_tarball" != "" ] ; then
|
---|
| 791 | CHROOT_wrt_RemoveBuildDirs "$name"
|
---|
| 792 | if [ "${INSTALL_LOG}" = "y" ] ; then
|
---|
[4384929] | 793 | CHROOT_wrt_LogNewFiles "$name1"
|
---|
[f546320] | 794 | fi
|
---|
| 795 | fi
|
---|
[877cc6a] | 796 | #
|
---|
| 797 | # Include a touch of the target name so make can check if it's already been made.
|
---|
[93f38e7] | 798 | wrt_touch
|
---|
[877cc6a] | 799 | #
|
---|
| 800 | #--------------------------------------------------------------------#
|
---|
| 801 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 802 | #--------------------------------------------------------------------#
|
---|
| 803 | #
|
---|
| 804 | # Keep the script file name for Makefile dependencies.
|
---|
| 805 | PREV=$this_script
|
---|
| 806 |
|
---|
| 807 | done # for file in bootscripts/* ...
|
---|
| 808 | }
|
---|
| 809 |
|
---|
[608fbe1] | 810 | #--------------------------------------#
|
---|
| 811 | network_Makefiles() { #
|
---|
| 812 | #--------------------------------------#
|
---|
| 813 |
|
---|
| 814 | if [[ "${METHOD}" = "chroot" ]]; then
|
---|
| 815 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) network ( CHROOT ) ${R_arrow}"
|
---|
| 816 | else
|
---|
| 817 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) network ( ROOT ) ${R_arrow}"
|
---|
| 818 | fi
|
---|
| 819 |
|
---|
| 820 | for file in network/* ; do
|
---|
| 821 | # Keep the script file name
|
---|
| 822 | this_script=`basename $file`
|
---|
| 823 |
|
---|
| 824 | case $this_script in
|
---|
| 825 | *choose) continue ;; # This is not a script but a commentary.
|
---|
| 826 | *dhcp) continue ;; # Assume static networking.
|
---|
| 827 | *dhcpcd) continue ;; # Assume static networking.
|
---|
| 828 | *) ;;
|
---|
| 829 | esac
|
---|
| 830 |
|
---|
| 831 | # First append each name of the script files to a list (this will become
|
---|
| 832 | # the names of the targets in the Makefile
|
---|
| 833 | networktools="$networktools $this_script"
|
---|
| 834 |
|
---|
| 835 | # Grab the name of the target, strip id number, XXX-script
|
---|
[4384929] | 836 | # name1 is partially stripped and should be used for logging files.
|
---|
| 837 | # name is completely stripped and is used for grabbing
|
---|
| 838 | # the package name.
|
---|
| 839 | name1=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 840 | name=`echo $name1 | sed -e 's@-64bit@@' \
|
---|
| 841 | -e 's@-64@@' \
|
---|
| 842 | -e 's@64@@' \
|
---|
| 843 | -e 's@n32@@'`
|
---|
[608fbe1] | 844 | case $name in
|
---|
[b4df9e1] | 845 | network-scripts) name=clfs-network-scripts ;;
|
---|
[608fbe1] | 846 | esac
|
---|
| 847 |
|
---|
| 848 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
| 849 |
|
---|
| 850 | #--------------------------------------------------------------------#
|
---|
| 851 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 852 | #--------------------------------------------------------------------#
|
---|
| 853 | #
|
---|
| 854 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 855 | # as a dependency. Also call the echo_message function.
|
---|
| 856 | CHROOT_wrt_target "${this_script}" "$PREV"
|
---|
| 857 | #
|
---|
| 858 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
| 859 | #
|
---|
| 860 | if [ "$pkg_tarball" != "" ] ; then
|
---|
| 861 | if [ "${INSTALL_LOG}" = "y" ] ; then
|
---|
[4384929] | 862 | CHROOT_wrt_TouchTimestamp
|
---|
[608fbe1] | 863 | fi
|
---|
| 864 | CHROOT_Unpack "$pkg_tarball"
|
---|
| 865 | fi
|
---|
| 866 | #
|
---|
| 867 | CHROOT_wrt_RunAsRoot "${file}"
|
---|
| 868 | #
|
---|
| 869 | # Write installed files log and remove the build directory(ies)
|
---|
| 870 | # except if the package build fails.
|
---|
| 871 | if [ "$pkg_tarball" != "" ] ; then
|
---|
| 872 | CHROOT_wrt_RemoveBuildDirs "$name"
|
---|
| 873 | if [ "${INSTALL_LOG}" = "y" ] ; then
|
---|
[4384929] | 874 | CHROOT_wrt_LogNewFiles "$name1"
|
---|
[608fbe1] | 875 | fi
|
---|
| 876 | fi
|
---|
| 877 | #
|
---|
| 878 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 879 | wrt_touch
|
---|
| 880 | #
|
---|
| 881 | #--------------------------------------------------------------------#
|
---|
| 882 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 883 | #--------------------------------------------------------------------#
|
---|
| 884 | #
|
---|
| 885 | # Keep the script file name for Makefile dependencies.
|
---|
| 886 | PREV=$this_script
|
---|
| 887 |
|
---|
| 888 | done # for file in network/* ...
|
---|
| 889 | }
|
---|
| 890 |
|
---|
[045b2dc] | 891 | #--------------------------------------#
|
---|
[d55a1a1] | 892 | bootable_Makefiles() { #
|
---|
[045b2dc] | 893 | #--------------------------------------#
|
---|
[877cc6a] | 894 |
|
---|
[d55a1a1] | 895 | if [[ "${METHOD}" = "chroot" ]]; then
|
---|
| 896 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable ( CHROOT ) ${R_arrow}"
|
---|
| 897 | else
|
---|
| 898 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable ( ROOT ) ${R_arrow}"
|
---|
| 899 | fi
|
---|
[877cc6a] | 900 |
|
---|
| 901 |
|
---|
[936efa8] | 902 | for file in bootable/* ; do
|
---|
[877cc6a] | 903 | # Keep the script file name
|
---|
| 904 | this_script=`basename $file`
|
---|
| 905 |
|
---|
| 906 | # A little housekeeping on the scripts
|
---|
| 907 | case $this_script in
|
---|
| 908 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
---|
[045b2dc] | 909 | *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
---|
[877cc6a] | 910 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
| 911 | [[ -z $CONFIG ]] && continue
|
---|
| 912 | # Copy the config file to /sources with a standardized name
|
---|
| 913 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
| 914 | ;;
|
---|
| 915 | esac
|
---|
| 916 | #
|
---|
| 917 | # First append each name of the script files to a list (this will become
|
---|
| 918 | # the names of the targets in the Makefile
|
---|
| 919 | bootabletools="$bootabletools $this_script"
|
---|
| 920 | #
|
---|
| 921 | # Grab the name of the target, strip id number and misc words.
|
---|
| 922 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
| 923 | case $this_script in
|
---|
| 924 | *kernel*) name=linux
|
---|
| 925 | ;;
|
---|
| 926 | esac
|
---|
[a160d86] | 927 |
|
---|
| 928 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
[877cc6a] | 929 |
|
---|
| 930 | #--------------------------------------------------------------------#
|
---|
| 931 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 932 | #--------------------------------------------------------------------#
|
---|
| 933 | #
|
---|
| 934 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 935 | # as a dependency. Also call the echo_message function.
|
---|
[045b2dc] | 936 | CHROOT_wrt_target "${this_script}" "$PREV"
|
---|
[877cc6a] | 937 | #
|
---|
[a160d86] | 938 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
[877cc6a] | 939 | # Insert instructions for unpacking the package and changing directories
|
---|
| 940 | #
|
---|
[f546320] | 941 | if [ "$pkg_tarball" != "" ] ; then
|
---|
| 942 | if [ "${INSTALL_LOG}" = "y" ] ; then
|
---|
[4384929] | 943 | CHROOT_wrt_TouchTimestamp
|
---|
[f546320] | 944 | fi
|
---|
| 945 | CHROOT_Unpack "$pkg_tarball"
|
---|
| 946 | fi
|
---|
[877cc6a] | 947 | #
|
---|
| 948 | # Select a script execution method
|
---|
| 949 | case $this_script in
|
---|
[045b2dc] | 950 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
| 951 | CHROOT_wrt_CopyFstab
|
---|
| 952 | else
|
---|
| 953 | CHROOT_wrt_RunAsRoot "${file}"
|
---|
| 954 | fi
|
---|
| 955 | ;;
|
---|
| 956 | *) CHROOT_wrt_RunAsRoot "${file}"
|
---|
| 957 | ;;
|
---|
[877cc6a] | 958 | esac
|
---|
| 959 | #
|
---|
[f546320] | 960 | # Write installed files log and remove the build directory(ies)
|
---|
| 961 | # except if the package build fails.
|
---|
| 962 | if [ "$pkg_tarball" != "" ] ; then
|
---|
| 963 | CHROOT_wrt_RemoveBuildDirs "$name"
|
---|
| 964 | if [ "${INSTALL_LOG}" = "y" ] ; then
|
---|
| 965 | CHROOT_wrt_LogNewFiles "$name"
|
---|
| 966 | fi
|
---|
| 967 | fi
|
---|
[877cc6a] | 968 | #
|
---|
| 969 | # Include a touch of the target name so make can check if it's already been made.
|
---|
[93f38e7] | 970 | wrt_touch
|
---|
[877cc6a] | 971 | #
|
---|
| 972 | #--------------------------------------------------------------------#
|
---|
| 973 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 974 | #--------------------------------------------------------------------#
|
---|
| 975 | #
|
---|
| 976 | # Keep the script file name for Makefile dependencies.
|
---|
| 977 | PREV=$this_script
|
---|
| 978 |
|
---|
| 979 | done
|
---|
| 980 |
|
---|
| 981 | }
|
---|
| 982 |
|
---|
| 983 |
|
---|
[045b2dc] | 984 | #--------------------------------------#
|
---|
| 985 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
| 986 | #--------------------------------------#
|
---|
| 987 |
|
---|
| 988 | echo "...Creating Makefile... ${BOLD}START${OFF}"
|
---|
[877cc6a] | 989 |
|
---|
| 990 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
[730436a] | 991 | # Start with clean files
|
---|
[045b2dc] | 992 | >$MKFILE
|
---|
[877cc6a] | 993 | >$MKFILE.tmp
|
---|
| 994 |
|
---|
[d55a1a1] | 995 | method_cmds=${METHOD}_Makefiles
|
---|
[045b2dc] | 996 |
|
---|
| 997 | host_prep_Makefiles # mk_SETUP (SETUP) $host_prep
|
---|
[3f83cb0] | 998 | final_preps_Makefiles # mk_F_PREPS (LUSER) $final_preps
|
---|
[045b2dc] | 999 | cross_tools_Makefiles # mk_CROSS (LUSER) $cross_tools
|
---|
| 1000 | temptools_Makefiles # mk_TEMP (LUSER) $temptools
|
---|
| 1001 | $method_cmds # mk_SYSTOOLS (CHROOT) $chroottools/$boottools
|
---|
| 1002 | if [[ ! $TEST = "0" ]]; then
|
---|
[d55a1a1] | 1003 | testsuite_tools_Makefiles # mk_SYSTOOLS (CHROOT) $testsuitetools
|
---|
[877cc6a] | 1004 | fi
|
---|
[d55a1a1] | 1005 | final_system_Makefiles # mk_FINAL (CHROOT) $basicsystem
|
---|
[045b2dc] | 1006 | # Add the iterations targets, if needed
|
---|
| 1007 | [[ "$COMPARE" = "y" ]] && wrt_compare_targets
|
---|
[d55a1a1] | 1008 | bootscripts_Makefiles # mk_BOOTSCRIPT (CHROOT) $bootscripttools
|
---|
[608fbe1] | 1009 | if [ -d network ]; then
|
---|
| 1010 | network_Makefiles # If present, process network setup.
|
---|
| 1011 | fi
|
---|
[d55a1a1] | 1012 | bootable_Makefiles # mk_BOOTABLE (CHROOT) $bootabletools
|
---|
[877cc6a] | 1013 |
|
---|
[3e7ceed] | 1014 | # Add the CUSTOM_TOOLS targets, if needed
|
---|
| 1015 | [[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
|
---|
[c10570d] | 1016 |
|
---|
[877cc6a] | 1017 | # Add a header, some variables and include the function file
|
---|
| 1018 | # to the top of the real Makefile.
|
---|
[195ed9f] | 1019 | wrt_Makefile_header
|
---|
[877cc6a] | 1020 |
|
---|
| 1021 | # Add chroot commands
|
---|
| 1022 | if [ "$METHOD" = "chroot" ] ; then
|
---|
[6ad5a2f] | 1023 | CHROOT_LOC="`whereis -b chroot | cut -d " " -f2`"
|
---|
[15c9e72] | 1024 | chroot=`cat chroot/???-chroot | \
|
---|
[6ad5a2f] | 1025 | sed -e "s@chroot@$CHROOT_LOC@" \
|
---|
[830f28d] | 1026 | -e '/#!\/bin\/bash/d' \
|
---|
[6ad5a2f] | 1027 | -e '/^export/d' \
|
---|
| 1028 | -e '/^logout/d' \
|
---|
| 1029 | -e 's@ \\\@ @g' | \
|
---|
| 1030 | tr -d '\n' | \
|
---|
| 1031 | sed -e 's/ */ /g' \
|
---|
| 1032 | -e 's|\\$|&&|g' \
|
---|
| 1033 | -e 's|exit||g' \
|
---|
| 1034 | -e 's|$| -c|' \
|
---|
[f4d9a48] | 1035 | -e 's|"$${CLFS}"|$(MOUNT_PT)|'\
|
---|
[f3a7f3b] | 1036 | -e 's|set -e||' \
|
---|
| 1037 | -e 's|set +h||'`
|
---|
[877cc6a] | 1038 | echo -e "CHROOT1= $chroot\n" >> $MKFILE
|
---|
| 1039 | fi
|
---|
| 1040 |
|
---|
[045b2dc] | 1041 | ################## CHROOT ####################
|
---|
| 1042 |
|
---|
[877cc6a] | 1043 | if [[ "${METHOD}" = "chroot" ]]; then
|
---|
| 1044 | (
|
---|
[045b2dc] | 1045 | cat << EOF
|
---|
[877cc6a] | 1046 |
|
---|
[3f83cb0] | 1047 | all: ck_UID mk_SETUP mk_F_PREPS mk_SUDO mk_SYSTOOLS create-sbu_du-report mk_CUSTOM_TOOLS mk_BLFS_TOOL
|
---|
[045b2dc] | 1048 | @sudo make do-housekeeping
|
---|
[936efa8] | 1049 | @echo "$VERSION - jhalfs build" > clfs-release && \\
|
---|
[269d81c] | 1050 | sudo mv clfs-release \$(MOUNT_PT)/etc && \\
|
---|
| 1051 | sudo chown root:root \$(MOUNT_PT)/etc/clfs-release
|
---|
[045b2dc] | 1052 | @\$(call echo_finished,$VERSION)
|
---|
[a160d86] | 1053 |
|
---|
[045b2dc] | 1054 | ck_UID:
|
---|
| 1055 | @if [ \`id -u\` = "0" ]; then \\
|
---|
| 1056 | echo "+--------------------------------------------------+"; \\
|
---|
| 1057 | echo "|You cannot run this makefile from the root account|"; \\
|
---|
| 1058 | echo "+--------------------------------------------------+"; \\
|
---|
| 1059 | exit 1; \\
|
---|
| 1060 | fi
|
---|
| 1061 |
|
---|
| 1062 | #---------------AS ROOT
|
---|
| 1063 | mk_SETUP:
|
---|
| 1064 | @\$(call echo_SU_request)
|
---|
[7a43320] | 1065 | @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
|
---|
[045b2dc] | 1066 | @touch \$@
|
---|
| 1067 |
|
---|
| 1068 | #---------------AS LUSER
|
---|
[3f83cb0] | 1069 | mk_F_PREPS: mk_SETUP
|
---|
| 1070 | @\$(call echo_PHASE,Final Preparations Cross and Temporary Tools)
|
---|
[730436a] | 1071 | @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
|
---|
[045b2dc] | 1072 | @sudo make restore-luser-env
|
---|
| 1073 | @touch \$@
|
---|
| 1074 |
|
---|
[3f83cb0] | 1075 | mk_SUDO: mk_F_PREPS
|
---|
[7a43320] | 1076 | @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
|
---|
[045b2dc] | 1077 | @touch \$@
|
---|
| 1078 |
|
---|
| 1079 | #---------------CHROOT JAIL
|
---|
| 1080 | mk_SYSTOOLS: mk_SUDO
|
---|
| 1081 | @\$(call echo_CHROOT_request)
|
---|
| 1082 | @\$(call echo_PHASE, CHROOT JAIL )
|
---|
[6c1b96b] | 1083 | @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) PREP_CHROOT_JAIL")
|
---|
[7a43320] | 1084 | @( sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CHROOT_JAIL")
|
---|
[045b2dc] | 1085 | @touch \$@
|
---|
[877cc6a] | 1086 |
|
---|
[269d81c] | 1087 | mk_BLFS_TOOL: create-sbu_du-report
|
---|
| 1088 | @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
|
---|
| 1089 | \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
|
---|
| 1090 | (sudo \$(CHROOT1) "make -C $BLFS_ROOT/work"); \\
|
---|
| 1091 | fi;
|
---|
| 1092 | @touch \$@
|
---|
| 1093 |
|
---|
| 1094 | mk_CUSTOM_TOOLS: mk_BLFS_TOOL
|
---|
[3e7ceed] | 1095 | @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
|
---|
[79da297] | 1096 | \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
|
---|
[3e7ceed] | 1097 | sudo mkdir -p ${BUILDDIR}${TRACKING_DIR}; \\
|
---|
[7a43320] | 1098 | (sudo \$(CHROOT1) "cd \$(SCRIPT_ROOT) && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS"); \\
|
---|
[3e7ceed] | 1099 | fi;
|
---|
| 1100 | @touch \$@
|
---|
| 1101 |
|
---|
[6c1b96b] | 1102 | SETUP: $host_prep
|
---|
[3f83cb0] | 1103 | AS_LUSER: $final_preps $cross_tools $temptools
|
---|
[6c1b96b] | 1104 | SUDO: $orphan_scripts
|
---|
| 1105 | PREP_CHROOT_JAIL: SHELL=/tools/bin/bash
|
---|
| 1106 | PREP_CHROOT_JAIL: ${chroottools}
|
---|
| 1107 | CHROOT_JAIL: SHELL=/tools/bin/bash
|
---|
| 1108 | CHROOT_JAIL: $testsuitetools $basicsystem $bootscripttools $bootabletools
|
---|
| 1109 | CUSTOM_TOOLS: $custom_list
|
---|
[877cc6a] | 1110 |
|
---|
[1838bc7] | 1111 |
|
---|
| 1112 | create-sbu_du-report: mk_SYSTOOLS
|
---|
| 1113 | @\$(call echo_message, Building)
|
---|
| 1114 | @if [ "\$(ADD_REPORT)" = "y" ]; then \\
|
---|
| 1115 | ./create-sbu_du-report.sh logs $VERSION; \\
|
---|
| 1116 | \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
|
---|
| 1117 | fi;
|
---|
| 1118 | @touch \$@
|
---|
| 1119 |
|
---|
[7d9a82d] | 1120 | do-housekeeping:
|
---|
[4524fb2] | 1121 | @-umount \$(MOUNT_PT)/dev/pts
|
---|
[269d81c] | 1122 | @-if [ -h \$(MOUNT_PT)/dev/shm ]; then \\
|
---|
| 1123 | link=\$\$(readlink \$(MOUNT_PT)/dev/shm); \\
|
---|
| 1124 | umount \$(MOUNT_PT)/\$\$link; \\
|
---|
| 1125 | unset link; \\
|
---|
| 1126 | else \\
|
---|
| 1127 | umount \$(MOUNT_PT)/dev/shm; \\
|
---|
| 1128 | fi
|
---|
[4524fb2] | 1129 | @-umount \$(MOUNT_PT)/dev
|
---|
| 1130 | @-umount \$(MOUNT_PT)/sys
|
---|
| 1131 | @-umount \$(MOUNT_PT)/proc
|
---|
[045b2dc] | 1132 | @-rm /tools /cross-tools
|
---|
[6ad5a2f] | 1133 | @-if [ ! -f luser-exist ]; then \\
|
---|
| 1134 | userdel \$(LUSER); \\
|
---|
[962793a] | 1135 | rm -rf \$(LUSER_HOME); \\
|
---|
[7d9a82d] | 1136 | fi;
|
---|
| 1137 |
|
---|
[877cc6a] | 1138 | EOF
|
---|
| 1139 | ) >> $MKFILE
|
---|
[045b2dc] | 1140 |
|
---|
[877cc6a] | 1141 | fi
|
---|
| 1142 |
|
---|
[045b2dc] | 1143 | ################### BOOT #####################
|
---|
[877cc6a] | 1144 |
|
---|
| 1145 | if [[ "${METHOD}" = "boot" ]]; then
|
---|
| 1146 | (
|
---|
[045b2dc] | 1147 | cat << EOF
|
---|
[877cc6a] | 1148 |
|
---|
[3f83cb0] | 1149 | all: ck_UID mk_SETUP mk_F_PREPS mk_SUDO
|
---|
[045b2dc] | 1150 | @sudo make restore-luser-env
|
---|
| 1151 | @sudo make do-housekeeping
|
---|
[877cc6a] | 1152 | @\$(call echo_boot_finished,$VERSION)
|
---|
| 1153 |
|
---|
[3e7ceed] | 1154 | makesys: mk_FINAL mk_CUSTOM_TOOLS mk_BLFS_TOOL
|
---|
[936efa8] | 1155 | @echo "$VERSION - jhalfs build" > /etc/clfs-release
|
---|
[877cc6a] | 1156 | @\$(call echo_finished,$VERSION)
|
---|
| 1157 |
|
---|
| 1158 |
|
---|
[045b2dc] | 1159 | ck_UID:
|
---|
| 1160 | @if [ \`id -u\` = "0" ]; then \\
|
---|
| 1161 | echo "+--------------------------------------------------+"; \\
|
---|
| 1162 | echo "|You cannot run this makefile from the root account|"; \\
|
---|
| 1163 | echo "|However, if this is the boot environment |"; \\
|
---|
| 1164 | echo "| the command you are looking for is |"; \\
|
---|
| 1165 | echo "| make makesys |"; \\
|
---|
[730436a] | 1166 | echo "| to complete the build |"; \\
|
---|
[045b2dc] | 1167 | echo "+--------------------------------------------------+"; \\
|
---|
| 1168 | exit 1; \\
|
---|
| 1169 | fi
|
---|
[877cc6a] | 1170 |
|
---|
[045b2dc] | 1171 | #---------------AS ROOT
|
---|
[877cc6a] | 1172 |
|
---|
[045b2dc] | 1173 | mk_SETUP:
|
---|
| 1174 | @\$(call echo_SU_request)
|
---|
[7a43320] | 1175 | @sudo make BREAKPOINT=\$(BREAKPOINT) SETUP
|
---|
[045b2dc] | 1176 | @touch \$@
|
---|
| 1177 |
|
---|
| 1178 | #---------------AS LUSER
|
---|
[a160d86] | 1179 |
|
---|
[3f83cb0] | 1180 | mk_F_PREPS: mk_SETUP
|
---|
| 1181 | @\$(call echo_PHASE,Final Preparations and Cross Tools)
|
---|
[730436a] | 1182 | @( \$(SU_LUSER) "make -C \$(MOUNT_PT)/\$(SCRIPT_ROOT) BREAKPOINT=\$(BREAKPOINT) AS_LUSER" )
|
---|
[045b2dc] | 1183 | @touch \$@
|
---|
| 1184 |
|
---|
[3f83cb0] | 1185 | mk_SUDO: mk_F_PREPS
|
---|
[7a43320] | 1186 | @sudo make BREAKPOINT=\$(BREAKPOINT) SUDO
|
---|
[045b2dc] | 1187 | @touch \$@
|
---|
| 1188 |
|
---|
| 1189 | #---------------AS ROOT
|
---|
| 1190 |
|
---|
| 1191 | mk_FINAL:
|
---|
| 1192 | @\$(call echo_PHASE,Final System)
|
---|
[7a43320] | 1193 | @( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) AS_ROOT )
|
---|
[045b2dc] | 1194 | @touch \$@
|
---|
| 1195 |
|
---|
[269d81c] | 1196 | mk_BLFS_TOOL: mk_FINAL
|
---|
[e18f80a] | 1197 | @if [ "\$(ADD_BLFS_TOOLS)" = "y" ]; then \\
|
---|
| 1198 | \$(call sh_echo_PHASE,Building BLFS_TOOL); \\
|
---|
| 1199 | ( make -C $BLFS_ROOT/work ); \\
|
---|
| 1200 | fi;
|
---|
| 1201 | @touch \$@
|
---|
[269d81c] | 1202 |
|
---|
| 1203 | mk_CUSTOM_TOOLS: mk_BLFS_TOOL
|
---|
[3e7ceed] | 1204 | @if [ "\$(ADD_CUSTOM_TOOLS)" = "y" ]; then \\
|
---|
[79da297] | 1205 | \$(call sh_echo_PHASE,Building CUSTOM_TOOLS); \\
|
---|
[3bc6078] | 1206 | mkdir -p ${TRACKING_DIR}; \\
|
---|
[7a43320] | 1207 | ( source /root/.bash_profile && make BREAKPOINT=\$(BREAKPOINT) CUSTOM_TOOLS ); \\
|
---|
[3e7ceed] | 1208 | fi;
|
---|
| 1209 | @touch \$@
|
---|
| 1210 |
|
---|
| 1211 | SETUP: $host_prep
|
---|
[3f83cb0] | 1212 | AS_LUSER: $final_preps $cross_tools $temptools ${boottools}
|
---|
[3e7ceed] | 1213 | SUDO: $orphan_scripts
|
---|
[aec4483] | 1214 | AS_ROOT: SHELL=/tools/bin/bash
|
---|
[3e7ceed] | 1215 | AS_ROOT: $testsuitetools $basicsystem $bootscripttools $bootabletools
|
---|
| 1216 | CUSTOM_TOOLS: $custom_list
|
---|
[045b2dc] | 1217 |
|
---|
| 1218 | do-housekeeping:
|
---|
| 1219 | @-rm /tools /cross-tools
|
---|
| 1220 | @-if [ ! -f luser-exist ]; then \\
|
---|
[6ad5a2f] | 1221 | userdel \$(LUSER); \\
|
---|
[962793a] | 1222 | rm -rf \$(LUSER_HOME); \\
|
---|
[877cc6a] | 1223 | fi;
|
---|
| 1224 |
|
---|
[045b2dc] | 1225 | EOF
|
---|
| 1226 | ) >> $MKFILE
|
---|
| 1227 | fi
|
---|
| 1228 |
|
---|
| 1229 | (
|
---|
| 1230 | cat << EOF
|
---|
| 1231 |
|
---|
[6ad5a2f] | 1232 | restore-luser-env:
|
---|
[877cc6a] | 1233 | @\$(call echo_message, Building)
|
---|
[962793a] | 1234 | @if [ -f \$(LUSER_HOME)/.bashrc.XXX ]; then \\
|
---|
| 1235 | mv -f \$(LUSER_HOME)/.bashrc.XXX \$(LUSER_HOME)/.bashrc; \\
|
---|
[877cc6a] | 1236 | fi;
|
---|
[962793a] | 1237 | @if [ -f \$(LUSER_HOME)/.bash_profile.XXX ]; then \\
|
---|
| 1238 | mv \$(LUSER_HOME)/.bash_profile.XXX \$(LUSER_HOME)/.bash_profile; \\
|
---|
[877cc6a] | 1239 | fi;
|
---|
[962793a] | 1240 | @chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME)/.bash* && \\
|
---|
[93f38e7] | 1241 | touch \$@ && \\
|
---|
| 1242 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
| 1243 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
[877cc6a] | 1244 |
|
---|
[045b2dc] | 1245 | ########################################################
|
---|
| 1246 |
|
---|
[7d9a82d] | 1247 |
|
---|
[877cc6a] | 1248 | EOF
|
---|
| 1249 | ) >> $MKFILE
|
---|
| 1250 |
|
---|
| 1251 | # Bring over the items from the Makefile.tmp
|
---|
| 1252 | cat $MKFILE.tmp >> $MKFILE
|
---|
| 1253 | rm $MKFILE.tmp
|
---|
| 1254 |
|
---|
[045b2dc] | 1255 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
[877cc6a] | 1256 | }
|
---|