From fee952549020b40aee0a955f9f4e25ab08c57338 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Wed, 15 May 2019 20:13:48 +0200 Subject: adding some failsafing to the fimrware updater MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork --- update.sh | 1 + 1 file changed, 1 insertion(+) 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 -- cgit v1.2.3