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

jmr at macports.org jmr at macports.org
Tue Apr 20 10:55:46 PDT 2010


Revision: 66700
          http://trac.macports.org/changeset/66700
Author:   jmr at macports.org
Date:     2010-04-20 10:55:41 -0700 (Tue, 20 Apr 2010)
Log Message:
-----------
avoid touching /Library when not running as 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	2010-04-20 17:30:38 UTC (rev 66699)
+++ trunk/base/src/port1.0/portstartupitem.tcl	2010-04-20 17:55:41 UTC (rev 66700)
@@ -129,7 +129,11 @@
     
     set itemname            ${startupitem.name}
     set uppername           [string toupper ${startupitem.name}]
-    set itemdir             /Library/StartupItems/${itemname}
+    if {[getuid] == 0} {
+        set itemdir         /Library/StartupItems/${itemname}
+    } else {
+        set itemdir         ${prefix}/Library/StartupItems/${itemname}
+    }
     set startupItemDir      ${destroot}${itemdir}
     set startupItemScript   ${startupItemDir}/${itemname}
     set startupItemPlist    ${startupItemDir}/StartupParameters.plist
@@ -585,9 +589,11 @@
     close ${plist}
 
     # Make a symlink to the plist file
-    file mkdir "${destroot}/Library/${daemondest}"
-    ln -sf "${itemdir}/${plistname}" "${destroot}/Library/${daemondest}"
-    
+    if {[getuid] == 0} {
+        file mkdir "${destroot}/Library/${daemondest}"
+        ln -sf "${itemdir}/${plistname}" "${destroot}/Library/${daemondest}"
+    }
+
     # If launchd is not available, warn the user
     set haveLaunchd ${portutil::autoconf::have_launchd}
     if {![tbool haveLaunchd]} {
@@ -595,7 +601,7 @@
         ui_msg "# WARNING:"
         ui_msg "# We're building a launchd startup item, but launchd wasn't"
         ui_msg "# found by configure. Are you sure you didn't mess up your"
-        ui_msg "# ports.conf settings?"
+        ui_msg "# macports.conf settings?"
         ui_msg "###########################################################"
     }
     
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100420/773ec2f2/attachment.html>


More information about the macports-changes mailing list