I store all my photos (iPhoto) and music (iTunes) on an external FireWire drive. Normally the drive is attached to my iMac, but when I travel, I take the external hard drive and hook it up to my laptop. I want to have my iTunes work whether or not the drive is attached, and have it work automatically.
The quick summary of my solution is:
My Mounting Script:
#!/bin/bash
HOME=/Users/username
GRAID_MOUNT="/Volumes/G-RAID_MINI"
IPHOTO_TAIL="iPhoto_Library"
IPHOTO_TAIL_LOCAL="iPhoto_Library.local"
IPHOTOLIBRARY_LINK=$HOME/Pictures/$IPHOTO_TAIL
IPHOTO_GRAID=$GRAID_MOUNT/Photos/$IPHOTO_TAIL
IPHOTO_LOCAL=$HOME/Pictures/$IPHOTO_TAIL_LOCAL
ITUNES_LINK=$HOME/Music/iTunes
ITUNES_GRAID=$GRAID_MOUNT/Music/iTunes
ITUNES_LOCAL=$HOME/Music/iTunes.local
if [ -d $GRAID_MOUNT ]; then
echo ........ G-RAID MOUNTING ..........
`rm $IPHOTOLIBRARY_LINK `
`ln -s $IPHOTO_GRAID $IPHOTOLIBRARY_LINK`
`rm $ITUNES_LINK`
`ln -s $ITUNES_GRAID $ITUNES_LINK`
echo DONE CHANGING IPHOTO AND ITUNES LINKS
exit 0
fi
echo ERROR DISK NOT MOUNTED#!/bin/bash
HOME=/Users/username
GRAID_MOUNT="/Volumes/G-RAID_MINI"
IPHOTO_TAIL="iPhoto_Library"
IPHOTO_TAIL_LOCAL="iPhoto_Library.local"
IPHOTOLIBRARY_LINK=$HOME/Pictures/$IPHOTO_TAIL
IPHOTO_GRAID=$GRAID_MOUNT/Photos/$IPHOTO_TAIL
IPHOTO_LOCAL=$HOME/Pictures/$IPHOTO_TAIL_LOCAL
ITUNES_LINK=$HOME/Music/iTunes
ITUNES_GRAID=$GRAID_MOUNT/Music/iTunes
ITUNES_LOCAL=$HOME/Music/iTunes.local
if [ -d $GRAID_MOUNT ]; then
echo GRAID NOT UNMOUNTED
exit 0;
fi
echo ..... GRAID IS BEING UNMOUNTED
`rm $IPHOTOLIBRARY_LINK `
`ln -s $IPHOTO_LOCAL $IPHOTOLIBRARY_LINK`
`rm $ITUNES_LINK`
`ln -s $ITUNES_LOCAL $ITUNES_LINK`
echo DONE UNMOUNTING GRAIDMac OS X Hints
http://hints.macworld.com/article.php?story=20090621015649375