Last active
December 14, 2015 16:08
-
-
Save timsutton/5112833 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import re | |
import urllib | |
import os | |
import subprocess | |
import plistlib | |
CHOICES_XML_ARRAY = [{'attributeSetting': False, | |
'choiceAttribute': 'selected', | |
'choiceIdentifier': 'browserplugin'}] | |
REV = '11' | |
TEMPLATE_URL = 'https://armmf.adobe.com/arm-manifests/mac/%s/current_version_url_template.txt' % REV | |
FTP_DL_BASEURL = 'ftp://ftp.adobe.com/pub/adobe/reader/mac/%s.x' % REV | |
current_ver_template = urllib.urlopen(TEMPLATE_URL).read() | |
ver = re.search('{MAJREV}\/(.*)\/', current_ver_template).groups()[0] | |
print "Latest version is %s." % ver | |
ftp_list_url = FTP_DL_BASEURL + '/%s/en_US' % ver | |
filelist = urllib.urlopen(ftp_list_url).read().strip() | |
dmgfile = filelist.split()[-1] | |
full_url = ftp_list_url + '/' + dmgfile | |
download_dmg = os.path.join(os.getcwd(), dmgfile) | |
print "Downloading %s to %s.." % (full_url, os.path.split(download_dmg)[0]) | |
urllib.urlretrieve(full_url, download_dmg) | |
preinstall_script = """#!/bin/sh | |
if [ -e "/Applications/Adobe Reader.app" ]; then | |
rm -r "/Applications/Adobe Reader.app" | |
fi | |
exit 0 | |
""" | |
script_file = os.path.join(os.getcwd(), 'preinstall.sh') | |
with open(script_file, 'w') as fd: | |
fd.write(preinstall_script) | |
cmd = ['/usr/local/munki/munkiimport', '--nointeractive', | |
'--subdirectory', 'apps/Adobe/Reader', | |
'--name', 'AdobeReader', | |
'--blocking-application', 'Adobe Reader.app', | |
'--preinstall-script', script_file, | |
'--minimum-os-version', '10.6.4', | |
'--displayname', 'Adobe Reader XI', | |
download_dmg] | |
subprocess.call(cmd) | |
os.remove(script_file) | |
# pkginfo_data = plistlib.readPlist() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment