[101504] trunk/base/src/port1.0/portextract.tcl
blair at macports.org
blair at macports.org
Fri Jan 11 20:19:14 PST 2013
Revision: 101504
https://trac.macports.org/changeset/101504
Author: blair at macports.org
Date: 2013-01-11 20:19:14 -0800 (Fri, 11 Jan 2013)
Log Message:
-----------
portextract::extract_main: use_dmg fails to mount DMG is user isn't root.
The MacPorts user may not be able to mount a DMG with hdiutil; it will
fail with an "hdiutil: attach failed - Device not configured" error.
So only if a DMG is being used, elevate back to root to do the mount
and unmount the DMG.
Modified Paths:
--------------
trunk/base/src/port1.0/portextract.tcl
Modified: trunk/base/src/port1.0/portextract.tcl
===================================================================
--- trunk/base/src/port1.0/portextract.tcl 2013-01-12 04:00:20 UTC (rev 101503)
+++ trunk/base/src/port1.0/portextract.tcl 2013-01-12 04:19:14 UTC (rev 101504)
@@ -113,7 +113,7 @@
}
proc portextract::extract_main {args} {
- global UI_PREFIX filespath worksrcpath extract.dir usealtworkpath altprefix
+ global UI_PREFIX filespath worksrcpath extract.dir usealtworkpath altprefix use_dmg
if {![exists distfiles] && ![exists extract.only]} {
# nothing to do
@@ -129,7 +129,19 @@
} else {
option extract.args "'[option distpath]/$distfile'"
}
- if {[catch {command_exec extract} result]} {
+
+ # If the MacPorts user does not have the privileges to mount a
+ # DMG then hdiutil will fail with this error:
+ # hdiutil: attach failed - Device not configured
+ # So elevate back to root.
+ if {[tbool use_dmg]} {
+ elevateToRoot {extract dmg}
+ }
+ set code [catch {command_exec extract} result]
+ if {[tbool use_dmg]} {
+ dropPrivileges
+ }
+ if {$code} {
return -code error "$result"
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130111/c191989b/attachment.html>
More information about the macports-changes
mailing list