1#!/bin/sh
2
3export HDBMEGS=128
4
5build_in_dir()
6{
7	cd "$1" || exit 1
8	rm -f hdb.img 2>/dev/null
9	nice -n10 ./native-build.sh ../hdc.img
10	rm -f hdb.img 2>/dev/null
11}
12
13started=false
14for dir; do
15	test -d "$dir" || continue
16	test -e "$dir/native-build.sh" || continue
17	echo "Starting: $dir"
18	build_in_dir "$dir" </dev/null >"$dir.log" 2>&1 &
19	started=true
20done
21
22$started || {
23	echo "Give me system-image-ARCH directories on command line"
24	exit 1
25}
26
27echo "Waiting to finish"
28wait
29echo "Done, check the logs"
30