From c339ac835c105a9f2db57c2802882dea3dc5bb93 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Wed, 13 Jul 2016 07:11:06 +0200 Subject: [PATCH] safety checks --- make_usd_card.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/make_usd_card.sh b/make_usd_card.sh index 3ad5615..1fbbd2c 100755 --- a/make_usd_card.sh +++ b/make_usd_card.sh @@ -11,11 +11,20 @@ SD_MOUNT_POINT=$2 [ "x$1" == "x" ] && display_usage && exit [ "x$2" == "x" ] && display_usage && exit +if $(df | grep /$ | grep -q "^$SD_DEV"); then + echo "Target and current system device are the same. Can't do that!" + exit +fi + SIMPLEIMAGE_VERSION=${SIMPLEIMAGE_VERSION:-"latest"} LINUX_VERSION=${LINUX_VERSION:-"latest"} SLACKWARE_VERSION=${SLACKWARE_VERSION:-"14.2"} SLACKWARE_MINIROOTFS_VERSION=${SLACKWARE_MINIROOTFS_VERSION:-"01Jul16"} +echo "Going further will wipe ${SD_DEV} and you _will_ lose all data on it !" +echo "/!\\ LAST CHANCE TO HIT Ctrl-C /!\\" +read + wget -c https://www.stdin.xyz/downloads/people/longsleep/pine64-images/simpleimage-pine64-${SIMPLEIMAGE_VERSION}.img.xz unxz simpleimage-pine64-${SIMPLEIMAGE_VERSION}.img.xz dd if=simpleimage-pine64-${SIMPLEIMAGE_VERSION}.img of=$SD_DEV bs=1024