Skip to content

Commit

Permalink
Fix for zero byte files overwriting local files (EliasKotlyar#783)
Browse files Browse the repository at this point in the history
* Fix for zero byte files overwriting local files

This commit fixes zero byte files overwriting local files, making camera unbootable

* Update autoupdate.sh
  • Loading branch information
saipsa authored and jmtatsch committed Nov 9, 2018
1 parent 43cd6ee commit 9a664c9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions firmware_mod/autoupdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ do
echo "Can not get remote file $i, exiting."
exit 1
fi
# sometimes zero byte files are received, which overwrite the local files, we ignore those files
# exception: files that are hidden i.e. start with dot. Ex: files like ".gitkeep"
if [[ ! -s ${TMPFILE} ]] && [[ $(basename ${LOCALFILE} | cut -c1-1) != "." ]]; then
echo "Received zero byte file $i, exiting."
exit 1
fi
# Check the file exists in local
if [ -f "${DESTFOLDER}/${LOCALFILE}" ]; then
REMOTESHA=$(${SHA} ${TMPFILE} 2>/dev/null | cut -d "=" -f 2)
Expand Down

0 comments on commit 9a664c9

Please sign in to comment.