Compare commits

..

2 Commits

1 changed files with 23 additions and 0 deletions

View File

@ -5,11 +5,13 @@ LOGFILE=/tmp/void-usb-install-log
function press_any_key {
echo "Press any key to continue or Ctrl+c to abort..."
read -n1 DISCARD_ME
echo ""
}
function are_you_really_really_sure {
echo "Enter the following to continue: $1"
read -p "> " DISCARD_ME
echo ""
if [ "$1" = "$DISCARD_ME" ]; then
return 0
else
@ -100,6 +102,27 @@ else
exit 1
fi
if grep "$TARGET_DISK" /proc/mounts >> $LOGFILE 2>&1; then
echo "The device seems to be mounted. Unmount?"
if yesno; then
echo -n "Attempting to unmount... "
readarray -t MOUNTPOINTS <<< "$(findmnt --raw --noheadings --output SOURCE,TARGET | grep "$TARGET_DISK" | sed 's/^[^ ]* //')"
for I in ${!MOUNTPOINTS[@]}; do
umount -R "${MOUNTPOINTS[$I]}" >> $LOGFILE 2>&1
done
if grep "$TARGET_DISK" /proc/mounts >> $LOGFILE 2>&1; then
echo "failed"
echo "It seems the device is still mounted. Installation cannot continue."
exit 1
else
echo "done"
fi
else
echo "Aborting."
exit 1
fi
fi
echo -n "Wiping and partitioning storage... "
# new GPT
# 2M BIOS GRUB