Navigation Menu

Skip to content

Commit

Permalink
portextract::extract_main: use_dmg fails to mount DMG is user isn't r…
Browse files Browse the repository at this point in the history
…oot.

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.

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@101504 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
blair committed Jan 12, 2013
1 parent 067135e commit 520338b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/port1.0/portextract.tcl
Expand Up @@ -113,7 +113,7 @@ proc portextract::extract_start {args} {
}

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
Expand All @@ -129,7 +129,19 @@ proc portextract::extract_main {args} {
} 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"
}

Expand Down

0 comments on commit 520338b

Please sign in to comment.