1

On Mac, I am trying to add software license terms to a disk image file which the user will have to agree to before mounting the disk image. I used to be able to do this using the hdituil's flatten and unflatten verbs along with Rez (similar to how it is done here).

However, Rez and the flatten/unflatten verbs are deprecated, and the hdiutil flatten/unflatten verbs have been removed from macOS 11.0 Big Sur. I am trying to find a way to do this in a different way that works on macOS 11.0 but have been having little luck. I have consulted IgnacioHR's recent answer on this question. I think his solution using an .xml file and hdiutil udifrez sounds promising; however, I cannot get the terminal to accept the command to do this. (It tells me "no image specified".)

hdiutil udifrez -xml mylicensefile.xml mydiskimage.dmg

After modifying my command according to what is said here by including an empty argument before the disk image, the terminal accepts my command but gives me another error: "could not get resource fork of 'mydiskimage.dmg': Function not implemented (78)" and "failed - Function not implemented".

hdiutil udifrez -xml mylicensefile.xml '' mydiskimage.dmg

I believe I am getting this output because the disk image I am trying to perform this on was previously unflattened. To generate the resource fork, previously I would have just flattened the disk image, but that option is now unavailable to me. So, using only what is available to me now on macOS 11.0, how do I "restore" the resource fork to my disk image so that I can use the udifrez verb to add the license terms .xml file to it?

UPDATE: I have discovered that the command works only if I apply it to a disk image that is compressed. If I do that, then the command adds the software license terms to my disk image exactly as I expect. However, the command fails when trying to apply it to a standard, uncompressed read/write disk image. If I recall from before, Rez used to be able to apply license-term resources to uncompressed read/write disk images, which is why I expected it to be able to do so here. This doesn't completely answer my question, although it may mean that the answer to my question is that it is not possible with an uncompressed read/write disk image.

jmohrmann
  • 21
  • 3

1 Answers1

0

I also had problems adding license files to my .dmg under Big Sur and haven't found how to do it properly via terminal so far, above all due to the lack of documentation on the proper structure of the .xml license files.

Finally, I've ended up using DMG Canvas and I can definitely recommend it: it is commercial but not expensive, works well under Big Sur, and except of adding licenses, it also makes it possible to design .dmg's nicely (e.g., adding a background image, extra images and texts), and to code-sign and notarise. Once I have set up everything properly, making a new .dmg after re-building my .app (plus code-signing binaries inside it using a line of code in terminal) only takes one click on 'Build' and waiting a couple of minutes for Apple to notarise.