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