Skip to content

Instantly share code, notes, and snippets.

@timsutton
Last active February 7, 2017 23:02
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timsutton/0b7c7dc933deb2efc12250fb351b83e0 to your computer and use it in GitHub Desktop.
Save timsutton/0b7c7dc933deb2efc12250fb351b83e0 to your computer and use it in GitHub Desktop.
Update all installed Adobe product install metadata to suppress the "Sign into Adobe CC" dialog box. This will likely make its way into https://github.com/timsutton/make-adobe-cc-license-pkg/
#!/usr/bin/python
# pylint: disable=locally-disabled, line-too-long
from __future__ import print_function
import os
import re
import sys
from glob import glob
from xml.etree import ElementTree
def main():
pcf_root = '/Library/Application Support/Adobe/PCF'
if sys.platform == 'win32':
pcf_root = os.path.join(os.environ['SYSTEMDRIVE'],
'\\Program Files (x86)\\Common Files\\Adobe\\PCF')
xmls = glob(os.path.join(pcf_root, '*.xml'))
for xml_file in xmls:
# Sanity-check the filename and basic XML structure
# (ADBE.. string is only present for HyperDrive-installed products)
# TODO: we should skip products like SPRK, which is not eligible for serial- or
# device-based licensing
match = re.match(r'^({.*?ADBE.*?}).*$', os.path.basename(xml_file))
if not match:
sys.stderr.write("Skipping file '%s', does not match a PCF file pattern\n" % xml_file)
continue
adbe_code = match.groups()[0]
root = ElementTree.parse(xml_file)
payload = root.find("./Payload[@adobeCode='%s']" % adbe_code)
if payload is None:
sys.stderr.write("Didn't find expected Adobe code %s in any 'Payload' element"
" in file %s\n" % (adbe_code, xml_file))
continue
# Check and skip if the serial override key already exists
if payload.find("Data[@key='REG_SERIAL_OVERRIDE']") is not None:
continue
# Finally, make a new element and append it to the Payload element
new_element = ElementTree.Element('Data', attrib={'key': 'REG_SERIAL_OVERRIDE'})
new_element.text = 'Suppress'
payload.append(new_element)
try:
root.write(xml_file, encoding='utf-8', xml_declaration=True)
print("Wrote modified PCF XML file: '%s'" % xml_file)
except IOError:
sys.stderr.write("ERROR: Can't write to file '%s'. Make sure you have "
"sufficient privileges to write to this location. "
% xml_file)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment