Skip to content

Instantly share code, notes, and snippets.

@Axadiw
Last active August 11, 2019 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Axadiw/4fb2aa4fd4cfee444f1d5827cb80632c to your computer and use it in GitHub Desktop.
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
#!/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