diff --git a/chr.sh b/chr.sh index 5bb3dc0..2da88e6 100644 --- a/chr.sh +++ b/chr.sh @@ -40,15 +40,6 @@ DNS=$(grep '^nameserver' /etc/resolv.conf | awk '{print $2}' | head -n 1) [ -z "$DNS" ] && DNS="8.8.8.8" echo "DNS: $DNS" - -echo "WARNING: All data on /dev/$STORAGE will be lost!" -read -p "Do you want to continue? [Y/n]: " confirm < /dev/tty -confirm=${confirm:-Y} -if [[ "$confirm" =~ ^[Nn]$ ]]; then - echo "Operation aborted." - exit 1 -fi - echo "FILE: $(basename $IMG_URL)" if command -v wget >/dev/null 2>&1; then wget --no-check-certificate -O /tmp/chr.img.zip "$IMG_URL" || { echo "Download failed!"; exit 1; } @@ -78,6 +69,14 @@ EOF losetup -d $LOOP fi +echo "WARNING: All data on /dev/$STORAGE will be lost!" +read -p "Do you want to continue? [Y/n]: " confirm < /dev/tty +confirm=${confirm:-Y} +if [[ "$confirm" =~ ^[Nn]$ ]]; then + echo "Operation aborted." + exit 1 +fi + dd if=chr.img of=/dev/$STORAGE bs=4M conv=fsync echo "Ok, rebooting..." echo 1 > /proc/sys/kernel/sysrq 2>/dev/null || true