Skip to content

Commit f3e7f6c

Browse files
committed
build_all.sh: add trap for ctrl+c, fix typos
1 parent 170410d commit f3e7f6c

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

build_all.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@
2121
# by default start in dashboard mode
2222
[ -z "${DASHBOARD_MODE}" ] && DASHBOARD_MODE="yes"
2323

24+
# trap CTRL+C in dashboard mode, as the build job runs in background, we have to tell the user to wait
25+
[ "${DASHBOARD_MODE}" = "yes" ] && trap control_c_pressed INT
26+
27+
CONTROL_C_PRESSED=0
28+
29+
control_c_pressed() {
30+
CONTROL_C_PRESSED=1
31+
}
32+
2433
# by default do not bail out after failed build
2534
[ -z "${BAILOUT_FAILED}" ] && BAILOUT_FAILED="no"
2635

@@ -100,6 +109,7 @@ declare -i current=0
100109
failed_targets=""
101110
declare -i failed_jobs=0
102111
declare -i good_jobs=0
112+
SKIP_ANNOUNCED=0
103113

104114
for target in ${targets}
105115
do
@@ -113,6 +123,12 @@ do
113123
out=${build[3]}
114124
target_name=${device:-$project}.${arch}
115125

126+
if [ ${SKIP_ANNOUNCED} -eq 1 ]
127+
then
128+
echo -e "\t${target_name}"
129+
continue
130+
fi
131+
116132
# initialize return value of the non-dashboard job
117133
ret_nondb=0
118134

@@ -164,6 +180,7 @@ do
164180
then
165181
echo ""
166182
echo "${statusline}"
183+
[ ${CONTROL_C_PRESSED} -eq 1 ] && echo "*** Control-C was pressed, please wait until current build finishes ***"
167184
fi
168185
# check if all packages have been built
169186
pkgs_stat=$(head -n 1 ${statusfile} | cut -d" " -f5,7)
@@ -178,6 +195,7 @@ do
178195
cat ${statusfile}
179196
echo ""
180197
echo "${statusline}"
198+
[ ${CONTROL_C_PRESSED} -eq 1 ] && echo "*** Control-C was pressed, please wait until current build finishes ***"
181199
else
182200
sleep ${rr}
183201
fi
@@ -194,6 +212,7 @@ do
194212
cat ${statusfile}
195213
echo ""
196214
echo "${statusline}"
215+
[ ${CONTROL_C_PRESSED} -eq 1 ] && echo "*** Control-C was pressed, please wait until current build finishes ***"
197216
# check if there are any failed jobs in the dashboard
198217
failed_count=$(cat ${statusfile} | grep "^\[" | cut -d' ' -f 2 | grep FAILED | wc -l)
199218
if [ ${failed_count} -gt 0 ]
@@ -239,10 +258,10 @@ do
239258
if [ ${count} -eq 0 ]
240259
then
241260
echo "failed - no release files found!"
242-
echo -e "\nWARNING: No releaase files / images were found, skipping md5 checksum / mv to release folder!"
261+
echo -e "\nWARNING: No release files / images were found, skipping md5 checksum / mv to release folder!"
243262
else
244263
echo "failed - some release files were not created!"
245-
echo -e "\nWARNING: Some releaase files / images may be missing!"
264+
echo -e "\nWARNING: Some release files / images may be missing!"
246265
fi
247266
fi
248267
fi
@@ -316,6 +335,11 @@ do
316335
failed_jobs+=1
317336
failed_targets+="${target_name} - no release files!\n"
318337
fi
338+
if [ ${CONTROL_C_PRESSED} -eq 1 -a ${SKIP_ANNOUNCED} -eq 0 ]
339+
then
340+
echo "Skipping remaining builds:"
341+
SKIP_ANNOUNCED=1
342+
fi
319343
done
320344

321345
if [ $failed_jobs -gt 0 ]

0 commit comments

Comments
 (0)