I was looking today at options for finishing a build with something other than an MSI or folder full of files: An ISO file.
I am a fan of DaemonTools and associated add-ons. Even if you're not planning to burn to disc, an ISO file can be a useful way of getting a bunch of files around the place.
First step was to grab a Windows binary of mkisofs from one of the various sources of cdrtools on the web. NB: It comes linked with Cygwin binaries.
This is a util that has its roots in the Linux/Unix world, so be prepared to scratch your head a bit if you are not familiar with the world of Linux/Unix command line tools. Also if you are, don't be fooled by mkisofs following the naming convention of the other mk*fs tools. It is really quite different.
In the *nix world, the online help is by the man ("manual") page system. Basically, at your prompt you type man mkisofs for help with mkisofs. This works in Google too! The man page will be a useful reference, as will the less informative usage info you can get from mkisofs.exe -help
Having said all that, the following options are a really good place to start:
| Option |
Note |
| -J |
Enable Joilet (you want this) |
| -R |
Enable Rock Ridge (you want this) |
| -V diskname |
Set a volume label |
| -o filename.iso |
Set the output ISO file name |
| -graft-points |
allows "=" syntax in pathspec. More on this below... |
| -m "*.tmp" |
Exclude files from the image by pattern |
mkisofs takes paths to add to the ISO file as parameters, and by default all these are stacked under the root of the disk image. If this is not what you want then you should enable graft points. This option will allow you to make folders in your ISO image for each of the folders you are adding to the disk.
For example, the following pathspec will create two folders on the CD, one called Windows for the contents of the bin folder, and one called Documentation for the contents of the doco folder:
Windows=D:\build\windows\bin\ Documentation=D:\build\doco\
So the complete command line for mkisofs will be something like:
"C:\Program Files\cdrtools-latest\mkisofs.exe" -J -R -graft-points -quiet -o f:\backup.iso -V backup -m "*.tmp" Windows=D:\build\windows\bin\ Documentation=D:\build\doco\
For extra points, you can automatically burn the ISO to a disk using the cdburn / dvdburn tool that ships with the Windows Server 2003 Resource Kit Tools.
A couple of reasons I'll suggest using this over using cdrecord.exe that comes with the cdrtools package:
- The cygwin-based tools don't work as well with later Win32 like Windows Server 2003, they seem to not deal with the tighter security well.
- The syntax of cdburn/dvdburn is much much easier!
An example of the syntax to burn f:\backup.iso to the blank disc in the burner g:\ is:
C:\Program Files\Windows Resource Kits\Tools>cdburn.exe g: f:\backup.iso -speed max
Also note that the cdburn will eject the disk once it has been burnt! Keep that in mind if your CD drive is normally behind a door or cage or something!
UPDATE: This technique is also has some utility for backup-to-disk scenarios. For example a backup batch file that made an ISO then burnt it to disk.
Listening to: Bend to Squares by Death Cab for Cutie