Post

Replies

Boosts

Views

Activity

Reply to Attaching a software license agreement to a signed disk image in Big Sur breaks the disk image file
I was faced with the same problem, and solved it, thanks in a large part to your wonderfully-detailed post. TL;DR: remove the array identified by the key "blkx" from the extracted xml file before using it. Read on for more details... I examined the extracted xml file - which is a plist - and noticed that there are several sections to it, each section identified by a key. If it helps, the XPath to the section key is /plist/dict/key. There are other keys in the structure, but they are all nested deeper in arrays and dictionaries (I am quite ignorant of plists; there is probably a much better way to do this) These are the sections I found, in order: <key>LPic</key> <key>STR#</key> <key>TEXT</key> <key>TMPL</key> <key>blkx</key> <key>styl</key> I noticed that while most of the sections have basically textual data, like button and EULA text, the "blkx" section contains what look like binary data, with names like, "Protective Master Boot Record (MBR : 0)", and "disk image (Apple_HFS : 4)". I figured those were specific to the image, so I removed that whole "blkx" section, including the key. When I used that modified plist as input for hdiutil udifrez -xml ..., the resulting image worked fine: displayed the EULA and opened as expected. Note that based on what I have read elsewhere online, the "TEXT" section may be "RTF" or something else, depending on the format of the EULA. Yours is named with a ".r" extension; I'm not sure what format that would be, but you should be able to find the correct section for it. You should be able to continue using your EULA file, instead of relying on updating the plist every time the EULA changes, instead keeping the plist as a template, and inserting the EULA into it as a build step. The EULA needs to be base64-encoded; I was careful to slavishly copy the format in the extracted plist, so I wrapped mine at 52 characters and indented it with three tabs characters. My template looks like this (truncated for brevity): ... &#9;<key>TEXT</key> &#9;<array> &#9;&#9;<dict> &#9;&#9;&#9;<key>Attributes</key> &#9;&#9;&#9;<string>0x0000</string> &#9;&#9;&#9;<key>Data</key> &#9;&#9;&#9;<data> ${ENGLISH_SLA} &#9;&#9;&#9;</data> &#9;&#9;&#9;<key>ID</key> &#9;&#9;&#9;<string>5000</string> &#9;&#9;&#9;<key>Name</key> &#9;&#9;&#9;<string>English SLA</string> &#9;&#9;</dict> &#9;</array> ... I save it as my-eula.plist.template. Note, again, that you may need to use a section other than "TEXT", depending on the format of your EULA. And I use this process to insert the EULA into it: base64-encode the English-language EULA, breaking at character 52 because that's how it was done in the plist extracted by udifderez And add three tab characters to the beginning of every line, slavishly following the format of the extracted plist ENGLISH_SLA="$(base64 -b 52 my-eula.txt | sed s$'/^\(.*\)$/\t\t\t\\1/')" this is one way of doing token replacement, when the tokens are formatted as shell interpreter variables eval "cat >my-eula.plist <<EOF&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; $(<my-eula.plist.template) EOF " add the eula to the dmg note that udifrez requires an argument after the plist and before any other documented argument. I am using a blank argument, but behavior appears to be the same no matter what value is there hdiutil udifrez -xml my-eula.plist '' -quiet "${appname}-${appversion}.dmg" || { &#9;echo "failed to add the license to the image" 1>&2 &#9;exit 1 }
Dec ’20