Skip to content

Commit

Permalink
bmap-writer-stream.sh: fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
embetrix committed Feb 3, 2025
1 parent 7cf706c commit 7489280
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bmap-writer-stream.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh -e
#!/bin/sh

export PATH=$PWD:$PATH

Expand All @@ -20,12 +20,12 @@ fi

BMAP_URL=$(echo "$IMAGE_URL" | sed 's/\.[^.]*$/.bmap/')
BMAP_FILE=$(echo "$BMAP_URL" | sed 's/.*\///')

BMAP_FILE="${BMAP_FILE}_"

echo "Downloading $BMAP_URL to $BMAP_FILE"
$WGET -q $BMAP_URL -O $BMAP_FILE
if [ $? -ne 0 ]; then
echo "Failed to download $BMAP_URL"
if [ $? -ne 0 ] || [ ! -f $BMAP_FILE ] || [ ! -s $BMAP_FILE ]; then
echo "Failed to download $BMAP_URL or file is empty"
exit 1
fi
echo "Streaming $IMAGE_URL to $DEVICE"
Expand Down

0 comments on commit 7489280

Please sign in to comment.