diff options
author | schmonz <schmonz> | 2006-08-30 04:36:10 +0000 |
---|---|---|
committer | schmonz <schmonz> | 2006-08-30 04:36:10 +0000 |
commit | da790e86287cdb2d174178788768b201991c7f8f (patch) | |
tree | 3c662da2cdd972c9d35360b7c5c86c1c211b4ee7 /bootstrap/darwindiskimage | |
parent | b80c9836566c893b3b0bc0628e3fbea45215a1cb (diff) | |
download | pkgsrc-da790e86287cdb2d174178788768b201991c7f8f.tar.gz |
If creating a disk image on Darwin 7.0 or newer, create a case-sensitive
HFS+ rather than a UFS. The result performs better, among other things.
Diffstat (limited to 'bootstrap/darwindiskimage')
-rwxr-xr-x | bootstrap/darwindiskimage | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/bootstrap/darwindiskimage b/bootstrap/darwindiskimage index 2d052b4ea04..944832db7c4 100755 --- a/bootstrap/darwindiskimage +++ b/bootstrap/darwindiskimage @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: darwindiskimage,v 1.1 2006/08/30 04:29:53 schmonz Exp $ +# $NetBSD: darwindiskimage,v 1.2 2006/08/30 04:36:10 schmonz Exp $ _getdevice_and_halfway_mount() { @@ -19,28 +19,31 @@ _normalize_filename() dmg_create() { - local file mountedname megabytes device + local fstype fs osmajor file mountedname megabytes device [ $# -eq 2 ] || die 1 "Usage: $0 create <file> <megabytes>" + # Use case-sensitive HFS+ where available (Darwin >= 7) + fstype='Apple_UFS' + fs='UFS' + osmajor=`uname -r | awk 'BEGIN {FS="."} {print $1}'` + if [ ${osmajor} -ge 7 ]; then + fstype='Apple_HFSX' + fs='HFSX' + fi + file="`_normalize_filename \"$1\"`" mountedname="`basename \"${file}\" .dmg`" megabytes=$2 # create hdiutil create -quiet "${file}" -megabytes ${megabytes} \ - -partitionType Apple_UFS -layout SPUD - - # format - device=`_getdevice_and_halfway_mount "${file}"` - newfs ${device} - hdiutil eject -quiet "${device}" + -partitionType ${fstype} -layout SPUD -fs ${fs} # rename + device=`_getdevice_and_halfway_mount "${file}"` hdiutil mount "${file}" disktool -n "${device}" "${mountedname}" hdiutil eject -quiet "${device}" - # mountpoint="`hdiutil mount -verbose '${file}' | grep -A 1 '<key>mount-point</key>' | grep -v '<key>mount-point</key>' | sed -e 's|<string>||' -e 's|</string>||' | awk '{print $1}'`" - # mount | grep '^/dev/disk1' | awk '{print $3}' | sed -e 's|^/Volumes/||' } dmg_mount() |