[64718] trunk/base/src/port1.0

jmr at macports.org jmr at macports.org
Mon Mar 15 05:07:18 PDT 2010


Revision: 64718
          http://trac.macports.org/changeset/64718
Author:   jmr at macports.org
Date:     2010-03-15 05:07:18 -0700 (Mon, 15 Mar 2010)
Log Message:
-----------
use the privileges workaround install uses in activate, deactivate and uninstall

Modified Paths:
--------------
    trunk/base/src/port1.0/portactivate.tcl
    trunk/base/src/port1.0/portdeactivate.tcl
    trunk/base/src/port1.0/portuninstall.tcl

Modified: trunk/base/src/port1.0/portactivate.tcl
===================================================================
--- trunk/base/src/port1.0/portactivate.tcl	2010-03-15 11:54:16 UTC (rev 64717)
+++ trunk/base/src/port1.0/portactivate.tcl	2010-03-15 12:07:18 UTC (rev 64718)
@@ -45,13 +45,22 @@
 } else {
     target_requires ${org.macports.activate} main fetch extract checksum patch configure build destroot install
 }
+target_prerun ${org.macports.activate} portactivate::activate_start
 
 namespace eval portactivate {
 }
 
 options activate.asroot
-default activate.asroot yes
+default activate.asroot no
 
+proc portactivate::activate_start {args} {
+    global prefix
+    if { ![file writable $prefix] } {
+        # if install location is not writable, need root privileges
+        elevateToRoot "activate"
+    }
+}
+
 proc portactivate::activate_main {args} {
     global env name version revision portvariants user_options portnotes
     registry_activate $name "${version}_${revision}${portvariants}" [array get user_options]

Modified: trunk/base/src/port1.0/portdeactivate.tcl
===================================================================
--- trunk/base/src/port1.0/portdeactivate.tcl	2010-03-15 11:54:16 UTC (rev 64717)
+++ trunk/base/src/port1.0/portdeactivate.tcl	2010-03-15 12:07:18 UTC (rev 64718)
@@ -40,13 +40,22 @@
 target_state ${org.macports.deactivate} no
 target_provides ${org.macports.deactivate} deactivate
 target_requires ${org.macports.deactivate} main
+target_prerun ${org.macports.deactivate} portdeactivate::deactivate_start
 
 namespace eval portdeactivate {
 }
 
 options deactivate.asroot
-default deactivate.asroot yes
+default deactivate.asroot no
 
+proc portdeactivate::deactivate_start {args} {
+    global prefix
+    if { ![file writable $prefix] } {
+        # if install location is not writable, need root privileges
+        elevateToRoot "deactivate"
+    }
+}
+
 proc portdeactivate::deactivate_main {args} {
     global name version revision portvariants user_options
     registry_deactivate $name "${version}_${revision}${portvariants}" [array get user_options]

Modified: trunk/base/src/port1.0/portuninstall.tcl
===================================================================
--- trunk/base/src/port1.0/portuninstall.tcl	2010-03-15 11:54:16 UTC (rev 64717)
+++ trunk/base/src/port1.0/portuninstall.tcl	2010-03-15 12:07:18 UTC (rev 64718)
@@ -40,13 +40,22 @@
 target_state ${org.macports.uninstall} no
 target_provides ${org.macports.uninstall} uninstall
 target_requires ${org.macports.uninstall} main
+target_prerun ${org.macports.uninstall} portuninstall::uninstall_start
 
 namespace eval portuninstall {
 }
 
 options uninstall.asroot
-default uninstall.asroot yes
+default uninstall.asroot no
 
+proc portuninstall::uninstall_start {args} {
+    global prefix
+    if { ![file writable $prefix] } {
+        # if install location is not writable, need root privileges
+        elevateToRoot "uninstall"
+    }
+}
+
 proc portuninstall::uninstall_main {args} {
     global name version revision portvariants user_options
     registry_uninstall $name "${version}_${revision}${portvariants}" [array get user_options]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100315/87d5f187/attachment.html>


More information about the macports-changes mailing list