summaryrefslogtreecommitdiff
path: root/misc/mac-tmp-disk-mount.sh
blob: f752c54f67019354423763b96933e5644bd38c03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
set -e
cd "$(dirname "$0")/.."

# Create if needed
if [[ ! -f build/tmp.sparseimage ]]; then
  echo "Creating sparse disk image with case-sensitive file system build/tmp.sparseimage"
  mkdir -p build
  hdiutil create build/tmp.sparseimage \
    -size 1g \
    -type SPARSE \
    -fs JHFS+X \
    -volname tmp
fi

# Mount if needed
if ! (diskutil info build/tmp >/dev/null); then
  echo "Mounting sparse disk image with case-sensitive file system at build/tmp"
  hdiutil attach build/tmp.sparseimage \
    -readwrite \
    -mountpoint "$(pwd)/build/tmp" \
    -nobrowse \
    -noautoopen \
    -noidmereveal
fi