<pre style='margin:0'>
Clemens Lang (neverpanic) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/b493d5337a0c0d83998d6672ce60be20427c49d7">https://github.com/macports/macports-base/commit/b493d5337a0c0d83998d6672ce60be20427c49d7</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new b493d533 Add Portfile options: startupitem.user & startupitem.group Ports can now use these to tell launchd which user and group to run the daemon process as.
</span>b493d533 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit b493d5337a0c0d83998d6672ce60be20427c49d7
</span>Author: Herby Gillot <herby.gillot@gmail.com>
AuthorDate: Sun Aug 16 23:23:23 2020 -0400
<span style='display:block; white-space:pre;color:#404040;'> Add Portfile options: startupitem.user & startupitem.group
</span><span style='display:block; white-space:pre;color:#404040;'> Ports can now use these to tell launchd which user and group to run the
</span><span style='display:block; white-space:pre;color:#404040;'> daemon process as.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> See: https://trac.macports.org/ticket/13807
</span>---
src/port1.0/portstartupitem.tcl | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/portstartupitem.tcl b/src/port1.0/portstartupitem.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 44bb4093..b568e50b 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/portstartupitem.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/portstartupitem.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -64,6 +64,12 @@
</span> # startupitem.autostart yes/no
# Automatically load the startupitem after activating. Defaults to no.
#
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# startupitem.user <user>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# User to run the service/daemon as.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# startupitem.group <group>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Group to run the service/daemon as.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span> # startupitem.debug yes/no
# Enable additional debug logging
# - for launchd, sets the Debug key to true
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -76,6 +82,7 @@ namespace eval portstartupitem {
</span>
options startupitems startupitem.autostart startupitem.debug \
startupitem.create startupitem.executable \
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.user startupitem.group \
</span> startupitem.init startupitem.install startupitem.location \
startupitem.logevents startupitem.logfile startupitem.name \
startupitem.netchange startupitem.pidfile startupitem.plist \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -86,6 +93,7 @@ options startupitems startupitem.autostart startupitem.debug \
</span> default startupitem.autostart no
default startupitem.debug no
default startupitem.executable ""
<span style='display:block; white-space:pre;background:#e0ffe0;'>+default startupitem.group ""
</span> default startupitem.init ""
default startupitem.install {$system_options(startupitem_install)}
default startupitem.location LaunchDaemons
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -101,6 +109,7 @@ default startupitem.start ""
</span> default startupitem.stop ""
default startupitem.type {[portstartupitem::get_startupitem_type]}
default startupitem.uniquename {org.macports.${startupitem.name}}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+default startupitem.user ""
</span>
default startupitem.daemondo.verbosity 1
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -132,9 +141,10 @@ proc portstartupitem::get_startupitem_type {} {
</span> # each startupitem that has been defined in the portfile
proc portstartupitem::foreach_startupitem {body} {
global startupitems
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set vars [list autostart debug create executable init install location \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- logevents logfile name netchange pidfile plist requires \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- restart start stop type uniquename daemondo.verbosity]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set vars [list autostart debug create executable group init install \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ location logevents logfile name netchange pidfile plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ requires restart start stop type uniquename user \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ daemondo.verbosity]
</span>
array set startupitems_dict {}
if {[info exists startupitems] && $startupitems ne ""} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -261,6 +271,8 @@ proc portstartupitem::startupitem_create_darwin_launchd {attrs} {
</span> set plistname $si(plist)
set daemondest $si(location)
set itemdir ${prefix}/etc/${daemondest}/${uniquename}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set username $si(user)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set groupname $si(group)
</span> set args [list \
"${prefix}/bin/daemondo" \
"--label=${itemname}" \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -447,6 +459,14 @@ proc portstartupitem::startupitem_create_darwin_launchd {attrs} {
</span> puts ${plist} "<key>OnDemand</key><false/>"
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$username ne ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} "<key>UserName</key><string>$username</string>"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$groupname ne ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} "<key>GroupName</key><string>$groupname</string>"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> if {$si(logfile) ne ""} {
puts ${plist} "<key>StandardOutPath</key><string>$si(logfile)</string>"
}
</pre><pre style='margin:0'>
</pre>