SHARE
TWEET

Untitled

a guest Jun 19th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # where to store the sparse-image
  4. WORKSPACE=~/Documents/workspace.dmg.sparseimage
  5.  
  6. create() {
  7.     hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 100g -volname workspace ${WORKSPACE}
  8. }
  9.  
  10. detach() {
  11.     m=$(hdiutil info | grep "/Volumes/workspace" | cut -f1)
  12.     if [ ! -z "$m" ]; then
  13.         hdiutil detach $m
  14.     fi
  15. }
  16.  
  17. attach() {
  18.     hdiutil attach ${WORKSPACE}
  19. }
  20.  
  21. compact() {
  22.     detach
  23.     hdiutil compact ${WORKSPACE} -batteryallowed
  24.     attach
  25. }
  26.  
  27. case "$1" in
  28.     create) create;;
  29.     attach) attach;;
  30.     detach) detach;;
  31.     compact) compact;;
  32.     *) ;;
  33. esac
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top