diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-09-10 19:39:11 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-09-10 19:39:11 +0300 |
commit | 4219b173ca9459ba19aa58ca01abe864c0989980 (patch) | |
tree | ac6845ee81d970a546bcb52cf3884f13db794309 /write-and-config.sh | |
parent | 3e5e9de43e052dfeae083519633983bca15dc9e0 (diff) | |
download | v-i-4219b173ca9459ba19aa58ca01abe864c0989980.tar.gz |
feat: write-and-config.sh checks that given device is a block device
Sponsored-by: author
Diffstat (limited to 'write-and-config.sh')
-rwxr-xr-x | write-and-config.sh | 5 |
1 files changed, 5 insertions, 0 deletions
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" |