Breakout make download and count cpus

This commit is contained in:
2022-02-23 16:26:38 -05:00
parent 907c4bc28b
commit e44e98b144

View File

@@ -260,6 +260,8 @@ sshBackup() {
makeImage() { makeImage() {
debug "${FUNCNAME[0]}" debug "${FUNCNAME[0]}"
declare _nprocs
# Reuse the existing output # Reuse the existing output
if [[ -d "${P_ARR[out_bin_dir]}" ]]; then if [[ -d "${P_ARR[out_bin_dir]}" ]]; then
if askOk "${P_ARR[out_bin_dir]} exists. Rebuild?"; then if askOk "${P_ARR[out_bin_dir]} exists. Rebuild?"; then
@@ -271,9 +273,19 @@ makeImage() {
[[ ! -d "${P_ARR[out_bin_dir]}" ]] && mkdir -p "${P_ARR[out_bin_dir]}" [[ ! -d "${P_ARR[out_bin_dir]}" ]] && mkdir -p "${P_ARR[out_bin_dir]}"
_numcpus=$(nproc)
_numcpus=$(( _numcpus - 1 ))
# download image
debug "make download BIN_DIR=${P_ARR[out_bin_dir]} PROFILE=${P_ARR[profile]} PACKAGES=${P_ARR[packages]} FILES=$FILESDIR --directory=${P_ARR[source_dir]} > make.log"
if ! make download BIN_DIR="${P_ARR[out_bin_dir]}" PROFILE="${P_ARR[profile]}" PACKAGES="${P_ARR[packages]}" FILES="$FILESDIR" --directory="${P_ARR[source_dir]}" > make.log; then
echo "Make download failed!"
exit 1
fi
# build image # build image
debug "make -j4 image BIN_DIR=${P_ARR[out_bin_dir]} PROFILE=${P_ARR[profile]} PACKAGES=${P_ARR[packages]} FILES=$FILESDIR --directory=${P_ARR[source_dir]} > make.log" debug "make -j$_numcpus image BIN_DIR=${P_ARR[out_bin_dir]} PROFILE=${P_ARR[profile]} PACKAGES=${P_ARR[packages]} FILES=$FILESDIR --directory=${P_ARR[source_dir]} >> make.log"
if ! make image BIN_DIR="${P_ARR[out_bin_dir]}" PROFILE="${P_ARR[profile]}" PACKAGES="${P_ARR[packages]}" FILES="$FILESDIR" --directory="${P_ARR[source_dir]}" > make.log; then if ! make -j$_numcpus image BIN_DIR="${P_ARR[out_bin_dir]}" PROFILE="${P_ARR[profile]}" PACKAGES="${P_ARR[packages]}" FILES="$FILESDIR" --directory="${P_ARR[source_dir]}" >> make.log; then
echo "Make image failed!" echo "Make image failed!"
exit 1 exit 1
fi fi