This file contains hidden or 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 | |
# Designed to be run inside the user environment to create a sparse bundle image which contains parity and checksums | |
# Band size is 256MB | |
# variables | |
CONSOLEUSER="$(stat -f %Su /dev/console)" || { echo "`date`: Failed to get username correctly. Exiting"; exit 1; } | |
# stash and eject previous image if exists | |
if [ -d "/Volumes/$CONSOLEUSER.sparsebundle" ]; then | |
/usr/bin/hdiutil eject "/Volumes/$CONSOLEUSER.sparsebundle" || { echo "`date`: Failed to unmount previous image. Try again"; exit 1; } | |
sleep 10 | |
fi |