photuris
9/17/2010 - 5:18 PM

gistfile1.bash

#!/bin/bash

COMMAND='/Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt'
DISKNAME='Development'
IMAGEFILE='/Users/Joshua/Development'

# Is the volume already mounted?
if [ -z `ls -1 /Volumes/ | grep $DISKNAME` ] ; then 
    echo Mounting Volume \"$DISKNAME\"

    # Automount, prompting for password
    $COMMAND --mount $IMAGEFILE /Volumes/$DISKNAME

    # OS X mounts "external" volumes with -noowners by default,
    # so we remount with full ownership enabled.
    # Maybe there's a cleaner workaround for this...
    sudo mount -u -o owners /Volumes/Development
fi