diff --git a/build_all_targets b/build_all_targets index d9f2674..66cf94b 100755 --- a/build_all_targets +++ b/build_all_targets @@ -5,6 +5,9 @@ FEED="$2" OUTPUT_DIR="$3" BUILD_PARALLEL="$4" +MAX_JOBS=8 +CUR_JOBS=0 + # check for dependencies DEPS="docker-hub docker" @@ -53,9 +56,13 @@ archs+=( ["x86_64"]=x86-64 ) for key in ${!archs[@]}; do SDK="${archs[${key}]}" [ "$OPENWRT_VERSION" != "snapshot" ] && SDK+="-$OPENWRT_VERSION" - if [ -n "$BUILD_PARALLEL" ]; then + if [ -n "$BUILD_PARALLEL" ] ; then + CUR_JOBS=$(( $CUR_JOBS + 1 )) (./build_feed "$SDK" "$FEED" "$OUTPUT_DIR" PARALLEL) & else ./build_feed "$SDK" "$FEED" "$OUTPUT_DIR" fi + while [ $CUR_JOBS -ge $MAX_JOBS ]; do + sleep 20 + done done