annotate forkbomb.sh @ 262:b2e353ae7566

Have host-tools populate build/host with 1) toybox, 2) all the remaining busybox commands the build can use, 3) symlinks for the other dozen or so commands the build needs. Then set $PATH to _just_ build/host, yanking the rest of the $PATH so it won't call other things from the host. This way, the environmental dependencies are more explicit. (Note that some commands symlinked from the host could be built by busybox, but the busybox versions of those don't work correctly in the build.)
author Rob Landley <rob@landley.net>
date Fri, 25 Jan 2008 03:26:35 -0600
parents 863e15b54e17
children dc5f5eeea57d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
206
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/bin/bash
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 # Test script to build every target architecture, logging output.
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 # With --fork, it builds them in parallel
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 # With --nofork, it build them sequentially
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
6 # With --watch, it displays output from an existing parallel build
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
7
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
8 function buildarch()
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 {
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
10 nice -n 20 ./cross-compiler.sh $1 &&
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 nice -n 20 ./mini-native.sh $1 &&
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 nice -n 20 ./package-mini-native.sh $1
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 }
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
14
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 if [ "$1" != "--watch" ]
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 then
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 if [ $# -ne 0 ]
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 then
222
8b0d2080707c Be smarter about extracting tarballs: extract one copy of each tarball
Rob Landley <rob@landley.net>
parents: 212
diff changeset
19 (nice -n 20 ./download.sh &&
262
b2e353ae7566 Have host-tools populate build/host with 1) toybox, 2) all the remaining
Rob Landley <rob@landley.net>
parents: 258
diff changeset
20 # host-tools populates one directory with every command the build needs,
b2e353ae7566 Have host-tools populate build/host with 1) toybox, 2) all the remaining
Rob Landley <rob@landley.net>
parents: 258
diff changeset
21 # so we can ditch the old $PATH afterwards.
253
f93932523a08 Reorder forkbomb build so ./host-tools.sh gets built first. Then toybox
Rob Landley <rob@landley.net>
parents: 222
diff changeset
22 nice -n 20 ./host-tools.sh &&
262
b2e353ae7566 Have host-tools populate build/host with 1) toybox, 2) all the remaining
Rob Landley <rob@landley.net>
parents: 258
diff changeset
23 PATH=`pwd`/build/host &&
253
f93932523a08 Reorder forkbomb build so ./host-tools.sh gets built first. Then toybox
Rob Landley <rob@landley.net>
parents: 222
diff changeset
24 nice -n 20 ./download.sh --extract ) || exit 1
206
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 fi
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
26 for i in `cd sources/configs; ls`
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
27 do
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
28 if [ "$1" == "--nofork" ]
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
29 then
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
30 buildarch $i 2>&1 | tee out-$i.txt || exit 1
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
31 elif [ "$1" == "--fork" ]
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
32 then
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
33 (buildarch $i > out-$i.txt 2>&1 &)&
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
34 else
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
35 echo "Usage: forkbomb.sh [--fork] [--nofork] [--watch]"
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
36 exit 1
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
37 fi
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
38 done
b328036dbdb1 Of course I'd find a way to make 2 gigs of memory in my new laptop insufficient.
Rob Landley <rob@landley.net>
parents:
diff changeset
39 fi
258
863e15b54e17 Make the display slightly more selective.
Rob Landley <rob@landley.net>
parents: 253
diff changeset
40 watch -n 3 'X=; for i in out-*.txt; do /bin/echo -e "$X$i"; X="\n"; tail -n 1 $i; done'