Created
February 11, 2014 15:52
-
-
Save aikomastboom/8937588 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#ramfs_size_mb=512 | |
ramfs_size_mb=1536 | |
origin=${HOME}/Development/ipe | |
name="iperam" | |
mount_point=${HOME}/Development/${name} | |
mkramdisk() { | |
ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512)) | |
#ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}` | |
ramdisk_dev=`hdiutil attach -nomount ram://${ramfs_size_sectors}` | |
newfs_hfs -v "${name}" ${ramdisk_dev} | |
mkdir -p ${mount_point} | |
mount -o noatime -t hfs ${ramdisk_dev} ${mount_point} | |
echo "remove with:" | |
echo "$0 unmount" | |
echo | |
echo "which does for you:" | |
echo "umount -f ${mount_point}" | |
echo "diskutil eject ${ramdisk_dev}" | |
} | |
if [ ! -d ${mount_point}/.hg ]; then | |
mkramdisk | |
set -x | |
rsync -avq --exclude ".fseventsd" --exclude ".DocumentRevisions*" --exclude "/build" --exclude "/deploy" ${origin}/ ${mount_point} | |
else | |
if [ "${1}x" == "silox" ]; then | |
[email protected]:/home/informaat/ipe | |
fi | |
set -x | |
rsync -avP --delete --exclude ".DocumentRevisions*" --exclude ".fseventsd" --exclude ".DS_Store" --exclude "/build" --exclude "/deploy" ${mount_point}/ ${origin} | |
set +x | |
if [ "${1}x" == "unmountx" ]; then | |
ramdisk_dev=`mount | grep ${mount_point} | cut -d ' ' -f 1` | |
set -x | |
umount -f ${mount_point} | |
diskutil eject ${ramdisk_dev} | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment