[Gta04-owner] [PATCH] makesd: device safety check
Andreas Kemnade
andreas at kemnade.info
Thu Mar 1 18:22:01 CET 2018
do not automatically use /dev/sdc if no device is specified
instead print usage and an error message.
Signed-off-by: Andreas Kemnade <andreas at kemnade.info>
---
makesd | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/makesd b/makesd
index 16767c8..4b0e6c4 100755
--- a/makesd
+++ b/makesd
@@ -15,7 +15,6 @@ CMDLINE="$0 $@" # save how makesd was called
[ "$VARIANT" ] || VARIANT=latest
[ "$ARCHITECTURE" ] || ARCHITECTURE=-armhf
[ "$DEV" ] || DEV="$(cat ~/.makesd.conf 2>/dev/null)"
-[ "$DEV" ] || DEV=/dev/sdc
function macros()
{
@@ -483,6 +482,12 @@ echo sfdisk version: $SFVER $(version $SFVER) >&2
}
### here starts real processing ###
+if [ ! "$DEV" ]
+then
+ useage
+ echo "Error: No device specified, cannot continue"
+ exit 1
+fi
for TOOL in sfdisk fdisk partprobe dd mkfs.vfat mke2fs fsck.vfat fsck.ext3 fsck
do
--
2.11.0
More information about the Gta04-owner
mailing list