| 46 | |
| 47 | set COPTS "" |
| 48 | variant no_dhcp description { Disable built in DHCP server } { |
| 49 | set COPTS "${COPTS} -DNO_DHCP" |
| 50 | build.args COPTS="${COPTS}" |
| 51 | } |
| 52 | |
| 53 | variant no_tftp description { Disable built in TFTP server } { |
| 54 | set COPTS "${COPTS} -DNO_TFTP" |
| 55 | build.args COPTS="${COPTS}" |
| 56 | } |
| 57 | |
| 58 | variant no_ipv6 description { Disable IPV6 support } { |
| 59 | set COPTS "${COPTS} -DNO_IPV6" |
| 60 | build.args COPTS="${COPTS}" |
| 61 | } |
| 62 | |
| 63 | post-destroot { |
| 64 | |
| 65 | # Create the directory that dnsmasq likes to store it's pid in. |
| 66 | file mkdir ${prefix}/var/run |
| 67 | |
| 68 | # |
| 69 | # If on Tiger or above, setup a launchd item. The daemondo wrapper is not |
| 70 | # needed. |
| 71 | # |
| 72 | if {${os.major} >= 8} { |
| 73 | # Create the plist file |
| 74 | set itemname ${startupitem.name} |
| 75 | set uniquename ${startupitem.uniquename} |
| 76 | set plistname ${startupitem.plist} |
| 77 | set daemondest ${startupitem.location} |
| 78 | set itemdir ${prefix}/etc/${daemondest}/${uniquename} |
| 79 | |
| 80 | file mkdir ${destroot}${itemdir} |
| 81 | file attributes ${destroot}${itemdir} -owner root -group wheel |
| 82 | |
| 83 | set plist [open "${destroot}${itemdir}/${plistname}" w 0644] |
| 84 | puts ${plist} "<?xml version='1.0' encoding='UTF-8'?>" |
| 85 | puts ${plist} "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"" |
| 86 | puts ${plist} "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" |
| 87 | puts ${plist} "<plist version='1.0'>" |
| 88 | puts ${plist} " <dict>" |
| 89 | puts ${plist} " <key>Label</key>" |
| 90 | puts ${plist} " <string>${uniquename}</string>" |
| 91 | puts ${plist} " <key>ProgramArguments</key>" |
| 92 | puts ${plist} " <array>" |
| 93 | puts ${plist} " <string>${prefix}/sbin/dnsmasq</string>" |
| 94 | puts ${plist} " <string>-d</string>" |
| 95 | puts ${plist} " <string>-8</string>" |
| 96 | puts ${plist} " <string>/dev/null</string>" |
| 97 | puts ${plist} " </array>" |
| 98 | puts ${plist} " <key>RunAtLoad</key>" |
| 99 | puts ${plist} " <true/>" |
| 100 | puts ${plist} " <key>KeepAlive</key>" |
| 101 | puts ${plist} " <false/>" |
| 102 | puts ${plist} " </dict>" |
| 103 | puts ${plist} "</plist>" |
| 104 | close ${plist} |
| 105 | |
| 106 | # Make a symlink to the plist file |
| 107 | file mkdir "${destroot}/Library/${daemondest}" |
| 108 | ln -sf "${itemdir}/${plistname}" "${destroot}/Library/${daemondest}" |
| 109 | |
| 110 | # Emit some information for the user |
| 111 | ui_msg "" |
| 112 | ui_msg "==============================================================================" |
| 113 | ui_msg " A startup item has been generated that will aid in" |
| 114 | ui_msg " starting ${name} with launchd. It is disabled" |
| 115 | ui_msg " by default. Execute the following command to start it," |
| 116 | ui_msg " and to cause it to launch at startup:" |
| 117 | ui_msg "" |
| 118 | ui_msg " sudo launchctl load -w /Library/${daemondest}/${plistname}" |
| 119 | ui_msg "" |
| 120 | ui_msg "==============================================================================" |
| 121 | ui_msg "" |
| 122 | } |
| 123 | |
| 124 | } |