Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # where to store the sparse-image
- WORKSPACE=~/Documents/workspace.dmg.sparseimage
- create() {
- hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 100g -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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement