Add a workaround to make sure images are compressed before rsync, for some reason wait is not working as expected

This commit is contained in:
Renato Botelho 2015-09-18 13:52:19 -03:00
parent e8a3a81b65
commit 39ef49f648
2 changed files with 34 additions and 7 deletions

View File

@ -380,6 +380,10 @@ fi
export DEFAULT_KERNEL=${DEFAULT_KERNEL_ISO:-"${PRODUCT_NAME}"}
# XXX: Figure out why wait is failing and proper fix
# Global variable to keep track of process running in bg
export _bg_pids=""
for _IMGTOBUILD in $_IMAGESTOBUILD; do
# Clean up items that should be cleaned each run
staginareas_clean_each_run
@ -413,12 +417,29 @@ done
core_pkg_create_repo
if [ -n "${SNAPSHOTS}" ]; then
snapshots_update_status ">>> NOTE: waiting for jobs: $(jobs -l) to finish..."
else
echo ">>> NOTE: waiting for jobs: $(jobs -l) to finish..."
if [ -n "${_bg_pids}" ]; then
if [ -n "${SNAPSHOTS}" ]; then
snapshots_update_status ">>> NOTE: waiting for jobs: ${_bg_pids} to finish..."
else
echo ">>> NOTE: waiting for jobs: ${_bg_pids} to finish..."
fi
wait
# XXX: For some reason wait is failing, workaround it tracking all PIDs
while [ -n "${_bg_pids}" ]; do
_tmp_pids="${_bg_pids}"
unset _bg_pids
for p in ${_tmp_pids}; do
[ -z "${p}" ] \
&& continue
kill -0 ${p} >/dev/null 2>&1 \
&& _bg_pids="${_bg_pids}${_bg_pids:+ }${p}"
done
[ -n "${_bg_pids}" ] \
&& sleep 1
done
fi
wait
if [ -n "${SNAPSHOTS}" ]; then
snapshots_copy_to_staging_iso_updates

View File

@ -782,8 +782,10 @@ awk '
# Wrap up the show, Johnny
echo ">>> NanoBSD Image completed for size: $_NANO_MEDIASIZE." | tee -a ${LOGFILE}
gzip -f $IMG &
gzip -f $IMGUPDATE &
gzip -qf $IMG &
_bg_pids="${_bg_pids}${_bg_pids:+ }$!"
gzip -qf $IMGUPDATE &
_bg_pids="${_bg_pids}${_bg_pids:+ }$!"
done
unset IMG
@ -1184,6 +1186,7 @@ create_iso_image() {
print_error_pfS
fi
gzip -qf $ISOPATH &
_bg_pids="${_bg_pids}${_bg_pids:+ }$!"
echo ">>> ISO created: $(LC_ALL=C date)" | tee -a ${LOGFILE}
}
@ -1226,6 +1229,7 @@ create_memstick_image() {
trap "-" 1 2 15 EXIT
mdconfig -d -u ${MD} 2>&1 | tee -a ${LOGFILE}
gzip -qf $MEMSTICKPATH &
_bg_pids="${_bg_pids}${_bg_pids:+ }$!"
echo ">>> MEMSTICK created: $(LC_ALL=C date)" | tee -a ${LOGFILE}
}
@ -1287,6 +1291,7 @@ create_memstick_serial_image() {
trap "-" 1 2 15 EXIT
mdconfig -d -u ${MD} 2>&1 >> ${LOGFILE}
gzip -qf $MEMSTICKSERIALPATH &
_bg_pids="${_bg_pids}${_bg_pids:+ }$!"
echo ">>> MEMSTICKSERIAL created: $(LC_ALL=C date)" | tee -a ${LOGFILE}
}
@ -1350,6 +1355,7 @@ create_memstick_adi_image() {
trap "-" 1 2 15 EXIT
mdconfig -d -u ${MD} 2>&1 >> ${LOGFILE}
gzip -qf $MEMSTICKADIPATH &
_bg_pids="${_bg_pids}${_bg_pids:+ }$!"
echo ">>> MEMSTICKADI created: $(LC_ALL=C date)" | tee -a ${LOGFILE}
}