## # rc.swapfile -- set up a separate swapfile partition in Mac OS X # # Copyright 2004 Dave Bayer # Subject to the terms and conditions of the MIT License # Code version of January 4, 2004, tested with Mac OS X 10.3.2 # Instructions version of January 15, 2004 # See http://www.math.columbia.edu/~bayer/OSX/swapfile/ # # To use this file, install it as the file /etc/rc.swapfile # After the line in the system startup script /etc/rc # # swapdir=/private/var/vm # # insert the line # # if [ -f /etc/rc.swapfile ]; then . /etc/rc.swapfile; fi # inserted locally # # Change the definition of swapvolume below if necessary; do not use spaces # E.g. if the swap partition is # # /dev/disk0s10 /Volumes/Swap # # then edit the definition of swapvolume below to read # # swapvolume=Swap # # If the swap partition is on a non-IDE drive, type in a terminal window # # sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true # # Restart ## swapvolume=Swap if [ ! -d /Volumes/${swapvolume}/.Trashes ]; then swapcount=1 ConsoleMessage "Waiting for ${swapvolume} to mount" while [ "$swapcount" -le 30 ]; do sleep 1 if [ -d /Volumes/${swapvolume}/.Trashes ]; then ConsoleMessage "${swapvolume} mounted after $swapcount seconds" break fi swapcount=`expr $swapcount + 1` done fi if [ -d /Volumes/${swapvolume}/.Trashes ]; then ConsoleMessage "Using ${swapvolume} for swapfile" if [ -f ${swapdir}/swapfile0 ]; then rm -rf ${swapdir}/swap* fi swapdir=/Volumes/${swapvolume}/.vm else ConsoleMessage "Unable to use ${swapvolume} for swapfile" fi