[fbb6b78] | 1 | #!/bin/sh
|
---|
[1236262] | 2 |
|
---|
| 3 | version="
|
---|
[fdaedb8] | 4 | jhalfs development \$Date$
|
---|
[63b2859] | 5 |
|
---|
[db9cec6] | 6 | Originally written by Jeremy Huntwork.
|
---|
[557fe91] | 7 | Maintained by Manuel Canales Esparcia.
|
---|
[1236262] | 8 |
|
---|
| 9 | This program is published under the \
|
---|
[557fe91] | 10 | Gnu General Public License, Version 2.
|
---|
| 11 | "
|
---|
[1236262] | 12 |
|
---|
| 13 | usage="\
|
---|
| 14 | Usage: $0 [OPTION]
|
---|
| 15 |
|
---|
| 16 | Options:
|
---|
[557fe91] | 17 | -h, --help print this help, then exit
|
---|
[24530379] | 18 |
|
---|
[557fe91] | 19 | -V, --version print version number, then exit
|
---|
[24530379] | 20 |
|
---|
[a41ce58] | 21 | -d --directory DIR use DIR directory for building LFS; all files
|
---|
[557fe91] | 22 | jhalfs produces will be in the directory
|
---|
[af47a19] | 23 | DIR/jhalfs. Default is \"/mnt/lfs\".
|
---|
[24530379] | 24 |
|
---|
| 25 | -P, --get-packages download the packages and patches
|
---|
| 26 |
|
---|
[a41ce58] | 27 | -D, --download-client CLIENT use CLIENT as the program for retrieving
|
---|
[24530379] | 28 | packages (for use in conjunction with -P)
|
---|
| 29 |
|
---|
[a41ce58] | 30 | -W, --working-copy DIR use the local working copy placed in DIR
|
---|
[24530379] | 31 | as the LFS book
|
---|
| 32 |
|
---|
[a41ce58] | 33 | -L, --LFS-version VER ckeckout VER version of the LFS book
|
---|
[24530379] | 34 |
|
---|
| 35 | -T, --testsuites add support to run the optional testsuites
|
---|
| 36 |
|
---|
[01e51a1] | 37 | --no-toolchain-test don't run the toolchain testsuites. This
|
---|
| 38 | disables also the build of TCL, Expect
|
---|
| 39 | and DejaGNU
|
---|
[6e31ef7] | 40 |
|
---|
| 41 | --timezone TIMEZONE set TIMEZONE as the local timezone. If not
|
---|
| 42 | specified, Europe/London will be used.
|
---|
[01e51a1] | 43 |
|
---|
[6e31ef7] | 44 | --page_size PAGE set PAGE as the default page size (letter
|
---|
| 45 | or A4). This setting is required to
|
---|
[af47a19] | 46 | build Groff. If not specified, \"letter\"
|
---|
| 47 | will be used.
|
---|
[cf7f294] | 48 |
|
---|
| 49 | -C, --kernel-config FILE use the kernel configuration file specified
|
---|
| 50 | in FILE to build the kernel. If not found,
|
---|
| 51 | the kernel build is skipped.
|
---|
| 52 |
|
---|
| 53 | -M, --run-make run make on the generated Makefile
|
---|
| 54 |
|
---|
[1236262] | 55 | "
|
---|
| 56 |
|
---|
| 57 | help="\
|
---|
| 58 | Try '$0 --help' for more information."
|
---|
| 59 |
|
---|
| 60 | exit_missing_arg="\
|
---|
| 61 | echo \"Option '\$1' requires an argument\" >&2
|
---|
| 62 | echo \"\$help\" >&2
|
---|
| 63 | exit 1"
|
---|
| 64 |
|
---|
| 65 | no_dl_client="\
|
---|
| 66 | echo \"Could not find a way to download the LFS sources.\" >&2
|
---|
| 67 | echo \"Attempting to continue.\" >&2"
|
---|
| 68 |
|
---|
| 69 | while test $# -gt 0 ; do
|
---|
[557fe91] | 70 | case $1 in
|
---|
| 71 | --version | -V )
|
---|
| 72 | echo "$version"
|
---|
| 73 | exit 0
|
---|
| 74 | ;;
|
---|
| 75 |
|
---|
| 76 | --help | -h )
|
---|
| 77 | echo "$usage"
|
---|
| 78 | exit 0
|
---|
| 79 | ;;
|
---|
| 80 |
|
---|
| 81 | --LFS-version | -L )
|
---|
| 82 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 83 | shift
|
---|
| 84 | case $1 in
|
---|
| 85 | dev* | SVN | trunk )
|
---|
| 86 | LFSVRS=development
|
---|
| 87 | ;;
|
---|
| 88 | * )
|
---|
| 89 | echo "$1 is an unsupported version at this time."
|
---|
| 90 | exit 1
|
---|
| 91 | ;;
|
---|
| 92 | esac
|
---|
| 93 | shift
|
---|
| 94 | ;;
|
---|
| 95 |
|
---|
| 96 | --directory | -d )
|
---|
| 97 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 98 | shift
|
---|
| 99 | BUILDDIR=$1
|
---|
| 100 | shift
|
---|
| 101 | ;;
|
---|
| 102 |
|
---|
| 103 | --download-client | -D )
|
---|
| 104 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 105 | shift
|
---|
| 106 | DL=$1
|
---|
| 107 | shift
|
---|
| 108 | ;;
|
---|
| 109 |
|
---|
[24530379] | 110 | --working-copy | -W )
|
---|
| 111 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 112 | shift
|
---|
[6e31ef7] | 113 | if [ -f $1/patches.ent ] ; then
|
---|
[24530379] | 114 | WC=1
|
---|
| 115 | BOOK=$1
|
---|
[6e31ef7] | 116 | else
|
---|
| 117 | echo -e "\nLook like $1 isn't a supported working copy."
|
---|
| 118 | echo -e "Verify your selection and the command line.\n"
|
---|
| 119 | exit 1
|
---|
| 120 | fi
|
---|
[24530379] | 121 | shift
|
---|
| 122 | ;;
|
---|
| 123 |
|
---|
[d310939] | 124 | --testsuites | -T )
|
---|
[db9cec6] | 125 | TEST=1
|
---|
| 126 | shift
|
---|
| 127 | ;;
|
---|
| 128 |
|
---|
[d310939] | 129 | --get-packages | -P )
|
---|
[07f47df] | 130 | HPKG=1
|
---|
| 131 | shift
|
---|
| 132 | ;;
|
---|
| 133 |
|
---|
[d310939] | 134 | --run-make | -M )
|
---|
| 135 | RUNMAKE=1
|
---|
| 136 | shift
|
---|
| 137 | ;;
|
---|
| 138 |
|
---|
[a41ce58] | 139 | --page_size )
|
---|
| 140 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 141 | shift
|
---|
[6e31ef7] | 142 | case $1 in
|
---|
| 143 | letter | A4 )
|
---|
| 144 | PAGE=$1
|
---|
| 145 | ;;
|
---|
| 146 | * )
|
---|
| 147 | echo "$1 isn't a supported page size."
|
---|
| 148 | exit 1
|
---|
| 149 | ;;
|
---|
| 150 | esac
|
---|
[a41ce58] | 151 | shift
|
---|
| 152 | ;;
|
---|
| 153 |
|
---|
[01e51a1] | 154 | --no-toolchain-test )
|
---|
| 155 | TOOLCHAINTEST=0
|
---|
| 156 | shift
|
---|
| 157 | ;;
|
---|
| 158 |
|
---|
[3e67a77] | 159 | --timezone )
|
---|
[6e31ef7] | 160 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 161 | shift
|
---|
| 162 | if [ -f /usr/share/zoneinfo/$1 ] ; then
|
---|
| 163 | TIMEZONE=$1
|
---|
| 164 | else
|
---|
| 165 | echo -e "\nLook like $1 isn't a valid timezone description."
|
---|
| 166 | echo -e "Verify your selection and the command line.\n"
|
---|
| 167 | exit 1
|
---|
| 168 | fi
|
---|
| 169 | shift
|
---|
| 170 | ;;
|
---|
| 171 |
|
---|
[cf7f294] | 172 | --kernel-config | -C )
|
---|
| 173 | test $# = 1 && eval "$exit_missing_arg"
|
---|
| 174 | shift
|
---|
| 175 | if [ -f $1 ] ; then
|
---|
| 176 | CONFIG=$1
|
---|
| 177 | else
|
---|
[6e31ef7] | 178 | echo -e "\nFile $1 not found. Verify your command line.\n"
|
---|
| 179 | exit 1
|
---|
[cf7f294] | 180 | fi
|
---|
| 181 | shift
|
---|
| 182 | ;;
|
---|
| 183 |
|
---|
[557fe91] | 184 | * )
|
---|
| 185 | echo "$usage"
|
---|
| 186 | exit 1
|
---|
| 187 | ;;
|
---|
| 188 | esac
|
---|
[1236262] | 189 | done
|
---|
| 190 |
|
---|
| 191 | # Test to make sure we're running the build as root
|
---|
| 192 |
|
---|
| 193 | if [ "$UID" != "0" ] ; then
|
---|
[557fe91] | 194 | echo "You must be logged in as root to successfully build LFS."
|
---|
| 195 | exit 1
|
---|
[1236262] | 196 | fi
|
---|
| 197 |
|
---|
| 198 | # Find the download client to use, if not already specified.
|
---|
| 199 |
|
---|
| 200 | if [ -z $DL ] ; then
|
---|
| 201 | if [ `type -p wget` ] ; then
|
---|
[557fe91] | 202 | DL=wget
|
---|
[1236262] | 203 | elif [ `type -p curl` ] ; then
|
---|
[557fe91] | 204 | DL=curl
|
---|
[1236262] | 205 | else
|
---|
[557fe91] | 206 | eval "$no_dl_client"
|
---|
[1236262] | 207 | fi
|
---|
| 208 | fi
|
---|
| 209 |
|
---|
| 210 | SVN="svn://svn.linuxfromscratch.org"
|
---|
| 211 | HTTP=http://ftp.lfs-matrix.net/pub/lfs/lfs-packages/conglomeration
|
---|
[48d7968] | 212 | if [ -z $BUILDDIR ] ; then BUILDDIR=/mnt/lfs ; fi
|
---|
[4dafc45] | 213 | JHALFSDIR=$BUILDDIR/jhalfs
|
---|
[4c62c61] | 214 | LOGDIR=$JHALFSDIR/logs
|
---|
[a5e49c6] | 215 | LOG=000-jhalfs.log
|
---|
[f8de156] | 216 | MKFILE=$JHALFSDIR/Makefile
|
---|
[3cfe871] | 217 | XSL=dump-lfs-scripts.xsl
|
---|
[0fc4c75] | 218 | FNC=functions
|
---|
[db9cec6] | 219 | if [ -z $TEST ] ; then TEST=0 ; fi
|
---|
[01e51a1] | 220 | if [ -z $TOOLCHAINTEST ] ; then TOOLCHAINTEST=1 ; fi
|
---|
[a41ce58] | 221 | if [ -z $PAGE ] ; then PAGE=letter ; fi
|
---|
[6e31ef7] | 222 | if [ -z $TIMEZONE ] ; then TIMEZONE=Europe/London ; fi
|
---|
[1236262] | 223 |
|
---|
[8bb92e7] | 224 | HEADER="# This file is automatically generated by jhalfs
|
---|
| 225 | # DO NOT EDIT THIS FILE MANUALLY
|
---|
| 226 | #
|
---|
| 227 | # Generated on `date \"+%F %X %Z\"`"
|
---|
| 228 |
|
---|
[1236262] | 229 | get_book() {
|
---|
| 230 | # Check for Subversion instead of just letting the script hit 'svn' and fail.
|
---|
| 231 | test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
---|
[557fe91] | 232 | exit 1"
|
---|
[4dafc45] | 233 | cd $JHALFSDIR
|
---|
[fbb6b78] | 234 |
|
---|
[1236262] | 235 | # Test to make sure the LFS version is set
|
---|
| 236 | if [ -z $LFSVRS ] ; then LFSVRS=development ; fi
|
---|
[24530379] | 237 |
|
---|
[56dd1e2] | 238 | # Set the book's sources directory
|
---|
[24530379] | 239 | if [ -z $BOOK ] ; then BOOK=lfs-$LFSVRS ; fi
|
---|
| 240 |
|
---|
| 241 | if [ -z $WC ] ; then
|
---|
| 242 | echo -n "Downloading the LFS Book, version $LFSVRS... "
|
---|
| 243 |
|
---|
| 244 | # Grab the LFS book fresh if it's missing, otherwise, update it from the
|
---|
| 245 | # repo. If we've already extracted the commands, move on to getting the
|
---|
| 246 | # sources.
|
---|
| 247 | if [ -d lfs-$LFSVRS ] ; then
|
---|
| 248 | cd lfs-$LFSVRS
|
---|
| 249 | if svn up | grep -q At && test -d $JHALFSDIR/commands && \
|
---|
| 250 | test -f $JHALFSDIR/packages && test -f $JHALFSDIR/patches ; then
|
---|
| 251 | echo -ne "done\n"
|
---|
| 252 | get_sources
|
---|
| 253 | else
|
---|
| 254 | echo -ne "done\n"
|
---|
| 255 | extract_commands
|
---|
| 256 | fi
|
---|
[557fe91] | 257 | else
|
---|
[24530379] | 258 | if [ $LFSVRS = development ] ; then
|
---|
[4c62c61] | 259 | svn co $SVN/LFS/trunk/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
---|
[24530379] | 260 | else
|
---|
[4c62c61] | 261 | svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
---|
[24530379] | 262 | fi
|
---|
[557fe91] | 263 | echo -ne "done\n"
|
---|
| 264 | extract_commands
|
---|
| 265 | fi
|
---|
[1236262] | 266 | else
|
---|
[24530379] | 267 | echo -ne "Using $BOOK as book's sources ...\n"
|
---|
[557fe91] | 268 | extract_commands
|
---|
[1236262] | 269 | fi
|
---|
[898f47a] | 270 | # Set the canonical book version
|
---|
| 271 | cd $JHALFSDIR
|
---|
| 272 | VERSION=`grep "ENTITY version" $BOOK/general.ent | sed -e 's@<!ENTITY version "@@' -e 's@">@@'`
|
---|
[1236262] | 273 | }
|
---|
| 274 |
|
---|
| 275 | extract_commands() {
|
---|
| 276 | # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
---|
| 277 | test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
---|
[557fe91] | 278 | exit 1"
|
---|
[4dafc45] | 279 | cd $JHALFSDIR
|
---|
[1236262] | 280 |
|
---|
| 281 | # Start clean
|
---|
| 282 | if [ -d commands ] ; then rm -rf commands ; fi && mkdir commands
|
---|
| 283 | echo -n "Extracting commands... "
|
---|
| 284 |
|
---|
[dc2fee8] | 285 | # Dump the commands in shell script form from the LFS book.
|
---|
[01e51a1] | 286 | xsltproc --nonet --xinclude --stringparam testsuite $TEST \
|
---|
| 287 | --stringparam toolchaintest $TOOLCHAINTEST -o ./commands/ \
|
---|
| 288 | $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
[1236262] | 289 |
|
---|
[af47a19] | 290 | # Make the scripts executable.
|
---|
[dc44153] | 291 | chmod -R +x $JHALFSDIR/commands
|
---|
| 292 |
|
---|
[1236262] | 293 | # Grab the patches and package names.
|
---|
[4dafc45] | 294 | cd $JHALFSDIR
|
---|
[1236262] | 295 | for i in patches packages ; do rm -f $i ; done
|
---|
[24530379] | 296 | grep "\-version" $BOOK/general.ent | sed -e 's@<!ENTITY @@' -e 's@">@"@' \
|
---|
[557fe91] | 297 | -e '/generic/d' >> packages
|
---|
[0a9117e] | 298 | echo `grep "glibc" packages | sed 's@glibc@glibc-linuxthreads@'` >> packages
|
---|
[24530379] | 299 | grep "ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
|
---|
[1236262] | 300 |
|
---|
| 301 | # Done. Moving on...
|
---|
| 302 | echo -ne "done\n"
|
---|
| 303 | get_sources
|
---|
| 304 | }
|
---|
| 305 |
|
---|
| 306 | download() {
|
---|
| 307 | cd $BUILDDIR/sources
|
---|
| 308 |
|
---|
[0a9117e] | 309 | # Hackish fix for the bash-doc and glibc-linuxthreads packages that
|
---|
| 310 | # doesn't conform to norms in the URL scheme.
|
---|
| 311 | DIR=`echo $1 | sed -e 's@-doc@@' -e 's@-linuxthreads@@'`
|
---|
[1236262] | 312 |
|
---|
| 313 | # Find the md5 sum for this package.
|
---|
| 314 | if [ $2 != MD5SUMS ] ; then MD5=`grep " $2" MD5SUMS` ; fi
|
---|
| 315 |
|
---|
| 316 | if [ ! -f $2 ] ; then
|
---|
[557fe91] | 317 | case $DL in
|
---|
| 318 | wget )
|
---|
| 319 | wget $HTTP/$DIR/$2
|
---|
| 320 | ;;
|
---|
| 321 | curl )
|
---|
| 322 | `curl -# $HTTP/$DIR/$2 -o $2`
|
---|
| 323 | ;;
|
---|
| 324 | * )
|
---|
| 325 | echo "$DL not supported at this time."
|
---|
| 326 | ;;
|
---|
| 327 | esac
|
---|
[1236262] | 328 | elif ! echo "$MD5" | md5sum -c - >/dev/null 2>/dev/null ; then
|
---|
[557fe91] | 329 | case $DL in
|
---|
| 330 | wget )
|
---|
| 331 | wget -c $HTTP/$DIR/$2
|
---|
| 332 | ;;
|
---|
| 333 | curl )
|
---|
| 334 | `curl -# -C - $HTTP/$DIR/$2 -o $2`
|
---|
| 335 | ;;
|
---|
| 336 | * )
|
---|
| 337 | echo "$DL not supported at this time."
|
---|
| 338 | ;;
|
---|
| 339 | esac
|
---|
[1236262] | 340 | fi
|
---|
| 341 | if [ $2 != MD5SUMS ] && ! echo "$MD5" | md5sum -c - ; then
|
---|
| 342 | exit 1
|
---|
| 343 | fi
|
---|
| 344 | }
|
---|
| 345 |
|
---|
| 346 | get_sources() {
|
---|
| 347 |
|
---|
[07f47df] | 348 | # Test if the packages must be downloaded
|
---|
[d310939] | 349 | if [ "$HPKG" = "1" ] ; then
|
---|
[1236262] | 350 |
|
---|
[07f47df] | 351 | # This variable is necessary to make sure the `cat $JHALFSDIR/packages`
|
---|
| 352 | # separates each iteration by lines. It is necessary to have the second
|
---|
| 353 | # ' on the next line.
|
---|
| 354 | IFS='
|
---|
| 355 | '
|
---|
[1236262] | 356 |
|
---|
[07f47df] | 357 | if [ ! -d $BUILDDIR/sources ] ; then mkdir $BUILDDIR/sources ; fi
|
---|
| 358 | cd $BUILDDIR/sources
|
---|
| 359 | if [ -f MD5SUMS ] ; then rm MD5SUMS ; fi
|
---|
| 360 |
|
---|
| 361 | download "" MD5SUMS
|
---|
| 362 |
|
---|
| 363 | # Iterate through each package and grab it, along with any patches it needs.
|
---|
| 364 | for i in `cat $JHALFSDIR/packages` ; do
|
---|
| 365 | PKG=`echo $i | sed 's/-version.*//'`
|
---|
| 366 |
|
---|
| 367 | # Someone used some silly entities right next to the valid package entities.
|
---|
| 368 | if [ "$PKG" = "expect-lib" -o "$PKG" = "linux-dl" ] ; then continue ; fi
|
---|
| 369 |
|
---|
| 370 | VRS=`echo $i | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 371 | if [ "$PKG" = "tcl" ] ; then
|
---|
| 372 | FILE="$PKG$VRS-src.tar.bz2"
|
---|
| 373 | else
|
---|
| 374 | FILE="$PKG-$VRS.tar.bz2"
|
---|
| 375 | fi
|
---|
| 376 | download $PKG $FILE
|
---|
| 377 | for patch in `grep "$PKG-&$PKG" $JHALFSDIR/patches` ; do
|
---|
| 378 | PATCH=`echo $patch | sed 's@&'$PKG'-version;@'$VRS'@'`
|
---|
| 379 | download $PKG $PATCH
|
---|
| 380 | done
|
---|
[fbb6b78] | 381 | done
|
---|
[0a9117e] | 382 | # Hardcoded Udev configuration file until find a better way
|
---|
| 383 | download udev udev-config-3.rules
|
---|
[07f47df] | 384 | fi
|
---|
[1236262] | 385 | }
|
---|
| 386 |
|
---|
[f8de156] | 387 | build_Makefile() {
|
---|
[9e406b5] | 388 | echo -n "Creating Makefile... "
|
---|
[f8de156] | 389 | cd $JHALFSDIR/commands
|
---|
[fbb6b78] | 390 |
|
---|
[f8de156] | 391 | # Start with a clean Makefile.tmp file
|
---|
| 392 | >$MKFILE.tmp
|
---|
| 393 |
|
---|
[0bad6ba] | 394 | for file in chapter05/* ; do
|
---|
[71642ef] | 395 | # Keep the script file name
|
---|
| 396 | i=`basename $file`
|
---|
[63b2859] | 397 |
|
---|
[01e51a1] | 398 | # If no testsuites will be run, then TCL, Expect and DejaGNU isn't needed
|
---|
| 399 | if [ "$TOOLCHAINTEST" = "0" ]; then
|
---|
| 400 | if echo $i | grep -q "tcl" ; then
|
---|
| 401 | continue
|
---|
| 402 | elif echo $i | grep -q "expect" ; then
|
---|
| 403 | continue
|
---|
| 404 | elif echo $i | grep -q "dejagnu" ; then
|
---|
| 405 | continue
|
---|
| 406 | fi
|
---|
| 407 | fi
|
---|
| 408 |
|
---|
[71642ef] | 409 | # First append each name of the script files to a list (this will become
|
---|
| 410 | # the names of the targets in the Makefile
|
---|
| 411 | chapter5="$chapter5 $i"
|
---|
[557fe91] | 412 |
|
---|
[71642ef] | 413 | # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
|
---|
| 414 | # and binutils in chapter 5)
|
---|
| 415 | name=`echo $i | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
|
---|
[557fe91] | 416 |
|
---|
[e909d9d] | 417 | # Set the dependency for the first target.
|
---|
| 418 | if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
|
---|
| 419 |
|
---|
| 420 | # Drop in the name of the target on a new line, and the previous target
|
---|
[0fc4c75] | 421 | # as a dependency. Also call the echo_message function.
|
---|
[3f990d1] | 422 | (
|
---|
| 423 | cat << EOF
|
---|
| 424 |
|
---|
| 425 | $i: $PREV
|
---|
| 426 | @\$(call echo_message, Building)
|
---|
| 427 | EOF
|
---|
| 428 | ) >> $MKFILE.tmp
|
---|
[557fe91] | 429 |
|
---|
[71642ef] | 430 | # Find the version of the command files, if it corresponds with the building of
|
---|
| 431 | # a specific package
|
---|
| 432 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
[557fe91] | 433 |
|
---|
[71642ef] | 434 | # If $vrs isn't empty, we've got a package...
|
---|
| 435 | if [ "$vrs" != "" ] ; then
|
---|
| 436 | if [ "$name" = "tcl" ] ; then
|
---|
| 437 | FILE="$name$vrs-src.tar.bz2"
|
---|
| 438 | else
|
---|
| 439 | FILE="$name-$vrs.tar.bz2"
|
---|
| 440 | fi
|
---|
[557fe91] | 441 |
|
---|
[71642ef] | 442 | # Insert instructions for unpacking the package and to set
|
---|
| 443 | # the PKGDIR variable.
|
---|
[3f990d1] | 444 | (
|
---|
| 445 | cat << EOF
|
---|
| 446 | @\$(call unpack,$FILE)
|
---|
[eaa021a] | 447 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 448 | chown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
| 449 | echo "PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT" > envars && \\
|
---|
| 450 | echo "export PKGDIR" >> envars && \\
|
---|
| 451 | EOF
|
---|
| 452 | ) >> $MKFILE.tmp
|
---|
| 453 |
|
---|
[71642ef] | 454 | fi
|
---|
[557fe91] | 455 |
|
---|
[4c62c61] | 456 | # Dump the path to the Binutils or TCL sources directory.
|
---|
| 457 | if [ "$i" = "027-binutils-pass1" -o "$i" = "032-tcl" -o "$i" = "036-binutils-pass2" ] ; then
|
---|
[3f990d1] | 458 | (
|
---|
| 459 | cat << EOF
|
---|
| 460 | echo "\$(LFS)\$(SRC)/\$\$ROOT" > sources-dir
|
---|
| 461 | EOF
|
---|
| 462 | ) >> $MKFILE.tmp
|
---|
[88dcce5] | 463 |
|
---|
[71642ef] | 464 | # For the Adjusting phase we must to cd to the binutils-build directory.
|
---|
[0fc4c75] | 465 | elif [ "$i" = "031-adjusting" ] ; then
|
---|
[3f990d1] | 466 | (
|
---|
| 467 | cat << EOF
|
---|
| 468 | @echo "PKGDIR=\$(LFS)\$(SRC)/binutils-build" > envars && \\
|
---|
| 469 | echo "export PKGDIR" >> envars
|
---|
| 470 | EOF
|
---|
| 471 | ) >> $MKFILE.tmp
|
---|
[0209bb7] | 472 |
|
---|
[97a3ffc] | 473 | # For the Expect build we need to set the TCLPATH envar.
|
---|
[0fc4c75] | 474 | elif [ "$i" = "033-expect" ] ; then
|
---|
[3f990d1] | 475 | (
|
---|
| 476 | cat << EOF
|
---|
| 477 | echo "TCLPATH=\`cat sources-dir\`" >> envars && \\
|
---|
| 478 | echo "export TCLPATH" >> envars
|
---|
| 479 | EOF
|
---|
| 480 | ) >> $MKFILE.tmp
|
---|
[0fc4c75] | 481 |
|
---|
| 482 | # Everything else, add a true statment so we don't confuse make
|
---|
| 483 | else
|
---|
[3f990d1] | 484 | (
|
---|
| 485 | cat << EOF
|
---|
| 486 | true
|
---|
| 487 | EOF
|
---|
| 488 | ) >> $MKFILE.tmp
|
---|
[71642ef] | 489 | fi
|
---|
[557fe91] | 490 |
|
---|
[3f990d1] | 491 | # Insert date and disk usage at the top of the log file, the script run
|
---|
| 492 | # and date and disk usage again at the bottom of the log file.
|
---|
| 493 | (
|
---|
| 494 | cat << EOF
|
---|
| 495 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
| 496 | su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/commands/$file" >>logs/$i 2>&1 && \\
|
---|
| 497 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 498 | EOF
|
---|
| 499 | ) >> $MKFILE.tmp
|
---|
[71642ef] | 500 |
|
---|
[cf7f294] | 501 | # Remove the build directory(ies) except if the package build fails
|
---|
| 502 | # (to can review config.cache, config.log, and like.)
|
---|
| 503 | # For Binutils and TCL the sources must be retained some time.
|
---|
[71642ef] | 504 | if [ "$vrs" != "" ] ; then
|
---|
[d310939] | 505 | if [ "$i" != "027-binutils-pass1" ] && [ "$i" != "032-tcl" ] && [ "$i" != "036-binutils-pass2" ] ; then
|
---|
[3f990d1] | 506 | (
|
---|
| 507 | cat << EOF
|
---|
[eaa021a] | 508 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 509 | rm -r \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
| 510 | if [ -e \$(LFS)\$(SRC)/$name-build ]; then \\
|
---|
| 511 | rm -r \$(LFS)\$(SRC)/$name-build; \\
|
---|
| 512 | fi;
|
---|
| 513 | EOF
|
---|
| 514 | ) >> $MKFILE.tmp
|
---|
[71642ef] | 515 | fi
|
---|
| 516 | fi
|
---|
[7bbd436] | 517 |
|
---|
| 518 | # Remove the Binutils pass 1 sources after a successful Adjusting phase.
|
---|
| 519 | if [ "$i" = "031-adjusting" ] ; then
|
---|
[3f990d1] | 520 | (
|
---|
| 521 | cat << EOF
|
---|
| 522 | @rm -r \`cat sources-dir\` && \\
|
---|
| 523 | rm -r \$(LFS)\$(SRC)/binutils-build && \\
|
---|
| 524 | rm sources-dir
|
---|
| 525 | EOF
|
---|
| 526 | ) >> $MKFILE.tmp
|
---|
[7bbd436] | 527 | fi
|
---|
| 528 |
|
---|
| 529 | # Remove the TCL sources after a successful Expect build.
|
---|
| 530 | if [ "$i" = "033-expect" ] ; then
|
---|
[3f990d1] | 531 | (
|
---|
| 532 | cat << EOF
|
---|
| 533 | @rm -r \`cat sources-dir\` && \\
|
---|
| 534 | rm sources-dir
|
---|
| 535 | EOF
|
---|
| 536 | ) >> $MKFILE.tmp
|
---|
[7bbd436] | 537 | fi
|
---|
| 538 |
|
---|
| 539 | # Include a touch of the target name so make can check
|
---|
| 540 | # if it's already been made.
|
---|
[3f990d1] | 541 | (
|
---|
| 542 | cat << EOF
|
---|
| 543 | @touch \$@
|
---|
| 544 | EOF
|
---|
| 545 | ) >> $MKFILE.tmp
|
---|
[7bbd436] | 546 |
|
---|
[e909d9d] | 547 | # Keep the script file name for Makefile dependencies.
|
---|
| 548 | PREV=$i
|
---|
[f8de156] | 549 | done
|
---|
[9e406b5] | 550 |
|
---|
[97a3ffc] | 551 | for file in chapter06/* ; do
|
---|
| 552 | # Keep the script file name
|
---|
| 553 | i=`basename $file`
|
---|
| 554 |
|
---|
[16c67ed] | 555 | # We'll run the chroot commands differently than the others, so skip them in the
|
---|
| 556 | # dependencies and target creation.
|
---|
| 557 | if echo $i | grep -q "chroot" ; then
|
---|
| 558 | continue
|
---|
| 559 | fi
|
---|
| 560 |
|
---|
[97a3ffc] | 561 | # First append each name of the script files to a list (this will become
|
---|
| 562 | # the names of the targets in the Makefile
|
---|
| 563 | chapter6="$chapter6 $i"
|
---|
| 564 |
|
---|
| 565 | # Grab the name of the target
|
---|
| 566 | name=`echo $i | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 567 |
|
---|
| 568 | # Set the dependency for the first target.
|
---|
| 569 | if [ -z $PREV ] ; then PREV=055-stripping ; fi
|
---|
| 570 |
|
---|
| 571 | # Drop in the name of the target on a new line, and the previous target
|
---|
[4c62c61] | 572 | # as a dependency. Also call the echo_message function.
|
---|
[3f990d1] | 573 | (
|
---|
| 574 | cat << EOF
|
---|
| 575 |
|
---|
| 576 | $i: $PREV
|
---|
| 577 | @\$(call echo_message, Building)
|
---|
| 578 | EOF
|
---|
| 579 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 580 |
|
---|
| 581 | # Find the version of the command files, if it corresponds with the building of
|
---|
| 582 | # a specific package
|
---|
| 583 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 584 |
|
---|
| 585 | # If $vrs isn't empty, we've got a package...
|
---|
[3f990d1] | 586 | # Insert instructions for unpacking the package and changing directories
|
---|
[97a3ffc] | 587 | if [ "$vrs" != "" ] ; then
|
---|
| 588 | FILE="$name-$vrs.tar.bz2"
|
---|
[3f990d1] | 589 | (
|
---|
| 590 | cat << EOF
|
---|
| 591 | @\$(call unpack,$FILE)
|
---|
[eaa021a] | 592 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 593 | echo "PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
|
---|
[2e51f44] | 594 | echo "export PKGDIR" >> envars
|
---|
[3f990d1] | 595 | EOF
|
---|
| 596 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 597 | fi
|
---|
| 598 |
|
---|
| 599 | # For the Re-Adjusting phase we must to cd to the binutils-build directory.
|
---|
| 600 | if [ "$i" = "067-readjusting" ] ; then
|
---|
[3f990d1] | 601 | (
|
---|
| 602 | cat << EOF
|
---|
| 603 | @echo "PKGDIR=\$(SRC)/binutils-build" > envars && \\
|
---|
| 604 | echo "export PKGDIR" >> envars
|
---|
| 605 | EOF
|
---|
| 606 | ) >> $MKFILE.tmp
|
---|
[4c62c61] | 607 | fi
|
---|
[97a3ffc] | 608 |
|
---|
[2a54650] | 609 | # For Glibc we need to set TIMEZONE envar.
|
---|
| 610 | if [ "$i" = "066-glibc" ] ; then
|
---|
| 611 | (
|
---|
| 612 | cat << EOF
|
---|
| 613 | @echo "TIMEZONE=\$(TIMEZONE)" >> envars && \\
|
---|
| 614 | echo "export TIMEZONE" >> envars
|
---|
| 615 | EOF
|
---|
| 616 | ) >> $MKFILE.tmp
|
---|
| 617 | fi
|
---|
| 618 |
|
---|
[a41ce58] | 619 | # For Groff we need to set PAGE envar.
|
---|
| 620 | if [ "$i" = "082-groff" ] ; then
|
---|
| 621 | (
|
---|
| 622 | cat << EOF
|
---|
| 623 | @echo "PAGE=\$(PAGE)" >> envars && \\
|
---|
| 624 | echo "export PAGE" >> envars
|
---|
| 625 | EOF
|
---|
| 626 | ) >> $MKFILE.tmp
|
---|
| 627 | fi
|
---|
| 628 |
|
---|
[b51d2ec] | 629 | # In the mount of kernel filesystems we need to set LFS
|
---|
[80c00fc] | 630 | # and not to use chroot.
|
---|
[4c62c61] | 631 | if [ "$i" = "057-kernfs" ] ; then
|
---|
[3f990d1] | 632 | (
|
---|
| 633 | cat << EOF
|
---|
[7871325] | 634 | @echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
[b51d2ec] | 635 | export LFS=\$(LFS) && commands/$file >>logs/$i 2>&1 && \\
|
---|
[3f990d1] | 636 | echo -e "\n\`date\`\n\nKB: \`du -sk --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 637 | EOF
|
---|
[a7d20b8] | 638 | ) >> $MKFILE.tmp
|
---|
| 639 |
|
---|
| 640 | # The rest of Chapter06
|
---|
[7ecd166] | 641 | else
|
---|
[3f990d1] | 642 | (
|
---|
| 643 | cat << EOF
|
---|
[80c00fc] | 644 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
[2e51f44] | 645 | \$(CHROOT1) 'cd /jhalfs && source envars && /jhalfs/commands/$file >>/jhalfs/logs/$i 2>&1' && \\
|
---|
[3f990d1] | 646 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 647 | EOF
|
---|
| 648 | ) >> $MKFILE.tmp
|
---|
| 649 |
|
---|
[7ecd166] | 650 | fi
|
---|
[97a3ffc] | 651 |
|
---|
[cf7f294] | 652 | # Remove the build directory(ies) except if the package build fails.
|
---|
[97a3ffc] | 653 | if [ "$vrs" != "" ] ; then
|
---|
[3f990d1] | 654 | (
|
---|
| 655 | cat << EOF
|
---|
[eaa021a] | 656 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
[3f990d1] | 657 | rm -r \$(LFS)\$(SRC)/\$\$ROOT && \\
|
---|
| 658 | if [ -e \$(LFS)\$(SRC)/$name-build ]; then \\
|
---|
| 659 | rm -r \$(LFS)\$(SRC)/$name-build; \\
|
---|
| 660 | fi;
|
---|
| 661 | EOF
|
---|
| 662 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 663 | fi
|
---|
| 664 |
|
---|
[4e4a8d5] | 665 | # Remove the Binutils pass 2 sources after a successful Re-Adjusting phase.
|
---|
[6299c11] | 666 | if [ "$i" = "067-readjusting" ] ; then
|
---|
[3f990d1] | 667 | (
|
---|
| 668 | cat << EOF
|
---|
| 669 | @rm -r \`cat sources-dir\` && \\
|
---|
| 670 | rm -r \$(LFS)\$(SRC)/binutils-build && \\
|
---|
| 671 | rm sources-dir
|
---|
| 672 | EOF
|
---|
| 673 | ) >> $MKFILE.tmp
|
---|
[97a3ffc] | 674 | fi
|
---|
| 675 |
|
---|
[732d1f1] | 676 | # Include a touch of the target name so make can check
|
---|
| 677 | # if it's already been made.
|
---|
[3f990d1] | 678 | (
|
---|
| 679 | cat << EOF
|
---|
| 680 | @touch \$@
|
---|
| 681 | EOF
|
---|
| 682 | ) >> $MKFILE.tmp
|
---|
[732d1f1] | 683 |
|
---|
[97a3ffc] | 684 | # Keep the script file name for Makefile dependencies.
|
---|
| 685 | PREV=$i
|
---|
| 686 | done
|
---|
| 687 |
|
---|
[cf7f294] | 688 | for file in chapter0{7,8,9}/* ; do
|
---|
| 689 | # Keep the script file name
|
---|
| 690 | i=`basename $file`
|
---|
| 691 |
|
---|
| 692 | # Grub must be configured manually
|
---|
| 693 | if echo $i | grep -q "grub" ; then
|
---|
| 694 | continue
|
---|
[83f64dc] | 695 | # The filesystems can't be unmounted yet due that the user must
|
---|
| 696 | # to enter to the chroot environment to create the root password,
|
---|
| 697 | # edit several files and setup Grub,
|
---|
| 698 | elif echo $i | grep -q "reboot" ; then
|
---|
| 699 | continue
|
---|
[cf7f294] | 700 | fi
|
---|
| 701 |
|
---|
| 702 | # If no .config file is supplied, the kernel build is skipped
|
---|
| 703 | if [ -z $CONFIG ] ; then
|
---|
| 704 | if echo $i | grep -q "kernel" ; then
|
---|
| 705 | continue
|
---|
| 706 | fi
|
---|
| 707 | fi
|
---|
| 708 |
|
---|
| 709 | # First append each name of the script files to a list (this will become
|
---|
| 710 | # the names of the targets in the Makefile
|
---|
| 711 | chapter789="$chapter789 $i"
|
---|
| 712 |
|
---|
| 713 | # Set the dependency for the first target.
|
---|
| 714 | if [ -z $PREV ] ; then PREV=116-strippingagain ; fi
|
---|
| 715 |
|
---|
| 716 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 717 | # as a dependency. Also call the echo_message function.
|
---|
| 718 | (
|
---|
| 719 | cat << EOF
|
---|
| 720 |
|
---|
| 721 | $i: $PREV
|
---|
| 722 | @\$(call echo_message, Building)
|
---|
| 723 | EOF
|
---|
| 724 | ) >> $MKFILE.tmp
|
---|
| 725 |
|
---|
| 726 | # Find the the bootscripts and kernel package names
|
---|
| 727 | if [ "$i" = "119-bootscripts" -o "$i" = "132-kernel" ] ; then
|
---|
| 728 | if [ "$i" = "119-bootscripts" ] ; then
|
---|
| 729 | vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 730 | FILE="lfs-bootscripts-$vrs.tar.bz2"
|
---|
| 731 | elif [ "$i" = "132-kernel" ] ; then
|
---|
| 732 | vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 733 | FILE="linux-$vrs.tar.bz2"
|
---|
| 734 | fi
|
---|
| 735 | (
|
---|
| 736 | cat << EOF
|
---|
| 737 | @\$(call unpack,$FILE)
|
---|
| 738 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
| 739 | echo "PKGDIR=\$(SRC)/\$\$ROOT" > envars && \\
|
---|
| 740 | echo "export PKGDIR" >> envars
|
---|
| 741 | EOF
|
---|
| 742 | ) >> $MKFILE.tmp
|
---|
| 743 | fi
|
---|
| 744 |
|
---|
| 745 | # Put in place the kernel .config file
|
---|
[2b73842] | 746 | if [ "$i" = "132-kernel" ] ; then
|
---|
[cf7f294] | 747 | (
|
---|
| 748 | cat << EOF
|
---|
[f0f60d0] | 749 | @cp $CONFIG \$(LFS)/sources/kernel-config
|
---|
[cf7f294] | 750 | EOF
|
---|
| 751 | ) >> $MKFILE.tmp
|
---|
| 752 | fi
|
---|
| 753 |
|
---|
| 754 | # Initialize the log an run the script
|
---|
| 755 | (
|
---|
| 756 | cat << EOF
|
---|
| 757 | @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >logs/$i && \\
|
---|
| 758 | \$(CHROOT2) 'cd /jhalfs && source envars && /jhalfs/commands/$file >>/jhalfs/logs/$i 2>&1' && \\
|
---|
| 759 | echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=0??-* \$(LFS)\`\n" >>logs/$i
|
---|
| 760 | EOF
|
---|
| 761 | ) >> $MKFILE.tmp
|
---|
| 762 |
|
---|
| 763 | # Remove the build directory except if the package build fails.
|
---|
| 764 | if [ "$i" = "119-bootscripts" -o "$i" = "132-kernel" ] ; then
|
---|
| 765 | (
|
---|
| 766 | cat << EOF
|
---|
| 767 | @ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
---|
| 768 | rm -r \$(LFS)\$(SRC)/\$\$ROOT
|
---|
| 769 | EOF
|
---|
| 770 | ) >> $MKFILE.tmp
|
---|
| 771 | fi
|
---|
| 772 |
|
---|
| 773 | # Include a touch of the target name so make can check
|
---|
| 774 | # if it's already been made.
|
---|
| 775 | (
|
---|
| 776 | cat << EOF
|
---|
| 777 | @touch \$@
|
---|
| 778 | EOF
|
---|
| 779 | ) >> $MKFILE.tmp
|
---|
| 780 |
|
---|
| 781 | # Keep the script file name for Makefile dependencies.
|
---|
| 782 | PREV=$i
|
---|
| 783 | done
|
---|
| 784 |
|
---|
[3f990d1] | 785 | # Add a header, some variables and include the function file
|
---|
| 786 | # to the top of the real Makefile.
|
---|
| 787 | (
|
---|
| 788 | cat << EOF
|
---|
| 789 | $HEADER
|
---|
| 790 |
|
---|
| 791 | SRC= /sources
|
---|
| 792 | LFS= $BUILDDIR
|
---|
[a41ce58] | 793 | PAGE= $PAGE
|
---|
[2a54650] | 794 | TIMEZONE= $TIMEZONE
|
---|
[3f990d1] | 795 |
|
---|
| 796 | include functions
|
---|
| 797 |
|
---|
| 798 | EOF
|
---|
| 799 | ) > $MKFILE
|
---|
[8bb92e7] | 800 |
|
---|
[c08d23b] | 801 |
|
---|
| 802 | # Add chroot commands
|
---|
| 803 | i=1
|
---|
| 804 | for file in chapter06/*chroot* ; do
|
---|
| 805 | chroot=`cat $file | sed -e '/#!\/bin\/sh/d' -e 's@ \\\@ @g' | tr -d '\n' | sed \
|
---|
[002f8a7] | 806 | -e 's/ */ /g' -e 's|\\$|&&|g' -e 's|&&exit||g' -e 's|$| -c|' -e 's|"$$LFS"|$(LFS)|'`
|
---|
[d7fd195] | 807 | echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
---|
[c08d23b] | 808 | i=`expr $i + 1`
|
---|
| 809 | done
|
---|
[9e406b5] | 810 |
|
---|
[0bad6ba] | 811 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
| 812 | # as a dependency.
|
---|
[3f990d1] | 813 | (
|
---|
| 814 | cat << EOF
|
---|
[cf7f294] | 815 | all: chapter4 chapter5 chapter6 chapter789
|
---|
[898f47a] | 816 | @\$(call echo_finished,$VERSION)
|
---|
[3f990d1] | 817 |
|
---|
| 818 | chapter4: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
---|
| 819 |
|
---|
| 820 | chapter5: chapter4 $chapter5
|
---|
| 821 |
|
---|
| 822 | chapter6: chapter5 $chapter6
|
---|
| 823 |
|
---|
[cf7f294] | 824 | chapter789: chapter6 $chapter789
|
---|
| 825 |
|
---|
[3f990d1] | 826 | clean-all: clean
|
---|
| 827 | rm -rf ./*
|
---|
| 828 |
|
---|
| 829 | clean: clean-chapter5 clean-chapter4
|
---|
| 830 |
|
---|
| 831 | clean-chapter4:
|
---|
| 832 | -userdel lfs
|
---|
| 833 | rm -rf /home/lfs
|
---|
| 834 | rm -rf \$(LFS)/tools
|
---|
| 835 | rm -f /tools
|
---|
| 836 | rm -f envars
|
---|
| 837 | rm -f 02* logs/02*.log
|
---|
| 838 |
|
---|
| 839 | clean-chapter5:
|
---|
| 840 | rm -rf \$(LFS)/tools/*
|
---|
| 841 | rm -f $chapter5
|
---|
| 842 | cd logs && rm -f $chapter5 && cd ..
|
---|
| 843 |
|
---|
| 844 | 020-creatingtoolsdir:
|
---|
| 845 | @\$(call echo_message, Building)
|
---|
| 846 | @mkdir -v \$(LFS)/tools && \\
|
---|
| 847 | ln -sv \$(LFS)/tools / && \\
|
---|
| 848 | touch \$@
|
---|
| 849 |
|
---|
| 850 | 021-addinguser: 020-creatingtoolsdir
|
---|
| 851 | @\$(call echo_message, Building)
|
---|
| 852 | @groupadd lfs && \\
|
---|
| 853 | useradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\
|
---|
| 854 | chown lfs \$(LFS)/tools && \\
|
---|
| 855 | chown lfs \$(LFS)/sources && \\
|
---|
| 856 | touch \$@
|
---|
| 857 |
|
---|
| 858 | 022-settingenvironment: 021-addinguser
|
---|
| 859 | @\$(call echo_message, Building)
|
---|
| 860 | @echo "exec env -i HOME=\\\$\$HOME TERM=\\\$\$TERM PS1='\u:\w\$$ ' /bin/bash" > /home/lfs/.bash_profile && \\
|
---|
| 861 | echo "set +h" > /home/lfs/.bashrc && \\
|
---|
| 862 | echo "umask 022" >> /home/lfs/.bashrc && \\
|
---|
| 863 | echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\
|
---|
| 864 | echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
---|
| 865 | echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
---|
| 866 | echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
---|
[6e31ef7] | 867 | echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
|
---|
[3f990d1] | 868 | chown lfs:lfs /home/lfs/.bash* && \\
|
---|
| 869 | touch envars && \\
|
---|
| 870 | touch \$@
|
---|
| 871 | EOF
|
---|
| 872 | ) >> $MKFILE
|
---|
[0bad6ba] | 873 |
|
---|
[9e406b5] | 874 | # Bring over the items from the Makefile.tmp
|
---|
| 875 | cat $MKFILE.tmp >> $MKFILE
|
---|
| 876 | rm $MKFILE.tmp
|
---|
| 877 | echo -ne "done\n"
|
---|
[f8de156] | 878 | }
|
---|
| 879 |
|
---|
[88dcce5] | 880 | run_make() {
|
---|
[d310939] | 881 | # Test if make must be run.
|
---|
| 882 | if [ "$RUNMAKE" = "1" ] ; then
|
---|
| 883 | # Build the system
|
---|
| 884 | if [ -e $MKFILE ] ; then
|
---|
[e3e1db0] | 885 | echo -ne "Building the LFS system...\n"
|
---|
[d310939] | 886 | cd $JHALFSDIR && make
|
---|
| 887 | echo -ne "done\n"
|
---|
| 888 | fi
|
---|
[88dcce5] | 889 | fi
|
---|
| 890 | }
|
---|
[1236262] | 891 |
|
---|
[4dafc45] | 892 | if [ ! -d $JHALFSDIR ] ; then
|
---|
[6e31ef7] | 893 | mkdir -pv $JHALFSDIR
|
---|
[1236262] | 894 | fi
|
---|
| 895 |
|
---|
[4c62c61] | 896 | if [ ! -d $LOGDIR ] ; then
|
---|
[6e31ef7] | 897 | mkdir -v $LOGDIR
|
---|
[a5e49c6] | 898 | fi
|
---|
| 899 |
|
---|
[4c62c61] | 900 | >$LOGDIR/$LOG
|
---|
[409488e] | 901 |
|
---|
| 902 | if [ "$PWD" != "$JHALFSDIR" ] ; then
|
---|
[6e31ef7] | 903 | cp -v $0 $XSL $FNC $JHALFSDIR/
|
---|
[409488e] | 904 | fi
|
---|
| 905 |
|
---|
[1236262] | 906 | get_book
|
---|
[f8de156] | 907 | build_Makefile
|
---|
[71642ef] | 908 | run_make
|
---|