From 4219b173ca9459ba19aa58ca01abe864c0989980 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 10 Sep 2022 19:39:11 +0300 Subject: feat: write-and-config.sh checks that given device is a block device Sponsored-by: author --- write-and-config.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'write-and-config.sh') diff --git a/write-and-config.sh b/write-and-config.sh index 17bf0ac..ce21afe 100755 --- a/write-and-config.sh +++ b/write-and-config.sh @@ -5,6 +5,11 @@ set -euo pipefail config="$1" dev="$2" +if ! blkid "$dev" >/dev/null; then + echo "$dev is not a block device" 1>&2 + exit 1 +fi + echo "Unmounting everything in $dev" umount -fv "$dev"* || true echo "Write installer.img to $dev" -- cgit v1.2.1