Ticket #11824: patch-portstartupitem.tcl

File patch-portstartupitem.tcl, 2.5 KB (added by markd@…, 17 years ago)
Line 
1--- portstartupitem.tcl.org     2007-11-01 17:31:40.000000000 -0700
2+++ portstartupitem.tcl 2007-11-02 01:14:28.000000000 -0700
3@@ -41,6 +41,14 @@
4 #       This is exclusive of init, start, stop, restart
5 #       - This may be composed of exec arguments only--not shell code
6 #
7+#   startupitem.inetdsockname
8+#       This keywork can only be used with startupitem.executable and sets the inetdCompatibility
9+#       .plist key and specifies the xinetd socket servicename to be placed in /etc/services
10+#
11+#   startupitem.inetdwait
12+#        This optional command can only be used with startupitem.inetsocket; it corresponds
13+#        turns on the "wait" option of services in xinetd
14+#
15 #   startupitem.pidfile     none
16 #       There is no pidfile we can track
17 #
18@@ -386,6 +394,7 @@
19     global startupitem.name startupitem.requires startupitem.init
20     global startupitem.start startupitem.stop startupitem.restart startupitem.executable
21     global startupitem.pidfile startupitem.logfile startupitem.logevents startupitem.netchange
22+    global startupitem.inetdsockname startupitem.inetdwait
23 
24     set scriptdir ${prefix}/etc/startup
25     
26@@ -564,7 +573,13 @@
27     
28     puts ${plist} "<key>ProgramArguments</key>"
29     puts ${plist} "<array>"
30-    foreach arg ${args} { puts ${plist} "\t<string>${arg}</string>" }
31+
32+    if { ![llength ${startupitem.inetdsockname}] } {
33+       foreach arg ${args} { puts ${plist} "\t<string>${arg}</string>" }
34+        } else {
35+            puts ${plist} "<string>${startupitem.executable}</string>"
36+    }
37+
38     puts ${plist} "</array>"
39     
40     puts ${plist} "<key>Debug</key><false/>"
41@@ -576,6 +591,28 @@
42         puts ${plist} "<key>StandardOutPath</key><string>${startupitem.logfile}</string>"
43     }
44     
45+    if { [llength ${startupitem.inetdsockname}] } {
46+
47+    puts ${plist} "<key>inetdCompatibility</key>"
48+    puts ${plist} "\t<dict>"
49+
50+    if { [tbool startupitem.inetdwait] } {
51+            puts ${plist} "\t<key>Wait</key><true/>"
52+        } else {
53+            puts ${plist} "\t<key>Wait</key><false/>"
54+    }
55+
56+    puts ${plist} "\t</dict>"
57+    puts ${plist} "<key>Sockets</key>"
58+    puts ${plist} "\t<dict>"
59+    puts ${plist} "\t<key>Listeners</key>"
60+    puts ${plist} "\t\t<dict>"
61+    puts ${plist} "\t\t<key>SockServiceName</key>"
62+    puts ${plist} "\t\t<string>${startupitem.inetdsockname}</string>"
63+    puts ${plist} "\t\t</dict>"
64+    puts ${plist} "\t</dict>"
65+    }
66+
67     puts ${plist} "</dict>"
68     puts ${plist} "</plist>"
69