in legacy/autodmg_cache_builder/autodmg_cache_build.py [0:0]
def handle_custom():
"""Download custom resources and build the package."""
print("Downloading Munki client resources.")
# Set the local directory to the AutoDMG cache
old_managed = prefs.pref('ManagedInstallDir')
prefs.set_pref('ManagedInstallDir', CACHE)
# Downloads client resources into the AutoDMG cache
download.download_client_resources()
# Put the actual Munki cache dir back
prefs.set_pref('ManagedInstallDir', old_managed)
resource_dir = os.path.join(
CACHE, 'client_resources')
resource_file = os.path.join(resource_dir, 'custom.zip')
if os.path.isfile(resource_file):
# Client Resources are stored in
# /Library/Managed Installs/client_resources/custom.zip
destination_path = '/Library/Managed Installs/client_resources'
pkg_output_file = os.path.join(CACHE, 'munki_custom.pkg')
success = build_pkg(
resource_dir,
'munki_custom',
'com.facebook.cpe.munki_custom',
destination_path,
CACHE,
'Creating the Munki custom resources package.'
)
if success:
return pkg_output_file
else:
print(
"Failed to build Munki custom resources package!",
file=sys.stderr
)
return None