Specifying multiple executable arguments using startupitems

Ryan Schmidt ryandesign at macports.org
Sun Jun 14 16:45:24 UTC 2020


Using the startupitem.executable keyword, one can specify multiple arguments.

https://guide.macports.org/#reference.startupitems.executable

The example from the guide is:

startupitem.executable  ${prefix}/sbin/vm-pop3d -d 10 -t 600

This will end up constructing a launchd plist containing:

<key>ProgramArguments</key>
<array>
	<string>/opt/local/bin/daemondo</string>
	<string>--label=myport</string>
	<string>--start-cmd</string>
	<string>/opt/local/sbin/vm-pop3d</string>
	<string>-d</string>
	<string>10</string>
	<string>-t</string>
	<string>600</string>
	<string>;</string>

etc.


I would like to define multiple startup items (each of which will use an executable with multiple arguments) using the startupitems keyword. Its documentation says:

"Used when a port needs to install more than one StartupItem, this option consists of a list where alternating elements represent keys and values."

The example given is:

startupitems        name        myport-system \
                    location    LaunchDaemons \
                    executable  ${prefix}/sbin/myportd \
                    name        myport-session \
                    location    LaunchAgents \
                    executable  ${prefix}/bin/myport-agent

How then can one use this to specify multiple executable arguments?

The obvious answers don't work:

startupitems        name        myport \
                    executable  "${prefix}/sbin/vm-pop3d -d 10 -t 600"

startupitems        name        myport \
                    executable  [list ${prefix}/sbin/vm-pop3d -d 10 -t 600]

Either way, this ends up creating a launchd plist where everything is in a single string:

<key>ProgramArguments</key>
<array>
	<string>/opt/local/bin/daemondo</string>
	<string>--label=myport</string>
	<string>--start-cmd</string>
	<string>/opt/local/sbin/vm-pop3d -d 10 -t 600</string>
	<string>;</string>

etc.

Is this a bug? Or is there a different way to do it?



More information about the macports-dev mailing list