safety checks

This commit is contained in:
Gwenhael Le Moine 2016-07-13 07:11:06 +02:00
parent 3667c8f09c
commit c339ac835c

View file

@ -11,11 +11,20 @@ SD_MOUNT_POINT=$2
[ "x$1" == "x" ] && display_usage && exit [ "x$1" == "x" ] && display_usage && exit
[ "x$2" == "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"} SIMPLEIMAGE_VERSION=${SIMPLEIMAGE_VERSION:-"latest"}
LINUX_VERSION=${LINUX_VERSION:-"latest"} LINUX_VERSION=${LINUX_VERSION:-"latest"}
SLACKWARE_VERSION=${SLACKWARE_VERSION:-"14.2"} SLACKWARE_VERSION=${SLACKWARE_VERSION:-"14.2"}
SLACKWARE_MINIROOTFS_VERSION=${SLACKWARE_MINIROOTFS_VERSION:-"01Jul16"} 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 wget -c https://www.stdin.xyz/downloads/people/longsleep/pine64-images/simpleimage-pine64-${SIMPLEIMAGE_VERSION}.img.xz
unxz 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 dd if=simpleimage-pine64-${SIMPLEIMAGE_VERSION}.img of=$SD_DEV bs=1024