Creating a startupitem for nsd

Ryan Schmidt ryandesign at macports.org
Mon Aug 12 03:02:40 UTC 2019



On Aug 11, 2019, at 09:05, Gerben Wierda wrote:

> I’ve been playing around with MacPorts and I have installed nsd as an authoritative DNS server. (unbound doesn’t handle CNAME, so it is either use BIND or have both nsd and unbound)
> 
> unbound comes with a LaunchDaemon plist, nsd doesn’t. So my first mod looks to be that I will have to change the portfile to include startupitem information.
> 
> As I understand it:
> 	• I need to edit /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/net/nsd/Portfile (with port edit) and add the startup item stuff there directly (copy original to Portfile.orig first of course). Questions: If I do that, will not MacPorts overwrite my modified Portfile in some scenarios?

Yes, it will overwrite your changes when you run `sudo port sync` or `sudo port selfupdate`, assuming you are using the default method of syncing ports, which is to use our rsync server.


> Will port edit create the Portfile.orig?

No.


> 	• And everything I need to do for this change can be done by modifying the Portfile.
> 	• And what I gather from the documentation that I can offer the diff later as an improvement.
> Correct?

Yes. Ideally you would submit your changes as a pull request to our macports-ports repository on GitHub. But if you're not comfortable with git and pull requests you can instead create a ticket in our Trac issue tracker and attach your diff file there.


> It seems to me I just have to add this to the Portfile:
> 
> startupitem.create  yes
> startupitem.name    nsd
> startupitem.start   "${prefix}/sbin/nsd"
> startupitem.stop    "/bin/kill \$(cat ${prefix}/var/run/${name}/nsd.pid)"

That could work; I haven't tested it. You only need to set startupitem.name if you don't want the default value. You only need quotes around strings that contain spaces.




More information about the macports-users mailing list