
# +----------------------------------------------------------------------+
# | |
# | Set up Mac OS X to store temporary files in RAM rather than on disk.|
# | |
# | By Philipp Klaus <
# | |
# | Originally by Ricardo Gameiro <
# | Changes by Daniel Jenkins |
# | <
# | |
# +----------------------------------------------------------------------+
cd /System/Library/StartupItems
sudo mkdir RamFS
sudo chown -R root:wheel RamFS
sudo chmod -R u+rwX,g+rX,o+rX RamFS
cat << «EOF» | sudo tee RamFS/RamFS > /dev/null
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
RAMDisk(){
mntpt=$1
rdsize=$(($2*1024*1024/512))
echo «Creating RamFS for $mntpt»
# Create the RAM disk.
dev=`hdik -drivekey system-image=yes -nomount
# Successfull creation...
if[$? -eq 0 ] ; then
# Create HFS on the RAM volume.
newfs_hfs $dev
# Store permissions from old mount point.
eval `/usr/bin/stat -s $mntpt`
# Mount the RAM disk to the target mount point.
mount -t hfs -o union -o nobrowse $dev $mntpt
# Restore permissions like they were on old volume.
chown $st_uid:$st_gid $mntpt
chmod $st_mode $mntpt
fi
}
# Test for arguments.
if[ -z $1 ]; then
echo «Usage: $0 [start|stop|restart] «
exit 1
fi
