From 27d8ef00db790336cf17cf8e63fd0a1b3a0986b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Mon, 13 Sep 2021 18:46:39 +0200 Subject: [PATCH] scripts: sd_fusing_rpi3: check file type before writing an image MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- scripts/tizen/sd_fusing_rpi3.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/tizen/sd_fusing_rpi3.sh b/scripts/tizen/sd_fusing_rpi3.sh index e7a7383bef..62efa1352e 100755 --- a/scripts/tizen/sd_fusing_rpi3.sh +++ b/scripts/tizen/sd_fusing_rpi3.sh @@ -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` -- 2.34.1