[60204] trunk/dports/net/dnsmasq/Portfile

snc at macports.org snc at macports.org
Wed Nov 4 18:51:52 PST 2009


Revision: 60204
          http://trac.macports.org/changeset/60204
Author:   snc at macports.org
Date:     2009-11-04 18:51:49 -0800 (Wed, 04 Nov 2009)
Log Message:
-----------
add our own launchd script

Modified Paths:
--------------
    trunk/dports/net/dnsmasq/Portfile

Modified: trunk/dports/net/dnsmasq/Portfile
===================================================================
--- trunk/dports/net/dnsmasq/Portfile	2009-11-05 01:54:05 UTC (rev 60203)
+++ trunk/dports/net/dnsmasq/Portfile	2009-11-05 02:51:49 UTC (rev 60204)
@@ -40,9 +40,86 @@
 
 destroot.args   PREFIX=${prefix}
 
-startupitem.create	yes
-#startupitem.type    launchd
-
 livecheck.type      regex
 livecheck.url       ${master_sites}
 livecheck.regex     LATEST_IS_(\\d\\.\\d+)
+
+set COPTS ""
+variant no_dhcp description { Disable built in DHCP server } {
+    set COPTS "${COPTS} -DNO_DHCP"
+    build.args COPTS="${COPTS}"
+}
+
+variant no_tftp description { Disable built in TFTP server } {
+    set COPTS "${COPTS} -DNO_TFTP"
+    build.args COPTS="${COPTS}"
+}
+
+variant no_ipv6 description { Disable IPV6 support } {
+    set COPTS "${COPTS} -DNO_IPV6"
+    build.args COPTS="${COPTS}"
+}
+
+post-destroot	{
+
+    # Create the directory that dnsmasq likes to store it's pid in.
+    file mkdir ${prefix}/var/run
+
+    #
+    # If on Tiger or above, setup a launchd item.  The daemondo wrapper is not
+    # needed.
+    #
+    if {${os.major} >= 8} {
+        # Create the plist file
+        set itemname        ${startupitem.name}
+        set uniquename      ${startupitem.uniquename}
+        set plistname       ${startupitem.plist}
+        set daemondest      ${startupitem.location}
+        set itemdir         ${prefix}/etc/${daemondest}/${uniquename}
+
+        file mkdir ${destroot}${itemdir}
+        file attributes ${destroot}${itemdir} -owner root -group wheel
+    
+        set plist [open "${destroot}${itemdir}/${plistname}" w 0644]
+        puts ${plist} "<?xml version='1.0' encoding='UTF-8'?>"
+        puts ${plist} "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\""
+        puts ${plist} "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
+        puts ${plist} "<plist version='1.0'>"
+        puts ${plist} "  <dict>"
+        puts ${plist} "    <key>Label</key>"
+        puts ${plist} "    <string>${uniquename}</string>"
+        puts ${plist} "    <key>ProgramArguments</key>"
+        puts ${plist} "    <array>"
+        puts ${plist} "      <string>${prefix}/sbin/dnsmasq</string>"
+        puts ${plist} "      <string>-k</string>"
+        puts ${plist} "      <string>-r</string>"
+        puts ${plist} "      <string>/etc/resolv.conf</string>"
+        puts ${plist} "    </array>"
+        puts ${plist} "    <key>KeepAlive</key>"
+        puts ${plist} "    <dict>"
+        puts ${plist} "      <key>NetworkState</key>"
+        puts ${plist} "      <true/>"
+        puts ${plist} "    </dict>"
+        puts ${plist} "  </dict>"
+        puts ${plist} "</plist>"
+        close ${plist}
+
+        # Make a symlink to the plist file
+        file mkdir "${destroot}/Library/${daemondest}"
+        ln -sf "${itemdir}/${plistname}" "${destroot}/Library/${daemondest}"
+    
+        # Emit some information for the user
+        ui_msg ""
+        ui_msg "=============================================================================="
+        ui_msg "  A startup item has been generated that will aid in"
+        ui_msg "  starting ${name} with launchd. It is disabled"
+        ui_msg "  by default. Execute the following command to start it,"
+        ui_msg "  and to cause it to launch at startup:"
+        ui_msg ""
+        ui_msg "    sudo launchctl load -w /Library/${daemondest}/${plistname}"
+        ui_msg ""
+        ui_msg "=============================================================================="
+        ui_msg ""
+    }
+
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20091104/805caa62/attachment-0001.html>


More information about the macports-changes mailing list