Project

General

Profile

« Previous | Next » 

Revision dd90320c

Added by Renato Botelho almost 8 years ago

Teach build_snapshots.sh to read exit code of build.sh

View differences:

tools/build_snapshots.sh
112 112
		--snapshot-update-status "$*"
113 113
}
114 114

  
115
exec_and_update_status() {
116
	local _cmd="${@}"
117

  
118
	[ -z "${_cmd}" ] \
119
		&& return 1
120

  
121
	# Ref. https://stackoverflow.com/a/30658405
122
	exec 4>&1
123
	local _result=$( \
124
	    { { ${_cmd} 2>&1 3>&-; printf $? 1>&3; } 4>&- \
125
	    | while read -r LINE; do \
126
	    snapshot_update_status "${LINE}"; done 1>&4; } 3>&1)
127
	exec 4>&-
128

  
129
	return ${_result}
130
}
131

  
115 132
git_last_commit() {
116 133
	[ -z "${NO_RESET}" ] \
117 134
		&& git -C "${BUILDER_ROOT}" reset --hard >/dev/null 2>&1
......
198 215
	IFS="
199 216
"
200 217
	if [ -n "${POUDRIERE_SNAPSHOTS}" ]; then
201
		(${BUILDER_ROOT}/build.sh --update-poudriere-ports 2>&1) \
202
		    | while read -r LINE; do
203
			snapshot_update_status "${LINE}"
204
		done
205

  
206
		(${BUILDER_ROOT}/build.sh ${NO_UPLOAD} --update-pkg-repo 2>&1) \
207
		    | while read -r LINE; do
208
			snapshot_update_status "${LINE}"
209
		done
218
		exec_and_update_status \
219
		    "${BUILDER_ROOT}/build.sh --update-poudriere-ports" \
220
		    || exit $?
221

  
222
		exec_and_update_status \
223
		    "${BUILDER_ROOT}/build.sh ${NO_UPLOAD} --update-pkg-repo" \
224
		    || exit $?
210 225
	else
211
		(${BUILDER_ROOT}/build.sh --clean-builder 2>&1) \
212
		    | while read -r LINE; do
213
			snapshot_update_status "${LINE}"
214
		done
215

  
216
		(${BUILDER_ROOT}/build.sh ${NO_UPLOAD} --flash-size '2g 4g' \
217
		    --snapshots ${NO_IMAGES} 2>&1) | while read -r LINE; do
218
			snapshot_update_status "${LINE}"
219
		done
226
		exec_and_update_status \
227
		    "${BUILDER_ROOT}/build.sh --clean-builder" \
228
		    || exit $?
229

  
230
		exec_and_update_status \
231
		    "${BUILDER_ROOT}/build.sh ${NO_UPLOAD} --flash-size '2g 4g' " \
232
		    "--snapshots ${NO_IMAGES}" \
233
		    || exit $?
220 234
	fi
221 235
	IFS=${OIFS}
222 236

  

Also available in: Unified diff