Created
October 28, 2016 09:34
-
-
Save mhauri/e2333aead4d652ba8f3db98c0e40f340 to your computer and use it in GitHub Desktop.
Create and manage a case-sensitive disk-image on OSX.
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
#!/bin/bash | |
# where to store the sparse-image | |
WORKSPACE=~/Documents/workspace.dmg.sparseimage | |
create() { | |
hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 60g -volname workspace ${WORKSPACE} | |
} | |
detach() { | |
m=$(hdiutil info | grep "/Volumes/workspace" | cut -f1) | |
if [ ! -z "$m" ]; then | |
hdiutil detach $m | |
fi | |
} | |
attach() { | |
hdiutil attach ${WORKSPACE} | |
} | |
compact() { | |
detach | |
hdiutil compact ${WORKSPACE} -batteryallowed | |
attach | |
} | |
case "$1" in | |
create) create;; | |
attach) attach;; | |
detach) detach;; | |
compact) compact;; | |
*) ;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment