Portfile for a DMG that displays license before mounting

Ryan Schmidt ryandesign at macports.org
Sun Jun 2 15:56:51 UTC 2019

On Jun 1, 2019, at 15:14, Andrew Udvare wrote:

> On 2019-06-01, at 08:59, Ryan Schmidt wrote:
>> Yes, I've done this before. Echoing Y to hdiutil wasn't working for me so I wrote an expect script to do it.
>> Here is the expect script:
>> https://github.com/macports/macports-ports/blob/d8f0e670fe55cb35a5861bc26eba98acb0368ad6/emulators/minivmac/files/attach.exp
>> You may need to modify the strings "Software License" and "Agree Y/N?" depending on the exact wording of your disk image's license.
>> Here are the Tcl procedures to mount a disk image using that expect script and to unmount it:
>> https://github.com/macports/macports-ports/blob/d8f0e670fe55cb35a5861bc26eba98acb0368ad6/emulators/minivmac/Portfile#L354-L368
>> (Change "my_system" to "system" though.)
>> Don't forget to add a dependency on bin:expect:expect for whatever phase you're doing this in (e.g. depends_extract-append).
>> You want to mount the disk image using these procedures instead of MacPorts base code, so set extract.only to a value that excludes the disk image (i.e. list all the other distfiles; if there are no other distfiles, set extract.only to a blank value), then call the procedures in the post-extract block (or whatever phase you want).
> Thanks. I made a Portfile for MakeMKV (binary-only package): https://github.com/Tatsh/ports/blob/master/multimedia/makemkv/Portfile

Looks good. Assuming it works for you and you have no other questions, my suggestions are:

- Add the standard modeline at the top of the Portfile.

- Set supported_archs to the archs for which the binary was built. Looks like it's just x86_64.

- Prevent the port from being installed on OS versions on which it will not work. The web site says it will work on 10.6 and later while the readme says it will work on 10.5 and later; I don't know which is correct.

- Change the license field to indicate the real license. You listed "EULA" which stands for "End-User License Agreement" which is a generic term that does not tell us what specific license it's actually under. If it's not one of the standard open-source licenses for which we have predefined license identifiers, you could use "Permissive" or "Restrictive" depending on the nature of the license.

- Remove "# $Id$" from attach.exp; that's a remnant from back when we used Subversion as our repository, before we converted to Git in 2016.

- Rename the variable $msdcm to something else, such as $mountpoint. You changed it from my variable name $my_system_disk_container_mount, but I chose that variable name because the disk image I was extracting contained System 7 installation disk images.

- You can get rid of the $my_name variable I was using and just use $name.

- Portfiles are written in Tcl, and Tcl is not Bash, so you don't need quotation marks around strings that don't contain spaces. Unlike in Bash, in Tcl it doesn't matter whether the values of the variables contain spaces or not.

More information about the macports-users mailing list