Categories: Top ::
About
Codejunkie
Monologues of a mobile retro coder.
skeezix[at]codejedi.com
www.codejedi.com
Subscribe
Subscribe to a syndicated RSS feed. I've
also made a Livejournal version and Ben whipped up an auto-RSS Livejournal
Blogs
DadHacker; epic rants.
ASCII@textfiles
Michael Mace
JoelOnSoftware
Bruce Schneier
Wil Wheaton
I, Cringely
WritingOnYourPalm
Dan Gillmor
GrandTextAuto
Freedom to Tinker
Mark's SysInternals Blog
A List Apart
Tam's Palm
Bytecellar retro goodness
Lost Garden
Bill Ing
Ben Combee
PocketGoddess
PocketFactory
Random Links
PalmInfoCenter
Zodiac Gamer
GP32x
Little Green Desktop
Atari Age
Penny Arcade
Hack-a-Day
Retro Remakes
SHMUPS!
Podcasts
1SRC
RetroGamingRadio
Recent Entries
| January 2009 | ||||||
|---|---|---|---|---|---|---|
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
| 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 | 26 | 27 | 28 | 29 | 30 | 31 |
Archives
On my development Mac (a G4 tower from a few years ago - when the G5's were announced, the prices on G4's dropped by 1/3rd overnight - how could I refuse?) I run Mac OSX 10.2. I've often considered upgrading to 10.3 or 10.4, but in the end I do almost all of my work through my laptop (as a gateway to my other two development boxes) so don't really need the update. Further, as a developer, I find it wise to hang back on versions so that your dev environment shares more with the average user than the bleeding edge user. Anyway, people tell me that 10.4 is a bad update and to stick with 10.3, so I might as well stick with 10.2 right?
Of course, Shadow Plan development marches ever on and I release Shadow Plan updates as .dmg files to make installation of the desktop components a breeze - just drag and drop or even run-from-disk-image. Creating .dmg files from the command line is a little screwy though, so I thought I'd note it down here in case anyone needs to know. Read on, spiderfriends.
The way I've done it there are three main stages:
Creating an empty read-write disk image
The steps aren't many, but took me awhile to figure out the options back months ago -- when you've no idea what values to plug in, trial and error gets tedious fast :)
The 'hdiutil' tool can be used to create and modify disk images and such. See below where I use it to create an empty 15MB disk image with no layout. -zeroImage is commented out and not-needed. Later I define a variable DISK to hold the disk identifier as spitout by 'hdid' tool and run 'newfs' (new filesystem, an old Unix favourite) to lay down a HFS format onto the disk. Surprisingly, the next thing to do is eject the disk (since we've screwed with it, the OS will be confused) and then try mounting it again so that we can (at last) drag stuff into it. The newfs step requires root due to permissions, and so you'll have to enter a password in. The whole thing is wrapped up here:
#!/bin/sh # make a disk image hdiutil create -megabytes 15 blank.dmg -layout NONE # -zeroImage # mount it without system notify DISK=`hdid -nomount blank.dmg`; #echo $DISK # format and name it sudo newfs_hfs -v "My Blank Disk of Evil" $DISK # eject it hdiutil eject $DISK # mount it (with notify to finder) hdid blank.dmg
Copy the goodies..
At this point, proceed to copy all that you like into the disk image. When you're done moving things around, unmount the disk image by dragging the virtual disk over the Eject option (where Trash usually is) in the dock bar.
Prepare for distribution..
The last step is to change the disk image into something we wish to distribute -- in my case its read only, and uncompressed since OSX 10.0 can't handle compressed disk images. You can also prepare it as compressed using GZIP, since 10.1 and later can work with this format and it greatly reduces file sizes.
Again, I've wrapped it all up in a shell script to make remembering it easier. Note that I include two commands, but only one is used.. one reformats with compression and the other does not. (# is the comment character in unix shell scripts.)
#!/bin/sh # convert to read only - no compression since 10.0 can't deal hdiutil convert -format UDCO blank.dmg -o DownloadableImage.dmg # convert to read only - compress for 10.1+ # hdiutil convert -format UDZO blank.dmg -o DownloadableImage.dmg -noext
There you go. Happy hunting.
[ Category: / technology / apple ] [link] [Comments]>