scripts: sd_fusing_rpi3: check file type before writing an image 16/272116/1
authorŁukasz Stelmach <stlman@poczta.fm>
Mon, 13 Sep 2021 16:46:39 +0000 (18:46 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Wed, 9 Mar 2022 12:33:53 +0000 (13:33 +0100)
Sometimes, when sfdisk failure is not handeled properly, sd_fusing_rpi3
may leave a regular file named like a device in the /dev directory. Such
file will exist and prevent images from beeing properly flashed until
the machine is rebooted. The message indicates there is somehting wrong
with the device file so users may check and fix any problems.

Change-Id: Ie7021129b858f0f4f2923ce88ee96f349e869029
Signed-off-by: Łukasz Stelmach <stlman@poczta.fm>
scripts/tizen/sd_fusing_rpi3.sh

index e7a7383..62efa13 100755 (executable)
@@ -88,6 +88,11 @@ function fusing_image () {
                return
        fi
 
+       if ! [ -b "$device" ]; then
+               print_message 1 "$device is not a block device."
+               exit 1
+       fi
+
        local -r input_size=`du -b $fusing_img | awk '{print $1}'`
        local -r input_size_mb=`expr $input_size / 1024 / 1024`