Skip to content

Commit de4c50f

Browse files
committed
properly end when unzip/untar fails
1 parent 4753845 commit de4c50f

File tree

2 files changed

+35
-21
lines changed

2 files changed

+35
-21
lines changed

bash/force-level2.sh

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,10 @@ function process_this_image(){
146146
--exclude='LE07*B6_VCID_2.TIF' --exclude='LC08*B11.TIF' --exclude='LC08*B8.TIF' \
147147
-C "$EXTRACT_IMAGE" &> /dev/null
148148
if [ ! $? -eq 0 ]; then
149+
UNPACK_STATUS="FAIL"
149150
echo "tar.gz container is corrupt, connection stalled or similar." >> "$FILE_LOG"
150-
exit 1
151151
else
152+
UNPACK_STATUS="SUCCESS"
152153
echo "Unpacking tar.gz container successful" >> "$FILE_LOG"
153154
fi
154155

@@ -168,9 +169,10 @@ function process_this_image(){
168169
--exclude='LE07*B6_VCID_2.TIF' --exclude='LC08*B11.TIF' --exclude='LC08*B8.TIF' \
169170
-C "$EXTRACT_IMAGE" &> /dev/null
170171
if [ ! $? -eq 0 ]; then
172+
UNPACK_STATUS="FAIL"
171173
echo "tar container is corrupt, connection stalled or similar." >> "$FILE_LOG"
172-
exit 1
173174
else
175+
UNPACK_STATUS="SUCCESS"
174176
echo "Unpacking tar container successful" >> "$FILE_LOG"
175177
fi
176178

@@ -184,48 +186,60 @@ function process_this_image(){
184186

185187
timeout -k "$TIMEOUT_ZIP" 10m unzip -qq -d "$DIR_TEMP" "$FILE_IMAGE" &>/dev/null
186188
if [ ! $? -eq 0 ]; then
189+
UNPACK_STATUS="FAIL"
187190
echo "zip container is corrupt, connection stalled or similar." >> "$FILE_LOG"
188-
exit 1
189191
else
192+
UNPACK_STATUS="SUCCESS"
190193
echo "Unpacking zip container successful" >> "$FILE_LOG"
194+
dir_not_found "$EXTRACT_IMAGE" &>>"$FILE_LOG"
191195
fi
192196

193-
dir_not_found "$EXTRACT_IMAGE" &>>"$FILE_LOG"
194-
195197
# already unpacked
196198
else
197199

198200
unpacked=false
201+
UNPACK_STATUS="SUCCESS"
199202
EXTRACT_IMAGE="$FILE_IMAGE"
200203
dir_not_found "$FILE_IMAGE" &>>"$FILE_LOG"
201204
echo "Image is already unpacked" >> "$FILE_LOG"
202205

203206
fi
204207

208+
debug "UNPACK_STATUS" "$UNPACK_STATUS"
205209
debug "unpacked: $unpacked"
206210
debug "EXTRACT_IMAGE: $EXTRACT_IMAGE"
207211

212+
if [ "$UNPACK_STATUS" == "SUCCESS" ]; then
208213

209-
{
210-
echo ""
211-
echo "Start core processing"
212-
echo "-----------------------------------------------------------"
213-
echo ""
214-
} >> "$FILE_LOG"
214+
{
215+
echo ""
216+
echo "Start core processing"
217+
echo "-----------------------------------------------------------"
218+
echo ""
219+
} >> "$FILE_LOG"
220+
221+
# process
222+
if $FORCE_L2PS_CORE_EXE "$EXTRACT_IMAGE" "$FILE_PRM" &>> "$FILE_LOG"; then
223+
STATUS="DONE"
224+
else
225+
STATUS="FAIL"
226+
fi
227+
228+
debug "STATUS: $STATUS"
229+
230+
{
231+
echo ""
232+
echo "-----------------------------------------------------------"
233+
echo "Core processing signaled $STATUS"
234+
} >> "$FILE_LOG"
235+
236+
else
215237

216-
# process
217-
if $FORCE_L2PS_CORE_EXE "$EXTRACT_IMAGE" "$FILE_PRM" &>>"$FILE_LOG"; then
218-
STATUS="DONE"
219-
else
220238
STATUS="FAIL"
221-
fi
222239

223-
debug "STATUS: $STATUS"
240+
fi
224241

225242
{
226-
echo ""
227-
echo "-----------------------------------------------------------"
228-
echo "Core processing signaled $STATUS"
229243
echo ""
230244
echo "End of processing: $(date +"%Y-%m-%d %H:%M:%S")"
231245
echo "May the FORCE be with you!"

misc/force-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.12-dev:::2024-05-23_06:40:24
1+
3.7.12-dev:::2024-05-23_07:24:52

0 commit comments

Comments
 (0)