parallel-build-hdc-img.sh 722 B

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