Last active
August 11, 2019 09:52
-
-
Save Axadiw/4fb2aa4fd4cfee444f1d5827cb80632c to your computer and use it in GitHub Desktop.
Alternative fake_format for ParaShoot (https://ottomatic.io/o/parashoot/) that removes all contents of a drive, instead of fake_formatting it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$*" ]; then | |
echo "No args" | |
exit 1 | |
fi | |
if [[ $1 == '-v' ]]; then | |
echo "1.2.0" | |
exit 0 | |
fi | |
DISK_NUMBER=$1 | |
diskutil mountDisk /dev/disk$DISK_NUMBER | |
(IFS=' | |
' | |
for PARTITION in `mount | grep /dev/disk$DISK_NUMBER | awk '{print $1}'` | |
do | |
for MOUNT_POINT in `diskutil info $PARTITION | grep "Mount Point" | sed 's/Mount Point://g' | awk '{$1=$1};1'` | |
do | |
rm -rf $MOUNT_POINT | |
done | |
done) | |
# Sometimes rm -rf can lead to "Resource busy". It's not a big deal, so I'm supressing it by "exit 0" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment