It is possible to request flashing a device which is non-existent
or unaccessible. Especially, request can flash non-removable
storage disk that user do not really intend. To skip all the case,
Check requested device.
For non removable disk, it will ask user really intended to flash
the device.
Change-Id: I7ee3363fe4075abd7b860acf26b6cbe65e6fa68c
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
fi
}
+function check_device () {
+ if [ ! -b "$DEVICE" ]; then
+ echo "No such device: $DEVICE"
+ exit 0
+ fi
+
+ local REMOVABLE=`lsblk $DEVICE -nd -o RM | grep 1 | wc -l`
+ if [ "$REMOVABLE" == "0" ]; then
+ echo ""
+ echo "$(tput setaf 3)$(tput bold)$DEVICE is not a removable disk, Is it OK? [y/<n>]"
+ tput sgr 0
+ read input
+ if [ "$input" != "y" ] && [ "$input" != "Y" ]; then
+ exit 0
+ fi
+ fi
+
+ if [ ! -w "$DEVICE" ]; then
+ echo "Write not permitted: $DEVICE"
+ exit 0
+ fi
+}
+
function print_logo () {
echo ""
- echo "Raspberry Pi3 downloader, version 1.1"
+ echo "Raspberry Pi3 downloader, version 1.2"
echo ""
}
done
check_args
+check_device
check_partition_format
fuse_image