#NEWLINE# def updateAcrobatPro( dmgpath ) : #NEWLINE# #INDENT# 'Uses the scripts and Resources inside the Acrobat Patch application\n    bundle to silently update Acrobat Pro and related apps\n    Why oh why does this use a different mechanism than the other Adobe\n    apps?' #NEWLINE# if munkicommon . munkistatusoutput : #NEWLINE# #INDENT# munkistatus . percent ( ( - 1 ) ) #NEWLINE# #UNINDENT# munkicommon . display_status_minor ( ( 'Mounting disk image %s' % os . path . basename ( dmgpath ) ) ) #NEWLINE# mountpoints = mountAdobeDmg ( dmgpath ) #NEWLINE# if mountpoints : #NEWLINE# #INDENT# installroot = mountpoints [ 0 ] #NEWLINE# pathToAcrobatPatchApp = findAcrobatPatchApp ( installroot ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# munkicommon . display_error ( ( 'No mountable filesystems on %s' % dmgpath ) ) #NEWLINE# return ( - 1 ) #NEWLINE# #UNINDENT# if ( not pathToAcrobatPatchApp ) : #NEWLINE# #INDENT# munkicommon . display_error ( 'No Acrobat Patch app at %s' , pathToAcrobatPatchApp ) #NEWLINE# munkicommon . unmountdmg ( installroot ) #NEWLINE# return ( - 1 ) #NEWLINE# #UNINDENT# resourcesDir = os . path . join ( pathToAcrobatPatchApp , 'Contents' , 'Resources' ) #NEWLINE# ApplyOperation = os . path . join ( resourcesDir , 'ApplyOperation.py' ) #NEWLINE# callingScriptPath = os . path . join ( resourcesDir , 'InstallUpdates.sh' ) #NEWLINE# appList = [ ] #NEWLINE# appListFile = os . path . join ( resourcesDir , 'app_list.txt' ) #NEWLINE# if os . path . exists ( appListFile ) : #NEWLINE# #INDENT# fileobj = open ( appListFile , mode = 'r' , buffering = ( - 1 ) ) #NEWLINE# if fileobj : #NEWLINE# #INDENT# for line in fileobj . readlines ( ) : #NEWLINE# #INDENT# appList . append ( line ) #NEWLINE# #UNINDENT# fileobj . close ( ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not appList ) : #NEWLINE# #INDENT# munkicommon . display_error ( 'Did not find a list of apps to update.' ) #NEWLINE# munkicommon . unmountdmg ( installroot ) #NEWLINE# return ( - 1 ) #NEWLINE# #UNINDENT# payloadNum = ( - 1 ) #NEWLINE# for line in appList : #NEWLINE# #INDENT# payloadNum = ( payloadNum + 1 ) #NEWLINE# if munkicommon . munkistatusoutput : #NEWLINE# #INDENT# munkistatus . percent ( getPercent ( ( line + 1 ) , ( len ( appList ) + 1 ) ) ) #NEWLINE# #UNINDENT# ( appname , status ) = line . split ( '\t' ) #NEWLINE# munkicommon . display_status_minor ( ( 'Searching for %s' % appname ) ) #NEWLINE# pathname = os . path . join ( '/Applications/Adobe Acrobat 9 Pro' , appname ) #NEWLINE# if os . path . exists ( pathname ) : #NEWLINE# #INDENT# item = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# item [ 'path' ] = pathname #NEWLINE# candidates = [ item ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# candidates = [ item for item in munkicommon . getAppData ( ) if item [ 'path' ] . endswith ( ( '/' + appname ) ) ] #NEWLINE# #UNINDENT# if ( len ( candidates ) == 0 ) : #NEWLINE# #INDENT# if ( status == 'optional' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# munkicommon . display_error ( ( 'Cannot patch %s because it was not found on the startup disk.' % appname ) ) #NEWLINE# munkicommon . unmountdmg ( installroot ) #NEWLINE# return ( - 1 ) #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( candidates ) > 1 ) : #NEWLINE# #INDENT# munkicommon . display_error ( ( 'Cannot patch %s because we found more than one copy on the startup disk.' % appname ) ) #NEWLINE# munkicommon . unmountdmg ( installroot ) #NEWLINE# return ( - 1 ) #NEWLINE# #UNINDENT# munkicommon . display_status_minor ( ( 'Updating %s' % appname ) ) #NEWLINE# apppath = os . path . dirname ( candidates [ 0 ] [ 'path' ] ) #NEWLINE# cmd = [ ApplyOperation , apppath , appname , resourcesDir , callingScriptPath , str ( payloadNum ) ] #NEWLINE# proc = subprocess . Popen ( cmd , shell = False , bufsize = ( - 1 ) , stdin = subprocess . PIPE , stdout = subprocess . PIPE , stderr = subprocess . STDOUT ) #NEWLINE# while ( proc . poll ( ) == None ) : #NEWLINE# #INDENT# time . sleep ( 1 ) #NEWLINE# #UNINDENT# retcode = proc . poll ( ) #NEWLINE# if ( retcode != 0 ) : #NEWLINE# #INDENT# munkicommon . display_error ( 'Error patching %s: %s' , appname , retcode ) #NEWLINE# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# munkicommon . display_status_minor ( 'Patching %s complete.' , appname ) #NEWLINE# #UNINDENT# #UNINDENT# munkicommon . display_status_minor ( 'Done.' ) #NEWLINE# if munkicommon . munkistatusoutput : #NEWLINE# #INDENT# munkistatus . percent ( 100 ) #NEWLINE# #UNINDENT# munkicommon . unmountdmg ( installroot ) #NEWLINE# return retcode