mirror of
https://github.com/munki/munki.git
synced 2026-01-07 06:59:57 -06:00
More Adobe CS5 support.
git-svn-id: http://munki.googlecode.com/svn/trunk@552 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
@@ -243,12 +243,12 @@ def main():
|
||||
|
||||
-If the installer item is a disk image containing
|
||||
multiple packages, or the package to be installed
|
||||
is not at the root of the mounted disk image, this
|
||||
is not at the root of the mounted disk image, PKGNAME
|
||||
is a relative path from the root of the mounted
|
||||
disk image to the specific package to be installed.
|
||||
|
||||
-If the installer item is a disk image containing
|
||||
an Adobe CS4 Deployment Toolkit installation, pkgname
|
||||
an Adobe CS4 Deployment Toolkit installation, PKGNAME
|
||||
is the name of an Adobe CS4 Deployment Toolkit
|
||||
installer package folder at the top level of the
|
||||
mounted dmg.
|
||||
@@ -257,24 +257,47 @@ def main():
|
||||
be at the top level of the mounted dmg.''')
|
||||
p.add_option('--appname', '-a',
|
||||
help='''Optional flag.
|
||||
|
||||
|
||||
-If the installer item is a disk image with a
|
||||
drag-and-drop application, this is the name or relative
|
||||
path of the application to be installed. Useful if there
|
||||
is more than one application at the root of the dmg.''')
|
||||
drag-and-drop application, APPNAME is the name or
|
||||
relative path of the application to be installed.
|
||||
Useful if there is more than one application at the
|
||||
root of the dmg.''')
|
||||
p.add_option('--uninstallerdmg', '-u',
|
||||
help='''If installer item is a DMG containing an Adobe CS4
|
||||
Deployment Toolkit installation package or Adobe CS3
|
||||
deployment package, uninstallerdmg is a path to a disk
|
||||
image containing an AdobeUberUninstaller for this
|
||||
item.''')
|
||||
help='''Optional flag.
|
||||
|
||||
If the installer item is a disk image containing an
|
||||
Adobe CS4 Deployment Toolkit installation package or
|
||||
Adobe CS3 deployment package, UNINSTALLERDMG is a path
|
||||
to a disk image containing an AdobeUberUninstaller for
|
||||
this item.''')
|
||||
p.add_option('--installxml',
|
||||
help='''Optional flag.
|
||||
|
||||
If the installer item is a disk image containing an
|
||||
Adobe CS5 product, INSTALLXML specifies the path to
|
||||
an install.xml file containing installation data.''')
|
||||
p.add_option('--uninstallxml',
|
||||
help='''Optional flag.
|
||||
|
||||
If the installer item is a disk image containing an
|
||||
Adobe CS5 product, UNINSTALLXML specifies the path to
|
||||
an uninstall.xml containing uninstall data.''')
|
||||
p.add_option('--serialnumber',
|
||||
help='''Optional flag.
|
||||
|
||||
If the installer item is a disk image containing an
|
||||
Adobe CS5 product, SERIALNUMBER is the product
|
||||
serial number.''')
|
||||
|
||||
options, arguments = p.parse_args()
|
||||
|
||||
if len(arguments) == 0 and not options.file:
|
||||
if len(arguments) == 0 and \
|
||||
not (options.file or options.installxml or options.uninstallxml
|
||||
or options.serialnumber):
|
||||
print >>sys.stderr, \
|
||||
("Need to specify an installer item (.pkg, .mpkg, .dmg) "
|
||||
"and/or --file options!")
|
||||
"and/or --file and/or Adobe installer options!")
|
||||
exit(-1)
|
||||
|
||||
if len(arguments) > 1:
|
||||
@@ -312,7 +335,7 @@ def main():
|
||||
print >>sys.stderr, \
|
||||
"Could not find a supported installer item in %s!" % \
|
||||
item
|
||||
exit(-1)
|
||||
exit(-1)
|
||||
|
||||
elif item.endswith('.pkg') or item.endswith('.mpkg'):
|
||||
catinfo = munkicommon.getPackageMetaData(item)
|
||||
@@ -341,7 +364,7 @@ def main():
|
||||
#just the filename
|
||||
location = os.path.split(item)[1]
|
||||
catinfo['installer_item_location'] = location
|
||||
|
||||
|
||||
# ADOBE STUFF - though maybe generalizable in the future?
|
||||
if options.uninstallerdmg:
|
||||
uninstallerpath = options.uninstallerdmg
|
||||
@@ -402,7 +425,7 @@ def main():
|
||||
installs.append(iteminfodict)
|
||||
else:
|
||||
print >>sys.stderr, "Item %s doesn't exist. Skipping." % fitem
|
||||
|
||||
|
||||
if catinfo:
|
||||
catinfo['autoremove'] = False
|
||||
if minosversion:
|
||||
@@ -417,7 +440,22 @@ def main():
|
||||
|
||||
if installs:
|
||||
catinfo['installs'] = installs
|
||||
|
||||
|
||||
if options.installxml or options.uninstallxml or \
|
||||
options.serialnumber:
|
||||
more_info = adobeutils.getAdobeInstallInfo(
|
||||
mountpoint=None,
|
||||
installxmlpath=options.installxml,
|
||||
uninstallxmlpath=options.uninstallxml,
|
||||
serialnumber=options.serialnumber,
|
||||
suppressRegistration=True,
|
||||
suppressUpdates=True)
|
||||
|
||||
if not 'adobe_install_info' in catinfo:
|
||||
catinfo['adobe_install_info'] = {}
|
||||
for key in more_info.keys():
|
||||
catinfo['adobe_install_info'][key] = more_info[key]
|
||||
|
||||
# and now, what we've all been waiting for...
|
||||
print FoundationPlist.writePlistToString(catinfo)
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
"""
|
||||
adobeutils.py
|
||||
|
||||
Utilities to enable munki to install/uninstall Adobe CS3/CS4 products using the CS3/CS4 Deployment Toolkits.
|
||||
Utilities to enable munki to install/uninstall Adobe CS3/CS4/CS5 products using the CS3/CS4/CS5 Deployment Toolkits.
|
||||
|
||||
"""
|
||||
# Copyright 2009 Greg Neagle.
|
||||
# Copyright 2009-2010 Greg Neagle.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,8 @@ import os
|
||||
import subprocess
|
||||
import time
|
||||
from xml.dom import minidom
|
||||
import base64
|
||||
import random
|
||||
|
||||
import FoundationPlist
|
||||
import munkicommon
|
||||
@@ -56,6 +58,36 @@ def mountAdobeDmg(dmgpath):
|
||||
return mountpoints
|
||||
|
||||
|
||||
def getCS5mediaSignature(dirpath):
|
||||
'''Returns the CS5 media path for a CS5 install.
|
||||
dirpath is typically the root of a mounted dmg'''
|
||||
installapp = findInstallApp(dirpath)
|
||||
if not installapp:
|
||||
return ""
|
||||
# installapp is the path to the actual executable:
|
||||
# IE Install.app/Contents/MacOS/Install. We need the
|
||||
# parent directory of the Install app bundle.
|
||||
parentdir = os.path.dirname(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(installapp))))
|
||||
# now look for setup.xml
|
||||
setupxml = os.path.join(parentdir, "payloads", "Setup.xml")
|
||||
if os.path.exists(setupxml) and os.path.isfile(setupxml):
|
||||
# parse the XML
|
||||
dom = minidom.parse(setupxml)
|
||||
setupElements = dom.getElementsByTagName("Setup")
|
||||
if setupElements:
|
||||
mediaSignatureElements = \
|
||||
setupElements[0].getElementsByTagName("mediaSignature")
|
||||
if mediaSignatureElements:
|
||||
element = mediaSignatureElements[0]
|
||||
elementvalue = ''
|
||||
for node in element.childNodes:
|
||||
elementvalue += node.nodeValue
|
||||
return elementvalue
|
||||
|
||||
return ""
|
||||
|
||||
|
||||
def getPayloadInfo(dirpath):
|
||||
payloadinfo = {}
|
||||
# look for .proxy.xml file dir
|
||||
@@ -288,7 +320,6 @@ def runAdobeInstallTool(cmd, number_of_payloads=0):
|
||||
# indeterminate progress bar
|
||||
munkistatus.percent(-1)
|
||||
payload_completed_count = 0
|
||||
print cmd
|
||||
p = subprocess.Popen(cmd, shell=False, bufsize=1, stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
while (p.poll() == None):
|
||||
@@ -308,16 +339,16 @@ def runAdobeInstallTool(cmd, number_of_payloads=0):
|
||||
payloadname)
|
||||
|
||||
# CS5 installing
|
||||
if loginfo.startswith("Beginning installation for payload at"):
|
||||
if loginfo.startswith("Request to install payload"):
|
||||
# increment payload_completed_count
|
||||
payload_completed_count = payload_completed_count + 1
|
||||
if munkicommon.munkistatusoutput and number_of_payloads:
|
||||
munkistatus.percent(getPercent(payload_completed_count,
|
||||
number_of_payloads))
|
||||
munkicommon.display_status("Installed Adobe payload %s" %
|
||||
munkicommon.display_status("Installing Adobe payload %s" %
|
||||
payload_completed_count)
|
||||
|
||||
# uninstalling
|
||||
# CS3/CS4 uninstalling
|
||||
if loginfo.startswith("Physical payload uninstall result"):
|
||||
# increment payload_completed_count
|
||||
payload_completed_count = payload_completed_count + 1
|
||||
@@ -407,7 +438,69 @@ def runAdobeSetup(dmgpath, uninstalling=False):
|
||||
return -1
|
||||
|
||||
|
||||
def runAdobeCS5Install(dmgpath, uninstalling=False):
|
||||
def writefile(s, path):
|
||||
# writes string data to path.
|
||||
# returns the path on success, empty string on failure
|
||||
try:
|
||||
f = open(path, mode='w', buffering=1)
|
||||
print >>f, s.encode('UTF-8')
|
||||
f.close()
|
||||
return path
|
||||
except (OSError, IOError):
|
||||
munkicommon.display_error("Couldn't write %s" % s)
|
||||
return ""
|
||||
|
||||
|
||||
def doAdobeCS5Uninstall(adobeInstallInfo):
|
||||
# runs the locally-installed Adobe CS5 tools to remove CS5 products
|
||||
uninstallxml = adobeInstallInfo.get('uninstallxml')
|
||||
if not uninstallxml:
|
||||
munkicommon.display_error("No uninstall.xml in adobe_install_info")
|
||||
return -1
|
||||
payloadcount = adobeInstallInfo.get('payload_count',0)
|
||||
path = os.path.join(munkicommon.tmpdir, "uninstall.xml")
|
||||
deploymentFile = writefile(uninstallxml, path)
|
||||
if not deploymentFile:
|
||||
return -1
|
||||
setupapp = "/Library/Application Support/Adobe/OOBE/PDApp/DWA/Setup.app"
|
||||
setup = os.path.join(setupapp, "Contents/MacOS/Setup")
|
||||
if not os.path.exists(setup):
|
||||
munkicommon.display_error("%s is not installed." % setupapp)
|
||||
return -1
|
||||
uninstall_cmd = [ setup,
|
||||
'--mode=silent',
|
||||
'--action=uninstall',
|
||||
'--skipProcessCheck=1',
|
||||
'--deploymentFile=%s' % deploymentFile ]
|
||||
munkicommon.display_status("Running Adobe Uninstall")
|
||||
return runAdobeInstallTool(uninstall_cmd, payloadcount)
|
||||
|
||||
|
||||
def CS5applicationXMLoverride(adobeInstallInfo):
|
||||
'''Returns an XML string for use with CS5 installer'''
|
||||
xml = '<?xml version="1.0" encoding="utf-8"?>\n'
|
||||
xml += '<Configuration>\n'
|
||||
xml += ' <Payload adobeCode="%s">\n' % \
|
||||
adobeInstallInfo.get('media_signature',"")
|
||||
if 'media_digest' in adobeInstallInfo:
|
||||
# undo our obfuscation
|
||||
s = base64.b64decode(adobeInstallInfo['media_digest'])
|
||||
xml += ' <Data key="Serial" protected="0">%s</Data>\n' % s
|
||||
if adobeInstallInfo.get('suppress_registration'):
|
||||
xml += ' <Data key="Registration">Suppress</Data>\n'
|
||||
if adobeInstallInfo.get('suppress_updates'):
|
||||
xml += ' <Data key="Updates">Suppress</Data>\n'
|
||||
xml += ' <Data key="EULADelay">-1</Data>\n'
|
||||
xml += ' </Payload>\n'
|
||||
xml += '</Configuration>'
|
||||
return xml
|
||||
|
||||
|
||||
def runAdobeCS5Install(dmgpath, adobeInstallInfo, uninstalling=False):
|
||||
# if we have enough info, uninstall from local resources
|
||||
if uninstalling and adobeInstallInfo.get('uninstallxml'):
|
||||
return doAdobeCS5Uninstall(adobeInstallInfo)
|
||||
|
||||
# runs the Adobe CS5 Install tool in silent mode from
|
||||
# a DMG
|
||||
munkicommon.display_status("Mounting disk image %s" %
|
||||
@@ -416,20 +509,43 @@ def runAdobeCS5Install(dmgpath, uninstalling=False):
|
||||
if mountpoints:
|
||||
install_path = findInstallApp(mountpoints[0])
|
||||
if install_path:
|
||||
# look for install.xml at root
|
||||
deploymentfile = os.path.join(mountpoints[0], "install.xml")
|
||||
overridefile = os.path.join(mountpoints[0],
|
||||
"application.xml.override")
|
||||
if os.path.exists(deploymentfile):
|
||||
deploymentfile = ""
|
||||
overridefile = ""
|
||||
if adobeInstallInfo:
|
||||
deploymentxml = ""
|
||||
if uninstalling:
|
||||
action = "--action=uninistall"
|
||||
deploymentxml = adobeInstallInfo.get('uninstallxml')
|
||||
path = os.path.join(munkicommon.tmpdir, "uninstall.xml")
|
||||
else:
|
||||
action = "--action=install"
|
||||
|
||||
# installing
|
||||
deploymentxml = adobeInstallInfo.get('installxml')
|
||||
path = os.path.join(munkicommon.tmpdir, "install.xml")
|
||||
if deploymentxml:
|
||||
deploymentfile = writefile(deploymentxml, path)
|
||||
|
||||
overridexml = CS5applicationXMLoverride(adobeInstallInfo)
|
||||
path = os.path.join(munkicommon.tmpdir,
|
||||
"application.xml.override")
|
||||
overridefile = writefile(overridexml, path)
|
||||
|
||||
if not deploymentfile:
|
||||
# look for install.xml file at root of dmg
|
||||
deploymentfile = os.path.join(mountpoints[0], "install.xml")
|
||||
if not overridefile:
|
||||
# look for application.xml.override file at root of dmg
|
||||
overridefile = os.path.join(mountpoints[0],
|
||||
"application.xml.override")
|
||||
|
||||
if os.path.exists(deploymentfile):
|
||||
# try to find and count the number of payloads
|
||||
# so we can give a rough progress indicator
|
||||
number_of_payloads = countPayloads(mountpoints[0])
|
||||
munkicommon.display_status("Running Adobe Install")
|
||||
if uninstalling:
|
||||
action = "--action=uninistall"
|
||||
munkicommon.display_status("Running Adobe Uninstall")
|
||||
else:
|
||||
action = "--action=install"
|
||||
munkicommon.display_status("Running Adobe Install")
|
||||
adobe_install = [ install_path,
|
||||
'--mode=silent',
|
||||
'--skipProcessCheck=1',
|
||||
@@ -720,15 +836,66 @@ def getBundleInfo(path):
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
|
||||
|
||||
def getXMLstring(filepath):
|
||||
xmlstring = ""
|
||||
try:
|
||||
f = open(filepath, "r")
|
||||
xmlstring = f.read()
|
||||
f.close()
|
||||
except:
|
||||
pass
|
||||
return xmlstring
|
||||
|
||||
|
||||
def serialNumber():
|
||||
# generate phony serial number to distract casual
|
||||
# snoopers
|
||||
sn = str(random.randint(1000,9999)) + "-"
|
||||
sn += str(random.randint(1000,9999)) + "-"
|
||||
sn += str(random.randint(1000,9999)) + "-"
|
||||
sn += str(random.randint(1000,9999)) + "-"
|
||||
sn += str(random.randint(1000,9999)) + "-"
|
||||
sn += str(random.randint(1000,9999))
|
||||
return sn
|
||||
|
||||
|
||||
def getAdobeInstallInfo(mountpoint=None,
|
||||
installxmlpath=None,
|
||||
uninstallxmlpath=None,
|
||||
serialnumber=None,
|
||||
suppressRegistration=True,
|
||||
suppressUpdates=True):
|
||||
# encapsulates info used by the Adobe Setup/Install app
|
||||
adobeInstallInfo = {}
|
||||
if mountpoint:
|
||||
adobeInstallInfo['media_signature'] = getCS5mediaSignature(mountpoint)
|
||||
adobeInstallInfo['payload_count'] = countPayloads(mountpoint)
|
||||
if serialnumber:
|
||||
# obfuscate this a bit
|
||||
s = base64.b64encode(serialnumber.replace("-",""))
|
||||
adobeInstallInfo['media_digest'] = s
|
||||
adobeInstallInfo['serial_number'] = serialNumber()
|
||||
adobeInstallInfo['suppress_registration'] = suppressRegistration
|
||||
adobeInstallInfo['suppress_updates'] = suppressUpdates
|
||||
if installxmlpath:
|
||||
xmlstring = getXMLstring(installxmlpath)
|
||||
adobeInstallInfo['installxml'] = xmlstring
|
||||
if uninstallxmlpath:
|
||||
xmlstring = getXMLstring(uninstallxmlpath)
|
||||
adobeInstallInfo['uninstallxml'] = xmlstring
|
||||
|
||||
return adobeInstallInfo
|
||||
|
||||
|
||||
def getAdobeCatalogInfo(mountpoint, pkgname):
|
||||
'''Used by makepkginfo to build pkginfo data for Adobe
|
||||
installers/updaters'''
|
||||
|
||||
# Look for Install.app (CS5 install)
|
||||
installapp = os.path.join(mountpoint, "Install.app")
|
||||
if os.path.exists(installapp):
|
||||
installapp = findInstallApp(mountpoint)
|
||||
if installapp:
|
||||
# this is a CS5 installer disk image
|
||||
cataloginfo = getAdobePackageInfo(mountpoint)
|
||||
if cataloginfo:
|
||||
@@ -740,6 +907,25 @@ def getAdobeCatalogInfo(mountpoint, pkgname):
|
||||
cataloginfo['installer_type'] = "AdobeCS5Installer"
|
||||
if pkgname:
|
||||
cataloginfo['package_path'] = pkgname
|
||||
cataloginfo['adobe_install_info'] = getAdobeInstallInfo(
|
||||
mountpoint=mountpoint,
|
||||
installxmlpath=None,
|
||||
uninstallxmlpath=None,
|
||||
serialnumber=None,
|
||||
suppressRegistration=True,
|
||||
suppressUpdates=True)
|
||||
# make a default <key>installs</key> entry
|
||||
uninstalldir = "/Library/Application Support/Adobe/Uninstall"
|
||||
signaturefile = \
|
||||
cataloginfo['adobe_install_info']['media_signature'] + ".db"
|
||||
filepath = os.path.join(uninstalldir, signaturefile)
|
||||
installs = []
|
||||
installitem = {}
|
||||
installitem['path'] = filepath
|
||||
installitem['type'] = 'file'
|
||||
installs.append(installitem)
|
||||
cataloginfo['installs'] = installs
|
||||
|
||||
return cataloginfo
|
||||
|
||||
# Look for AdobePatchInstaller.app (CS5 updater)
|
||||
@@ -823,41 +1009,102 @@ def adobeSetupError(errorcode):
|
||||
# returns text description for numeric error code
|
||||
# Reference:
|
||||
# http://www.adobe.com/devnet/creativesuite/pdfs/DeployGuide.pdf
|
||||
errormessage = { 0 : "Application installed successfully",
|
||||
1 : "Unable to parse command line",
|
||||
2 : "Unknown user interface mode specified",
|
||||
3 : "Unable to initialize ExtendScript",
|
||||
4 : "User interface workflow failed",
|
||||
5 : "Unable to initialize user interface workflow",
|
||||
6 : "Silent workflow completed with errors",
|
||||
7 : "Unable to complete the silent workflow",
|
||||
8 : "Exit and restart",
|
||||
9 : "Unsupported operating system version",
|
||||
10 : "Unsupported file system",
|
||||
11 : "Another instance of Adobe Setup is running",
|
||||
12 : "CAPS integrity error",
|
||||
13 : "Media optimization failed",
|
||||
14 : "Failed due to insufficient privileges",
|
||||
9999 : "Catastrophic error",
|
||||
-1 : "AdobeUberInstaller failed before launching Setup" }
|
||||
errormessage = {
|
||||
0 : "Application installed successfully",
|
||||
1 : "Unable to parse command line",
|
||||
2 : "Unknown user interface mode specified",
|
||||
3 : "Unable to initialize ExtendScript",
|
||||
4 : "User interface workflow failed",
|
||||
5 : "Unable to initialize user interface workflow",
|
||||
6 : "Silent workflow completed with errors",
|
||||
7 : "Unable to complete the silent workflow",
|
||||
8 : "Exit and restart",
|
||||
9 : "Unsupported operating system version",
|
||||
10 : "Unsupported file system",
|
||||
11 : "Another instance of Adobe Setup is running",
|
||||
12 : "CAPS integrity error",
|
||||
13 : "Media optimization failed",
|
||||
14 : "Failed due to insufficient privileges",
|
||||
15 : "Media DB Sync Failed",
|
||||
16 : "Failed to laod the Deployment file",
|
||||
17 : "EULA Acceptance Failed",
|
||||
18 : "C3PO Bootstrap Failed",
|
||||
19 : "Conflicting processes running",
|
||||
20 : "Install source path not specified or does not exist",
|
||||
21 : "Version of payloads is not supported by this version of RIB",
|
||||
22 : "Install Directory check failed",
|
||||
23 : "System Requirements Check failed",
|
||||
24 : "Exit User Canceled Workflow",
|
||||
25 : "A binary path Name exceeded Operating System's MAX PATH limit",
|
||||
26 : "Media Swap Required in Silent Mode",
|
||||
27 : "Keyed files detected in target",
|
||||
28 : "Base product is not installed",
|
||||
29 : "Base product has been moved",
|
||||
30 : "Insufficient disk space to install the payload + Done with errors",
|
||||
31 : "Insufficient disk space to install the payload + Failed",
|
||||
32 : "The patch is already applied",
|
||||
9999 : "Catastrophic error",
|
||||
-1 : "AdobeUberInstaller failed before launching Setup" }
|
||||
return errormessage.get(errorcode, "Unknown error")
|
||||
|
||||
|
||||
def doAdobeInstall(item, itempath):
|
||||
# wrapper to handle all the Adobe installer methods
|
||||
installer_type = item.get("installer_type","")
|
||||
if installer_type == "AdobeUberInstaller":
|
||||
# Adobe CS4 installer
|
||||
def doAdobeRemoval(item):
|
||||
uninstallmethod = item['uninstall_method']
|
||||
itempath = ""
|
||||
if "uninstaller_item" in item:
|
||||
managedinstallbase = munkicommon.pref('ManagedInstallDir')
|
||||
itempath = os.path.join(managedinstallbase, 'Cache',
|
||||
item["uninstaller_item"])
|
||||
if not os.path.exists(itempath):
|
||||
munkicommon.display_error("%s package for %s was "
|
||||
"missing from the cache."
|
||||
% (uninstallmethod, item['name']))
|
||||
return -1
|
||||
|
||||
|
||||
if uninstallmethod == "AdobeSetup":
|
||||
# CS3 uninstall
|
||||
retcode = adobeutils.runAdobeSetup(itempath, uninstalling=True)
|
||||
|
||||
elif uninstallmethod == "AdobeUberUninstaller":
|
||||
# CS4 uninstall
|
||||
pkgname = item.get("adobe_package_name") or \
|
||||
item.get("package_path","")
|
||||
retcode = uberInstall(itempath, pkgname)
|
||||
retcode = runAdobeUberTool(itempath, pkgname, uninstalling=True)
|
||||
|
||||
elif uninstallmethod == "AdobeCS5Installer":
|
||||
# CS5 uninstall. Sheesh. Three releases, three methods.
|
||||
adobeInstallInfo = item.get('adobe_install_info')
|
||||
retcode = runAdobeCS5Install(itempath, adobeInstallInfo,
|
||||
uninstalling=True)
|
||||
|
||||
if retcode:
|
||||
munkicommon.display_error("Uninstall of %s failed." % item['name'])
|
||||
return retcode
|
||||
|
||||
|
||||
def doAdobeInstall(item):
|
||||
# wrapper to handle all the Adobe installer methods
|
||||
# first get the path to the installer dmg. We know
|
||||
# it exists because installer.py already checked
|
||||
managedinstallbase = \
|
||||
munkicommon.pref('ManagedInstallDir')
|
||||
itempath = os.path.join(managedinstallbase,
|
||||
'Cache',
|
||||
item["installer_item"])
|
||||
installer_type = item.get("installer_type","")
|
||||
if installer_type == "AdobeSetup":
|
||||
# Adobe CS3/CS4 updater or Adobe CS3 installer
|
||||
retcode = runAdobeSetup(itempath)
|
||||
if retcode == 8:
|
||||
# Adobe Setup says restart needed
|
||||
restartflag = True
|
||||
retcode = 0
|
||||
elif installer_type == "AdobeSetup":
|
||||
# Adobe updater or Adobe CS3 installer
|
||||
retcode = runAdobeSetup(itempath)
|
||||
elif installer_type == "AdobeUberInstaller":
|
||||
# Adobe CS4 installer
|
||||
pkgname = item.get("adobe_package_name") or \
|
||||
item.get("package_path","")
|
||||
retcode = runAdobeUberTool(itempath, pkgname)
|
||||
if retcode == 8:
|
||||
# Adobe Setup says restart needed
|
||||
restartflag = True
|
||||
@@ -865,21 +1112,18 @@ def doAdobeInstall(item, itempath):
|
||||
elif installer_type == "AdobeAcrobatUpdater":
|
||||
# Acrobat Pro 9 updater
|
||||
retcode = updateAcrobatPro(itempath)
|
||||
elif installer_type == "AdobeCS5Installer":
|
||||
# Adobe CS5 installer
|
||||
adobeInstallInfo = item.get('adobe_install_info')
|
||||
retcode = runAdobeCS5Install(itempath, adobeInstallInfo)
|
||||
elif installer_type == "AdobeCS5PatchInstaller":
|
||||
# Adobe CS5 updater
|
||||
retcode = runAdobeCS5PatchInstaller(itempath)
|
||||
return retcode
|
||||
|
||||
def uberInstall(dmgpath, pkgname=''):
|
||||
return runAdobeUberTool(dmgpath, pkgname)
|
||||
|
||||
|
||||
def uninstall(dmgpath, pkgname=''):
|
||||
return runAdobeUberTool(dmgpath, pkgname, uninstalling=True)
|
||||
|
||||
|
||||
def main():
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -342,7 +342,7 @@ def installWithInfo(dirpath, installlist):
|
||||
return restartflag
|
||||
installer_type = item.get("installer_type","")
|
||||
if installer_type.startswith("Adobe"):
|
||||
retcode = adobeutils.doAdobeInstall(item, itempath)
|
||||
retcode = adobeutils.doAdobeInstall(item)
|
||||
elif installer_type == "appdmg":
|
||||
retcode = copyAppFromDMG(itempath)
|
||||
else:
|
||||
@@ -502,50 +502,10 @@ def processRemovals(removallist):
|
||||
else:
|
||||
munkicommon.log("Uninstall of %s was "
|
||||
"successful." % name)
|
||||
|
||||
elif uninstallmethod[0] == "AdobeUberUninstaller":
|
||||
if "uninstaller_item" in item:
|
||||
managedinstallbase = \
|
||||
munkicommon.pref('ManagedInstallDir')
|
||||
itempath = os.path.join(managedinstallbase,
|
||||
'Cache',
|
||||
item["uninstaller_item"])
|
||||
if os.path.exists(itempath):
|
||||
pkgname = item.get("adobe_package_name") or \
|
||||
item.get("pacakge_path","")
|
||||
retcode = adobeutils.uninstall(itempath,
|
||||
pkgname)
|
||||
if retcode:
|
||||
munkicommon.display_error("Uninstall of "
|
||||
"%s failed." %
|
||||
name)
|
||||
else:
|
||||
munkicommon.display_error("Adobe"
|
||||
"UberUninstaller "
|
||||
"package for %s "
|
||||
"was missing from "
|
||||
"the Cache." % name)
|
||||
|
||||
elif uninstallmethod[0] == "AdobeSetup":
|
||||
if "uninstaller_item" in item:
|
||||
managedinstallbase = \
|
||||
munkicommon.pref('ManagedInstallDir')
|
||||
itempath = os.path.join(managedinstallbase,
|
||||
'Cache',
|
||||
item["uninstaller_item"])
|
||||
if os.path.exists(itempath):
|
||||
retcode = adobeutils.runAdobeSetup(itempath,
|
||||
uninstalling=True)
|
||||
if retcode:
|
||||
munkicommon.display_error("Uninstall of "
|
||||
"%s failed." %
|
||||
name)
|
||||
else:
|
||||
munkicommon.display_error("Adobe Setup "
|
||||
"package for %s "
|
||||
"was missing from "
|
||||
"the Cache." % name)
|
||||
|
||||
|
||||
elif uninstallmethod[0].startswith("Adobe"):
|
||||
retcode = adobeutils.doAdobeRemoval(item)
|
||||
|
||||
elif uninstallmethod[0] == "remove_app":
|
||||
remove_app_info = item.get('remove_app_info',None)
|
||||
if remove_app_info:
|
||||
|
||||
@@ -880,6 +880,13 @@ def enoughDiskSpace(manifestitem_pl, installlist=[], uninstalling=False):
|
||||
fudgefactor = 102400
|
||||
installeritemsize = 0
|
||||
installedsize = 0
|
||||
alreadydownloadedsize = 0
|
||||
if 'installer_item_location' in manifestitem_pl:
|
||||
cachedir = os.path.join(munkicommon.pref('ManagedInstallDir'),"Cache")
|
||||
dl = os.path.join(cachedir,
|
||||
manifestitem_pl['installer_item_location'])
|
||||
if os.path.exists(dl):
|
||||
alreadydownloadedsize = os.path.getsize(dl)
|
||||
if 'installer_item_size' in manifestitem_pl:
|
||||
installeritemsize = int(manifestitem_pl['installer_item_size'])
|
||||
if 'installed_size' in manifestitem_pl:
|
||||
@@ -891,7 +898,8 @@ def enoughDiskSpace(manifestitem_pl, installlist=[], uninstalling=False):
|
||||
installedsize = 0
|
||||
if 'uninstaller_item_size' in manifestitem_pl:
|
||||
installeritemsize = int(manifestitem_pl['uninstaller_item_size'])
|
||||
diskspaceneeded = (installeritemsize + installedsize + fudgefactor)
|
||||
diskspaceneeded = (installeritemsize - alreadydownloadedsize +
|
||||
installedsize + fudgefactor)
|
||||
|
||||
# munkicommon.getAvailableDiskSpace() returns KB
|
||||
availablediskspace = munkicommon.getAvailableDiskSpace()
|
||||
@@ -1218,6 +1226,9 @@ def processInstall(manifestitem, cataloglist, installinfo):
|
||||
if 'installer_choices_xml' in pl:
|
||||
iteminfo['installer_choices_xml'] = \
|
||||
pl['installer_choices_xml']
|
||||
if 'adobe_install_info' in pl:
|
||||
iteminfo['adobe_install_info'] = \
|
||||
pl['adobe_install_info']
|
||||
if 'RestartAction' in pl:
|
||||
iteminfo['RestartAction'] = pl['RestartAction']
|
||||
if 'installer_type' in pl:
|
||||
@@ -1422,11 +1433,8 @@ def processRemoval(manifestitem, cataloglist, installinfo):
|
||||
packagesToRemove = getReceiptsToRemove(item)
|
||||
if packagesToRemove:
|
||||
uninstall_item = item
|
||||
elif uninstallmethod == 'AdobeUberUninstaller':
|
||||
# Adobe CS4 package
|
||||
uninstall_item = item
|
||||
elif uninstallmethod == 'AdobeSetup':
|
||||
# Adobe CS3 package
|
||||
elif uninstallmethod.startswith('Adobe'):
|
||||
# Adobe CS3/CS4/CS5 product
|
||||
uninstall_item = item
|
||||
elif uninstallmethod == 'remove_app':
|
||||
uninstall_item = item
|
||||
@@ -1556,23 +1564,26 @@ def processRemoval(manifestitem, cataloglist, installinfo):
|
||||
return False
|
||||
|
||||
iteminfo["uninstall_method"] = uninstallmethod
|
||||
if uninstallmethod == "AdobeUberUninstaller" or \
|
||||
uninstallmethod == "AdobeSetup":
|
||||
if 'uninstaller_item_location' in item:
|
||||
location = uninstall_item['uninstaller_item_location']
|
||||
if uninstallmethod.startswith("Adobe"):
|
||||
if 'adobe_install_info' in item:
|
||||
iteminfo['adobe_install_info'] = item['adobe_install_info']
|
||||
else:
|
||||
location = uninstall_item['installer_item_location']
|
||||
if not enoughDiskSpace(uninstall_item, uninstalling=True):
|
||||
return False
|
||||
if download_installeritem(location):
|
||||
filename = os.path.split(location)[1]
|
||||
iteminfo['uninstaller_item'] = filename
|
||||
iteminfo['adobe_package_name'] = \
|
||||
uninstall_item.get('adobe_package_name','')
|
||||
else:
|
||||
munkicommon.display_warning("Failed to download the uninstaller "
|
||||
"for %s" % iteminfo["name"])
|
||||
return False
|
||||
if 'uninstaller_item_location' in item:
|
||||
location = uninstall_item['uninstaller_item_location']
|
||||
else:
|
||||
location = uninstall_item['installer_item_location']
|
||||
if not enoughDiskSpace(uninstall_item, uninstalling=True):
|
||||
return False
|
||||
if download_installeritem(location):
|
||||
filename = os.path.split(location)[1]
|
||||
iteminfo['uninstaller_item'] = filename
|
||||
iteminfo['adobe_package_name'] = \
|
||||
uninstall_item.get('adobe_package_name','')
|
||||
else:
|
||||
munkicommon.display_warning("Failed to download the "
|
||||
"uninstaller for %s"
|
||||
% iteminfo["name"])
|
||||
return False
|
||||
elif uninstallmethod == "remove_app":
|
||||
if uninstall_item.get('installs',None):
|
||||
iteminfo['remove_app_info'] = uninstall_item['installs'][0]
|
||||
|
||||
Reference in New Issue
Block a user