Creating portfile for program that includes StartupItems

markd at macports.org markd at macports.org
Wed Jan 16 09:00:04 PST 2008


>Date: Wed, 16 Jan 2008 01:36:19 +0000 (UTC)
>From: Brooks Clark <mbrooksclark at mac.com>
>Subject: Creating portfile for program that includes StartupItems
>††††††† script
>To: macports-dev at lists.macosforge.org
>Message-ID: <loom.20080116T012145-937 at post.gmane.org>
>Content-Type: text/plain; charset=us-ascii
>
>I'm trying to put together a portfile for some software that already
>compiles
>and runs on a Mac. I'd like to make the installation a bit easier, though,
>by creating a port, especially since the software already has several
>MacPorts dependencies. The software is actually a set of about six or so
>daemons that should be run at startup time.
>
>The source code ships with a working StartupItems script.
>
>I've gotten the portfile to the point where it downloads the source,
>compiles, and installs the executbles. I'm not having much luck with
>the startup script, however.
>
>Can anyone point me to any examples of portfiles that I could use
>as a go-by for launching multiple daemons at startup? Is it possible
>(preferred?) to just use the StartupItems script that comes with the
>software? Any recommendations or suggestions for how to best install
>the startup items would be much appreciated.

Hi Brooks,

It is fine to use the startupitems script that come with a port if it
works ok on OS X, and if the developer considers the script adequate you
don't need to reinvent the wheel.  On the other hand, if the developer
provided scripts is very simple and merely launches daemon(s) and nothing
more, there is not a lot of reason to use it and by using MacPorts
startupitems to launch the daemon directly (startupitem.executable) where
possible you'll get the monitored daemon that will be restarted if it dies.

If you have a port that uses multiple daemons and a startup script is
provided, it might be the best to use the script provided.  But if the
script merely launches a bunch of daemons then you could provide multiple
startup scripts using MacPorts.  But for more than one startup script per
port, you'll end up creating some .plist files and copying them manually
since only one startupitem per port can be supported automatically.  See
the net/nedi port for how I supported 3 startupitems for a port.  See
net/zabbix for an example of a startupitem that uses a distro provided
startup script.

BTW, one thing not supported is inetdcompatibility for daemons, though
this is not needed frequently.  That requires creating a .plist manually
and copying it during the port install also.

Mark




More information about the macports-dev mailing list