aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2019-05-15 20:13:48 +0200
committerBjørn Mork <bjorn@mork.no>2019-05-15 20:13:48 +0200
commitfee952549020b40aee0a955f9f4e25ab08c57338 (patch)
treef82f3f2ffcd981845763dd9deef0780ebe2457b9
parenta7e112653257dc4973af6bd1b1ff1bcfa45766ba (diff)
adding some failsafing to the fimrware updaterv0.02
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rw-r--r--update.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/update.sh b/update.sh
index abc6ad0..7b6c875 100644
--- a/update.sh
+++ b/update.sh
@@ -87,6 +87,7 @@ if [ "$action" = "update" ]; then
size=$(grep '"userdata"' /proc/mtd |cut -f2 -d\ )
blocksize=$(grep '"userdata"' /proc/mtd |cut -f3 -d\ )
blocks=$(( 0x${size} / 0x${blocksize} ))
+ [ -z "$userdata" ] || [ -z "$size" ] || [ -z "$blocksize" ] || [ -z "$blocks" ] && exit 1
/usr/bin/flash_erase "$userdata" 0 ${blocks}
tar xOf "$enc_bin" update.aes | openssl aes-128-cbc -k `cat /tmp/update/aes.key` -nosalt -d | dd bs=$((0x${blocksize})) of="$userdata" > /dev/null 2> /dev/null || exit 1