Specifying multiple executable arguments using startupitems
Steven Smith
steve.t.smith at gmail.com
Sun Jun 14 17:04:56 UTC 2020
> I would like to define multiple startup items (each of which will use an executable with multiple arguments) using the startupitems keyword.
Could be a bug. Widespread practice is to code around it and edit the launchd .plist’s in the post-activate block. You can use tcl’s reinplace or sh’s plutil as necessary to edit the .plists.
Example Portfiles that do this extensively:
• https://github.com/macports/macports-ports/blob/master/net/calendar-contacts-server/Portfile
• https://github.com/macports/macports-ports/blob/master/sysutils/clamav-server/Portfile
• https://github.com/macports/macports-ports/blob/master/mail/mail-server/Portfile
> On Jun 14, 2020, at 12:45, Ryan Schmidt <ryandesign at macports.org> wrote:
>
> 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?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20200614/2f86ae80/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3898 bytes
Desc: not available
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20200614/2f86ae80/attachment.bin>
More information about the macports-dev
mailing list