Changeset 101504 for trunk/base


Ignore:
Timestamp:
Jan 12, 2013, 4:19:14 AM (11 years ago)
Author:
blair@…
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portextract.tcl

    r101503 r101504  
    114114
    115115proc portextract::extract_main {args} {
    116     global UI_PREFIX filespath worksrcpath extract.dir usealtworkpath altprefix
     116    global UI_PREFIX filespath worksrcpath extract.dir usealtworkpath altprefix use_dmg
    117117
    118118    if {![exists distfiles] && ![exists extract.only]} {
     
    130130            option extract.args "'[option distpath]/$distfile'"
    131131        }
    132         if {[catch {command_exec extract} result]} {
     132
     133        # If the MacPorts user does not have the privileges to mount a
     134        # DMG then hdiutil will fail with this error:
     135        #   hdiutil: attach failed - Device not configured
     136        # So elevate back to root.
     137        if {[tbool use_dmg]} {
     138            elevateToRoot {extract dmg}
     139        }
     140        set code [catch {command_exec extract} result]
     141        if {[tbool use_dmg]} {
     142            dropPrivileges
     143        }
     144        if {$code} {
    133145            return -code error "$result"
    134146        }
Note: See TracChangeset for help on using the changeset viewer.