[75143] trunk/base/src/port1.0/portstartupitem.tcl

jmr at macports.org jmr at macports.org
Sat Jan 15 21:51:09 PST 2011


Revision: 75143
          http://trac.macports.org/changeset/75143
Author:   jmr at macports.org
Date:     2011-01-15 21:51:02 -0800 (Sat, 15 Jan 2011)
Log Message:
-----------
only try to chown startupitems to root if we are root

Modified Paths:
--------------
    trunk/base/src/port1.0/portstartupitem.tcl

Modified: trunk/base/src/port1.0/portstartupitem.tcl
===================================================================
--- trunk/base/src/port1.0/portstartupitem.tcl	2011-01-16 04:39:24 UTC (rev 75142)
+++ trunk/base/src/port1.0/portstartupitem.tcl	2011-01-16 05:51:02 UTC (rev 75143)
@@ -197,12 +197,16 @@
     ########################
     # Create the startup item directory
     file mkdir ${startupItemDir}
-    file attributes ${startupItemDir} -owner root -group wheel
+    if {[getuid] == 0} {
+        file attributes ${startupItemDir} -owner root -group wheel
+    }
     
     ########################
     # Generate the startup item script
     set item [open "${startupItemScript}" w 0755]
-    file attributes "${startupItemScript}" -owner root -group wheel
+    if {[getuid] == 0} {
+        file attributes "${startupItemScript}" -owner root -group wheel
+    }
     
     # Emit the header
     puts ${item} {#!/bin/sh
@@ -366,7 +370,9 @@
     ########################
     # Generate the plist
     set para [open "${startupItemPlist}" w 0644]
-    file attributes "${startupItemPlist}" -owner root -group wheel
+    if {[getuid] == 0} {
+        file attributes "${startupItemPlist}" -owner root -group wheel
+    }
     
     puts ${para} "\{"
     puts ${para} "\tDescription\t= \"${itemname}\";"
@@ -408,7 +414,9 @@
                         ]
     
     file mkdir ${destroot}${itemdir}
-    file attributes ${destroot}${itemdir} -owner root -group wheel
+    if {[getuid] == 0} {
+        file attributes ${destroot}${itemdir} -owner root -group wheel
+    }
         
     if { [llength ${startupitem.executable}] && 
       ![llength ${startupitem.init}] &&
@@ -445,7 +453,9 @@
 
         # Create the wrapper script
         set item [open "${destroot}${wrapper}" w 0755]
-        file attributes "${destroot}${wrapper}" -owner root -group wheel
+        if {[getuid] == 0} {
+            file attributes "${destroot}${wrapper}" -owner root -group wheel
+        }
 
         puts ${item} "#!/bin/sh"
         puts ${item} "#"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110115/ac7dcbd9/attachment-0001.html>


More information about the macports-changes mailing list