#!/bin/sh
# MACOSX: Creates and mounts an HFS RAM disk of a specified size.

if [ ! $# -eq 2 ]; then
    echo "usage: $0 <mount point> <size in bytes>"
    exit -1
fi

SIZE=`echo $2/512 | bc`
DISK=`hdid -nomount ram://$SIZE`
echo "created $DISK."

newfs_hfs $DISK

mkdir -p $1
echo "created mount-point."

mount -t hfs $DISK $1
echo "mounted ram disk."
