Project

General

Profile

« Previous | Next » 

Revision addbce37

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
80 80
		--snapshot-update-status "$*"
81 81
}
82 82

  
83
exec_and_update_status() {
84
	local _cmd="${@}"
85

  
86
	[ -z "${_cmd}" ] \
87
		&& return 1
88

  
89
	# Ref. https://stackoverflow.com/a/30658405
90
	exec 4>&1
91
	local _result=$( \
92
	    { { ${_cmd} 2>&1 3>&-; printf $? 1>&3; } 4>&- \
93
	    | while read -r LINE; do \
94
	    snapshot_update_status "${LINE}"; done 1>&4; } 3>&1)
95
	exec 4>&-
96

  
97
	return ${_result}
98
}
99

  
83 100
git_last_commit() {
84 101
	[ -z "${NO_RESET}" ] \
85 102
		&& git -C "${BUILDER_ROOT}" reset --hard >/dev/null 2>&1
......
166 183
	IFS="
167 184
"
168 185
	if [ -n "${POUDRIERE_SNAPSHOTS}" ]; then
169
		(${BUILDER_ROOT}/build.sh --update-poudriere-ports 2>&1) \
170
		    | while read -r LINE; do
171
			snapshot_update_status "${LINE}"
172
		done
173

  
174
		(${BUILDER_ROOT}/build.sh ${NO_UPLOAD} --update-pkg-repo 2>&1) \
175
		    | while read -r LINE; do
176
			snapshot_update_status "${LINE}"
177
		done
186
		exec_and_update_status \
187
		    "${BUILDER_ROOT}/build.sh --update-poudriere-ports" \
188
		    || exit $?
189

  
190
		exec_and_update_status \
191
		    "${BUILDER_ROOT}/build.sh ${NO_UPLOAD} --update-pkg-repo" \
192
		    || exit $?
178 193
	else
179
		(${BUILDER_ROOT}/build.sh --clean-builder 2>&1) \
180
		    | while read -r LINE; do
181
			snapshot_update_status "${LINE}"
182
		done
183

  
184
		(${BUILDER_ROOT}/build.sh ${NO_UPLOAD} \
185
		    --snapshots ${NO_IMAGES} "memstick memstickadi memstickserial iso" 2>&1) \
186
		    | while read -r LINE; do
187
			snapshot_update_status "${LINE}"
188
		done
194
		exec_and_update_status \
195
		    "${BUILDER_ROOT}/build.sh --clean-builder" \
196
		    || exit $?
197

  
198
		exec_and_update_status \
199
		    "${BUILDER_ROOT}/build.sh ${NO_UPLOAD} --snapshots " \
200
		    "${NO_IMAGES} 'memstick memstickadi memstickserial iso'" \
201
		    || exit $?
189 202
	fi
190 203
	IFS=${OIFS}
191 204

  

Also available in: Unified diff