summaryrefslogtreecommitdiff
path: root/bootstrap/darwindiskimage
diff options
context:
space:
mode:
authorschmonz <schmonz@pkgsrc.org>2006-08-30 04:36:10 +0000
committerschmonz <schmonz@pkgsrc.org>2006-08-30 04:36:10 +0000
commit3e66a7cf3d51b20ce37cfb90e51aff8c09842492 (patch)
tree3c662da2cdd972c9d35360b7c5c86c1c211b4ee7 /bootstrap/darwindiskimage
parentad64f51cb95870a4995214a800da44544af4f3ab (diff)
downloadpkgsrc-3e66a7cf3d51b20ce37cfb90e51aff8c09842492.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-xbootstrap/darwindiskimage23
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()