Fix for cfprefsd interference; ensure that stdout stream only contains pkginfo xml and not messages intended for the user.

This commit is contained in:
Heig Gregorian
2012-08-22 13:49:57 -07:00
parent f1d8df900e
commit ca3786fe8a
2 changed files with 14 additions and 9 deletions
+6 -2
View File
@@ -625,12 +625,16 @@ def main():
print >> sys.stderr, 'Ignoring additional installer items:'
print >> sys.stderr, '\t', '\n\t'.join(arguments[1:])
os_version = munkicommon.getOsVersion(
only_major_minor=False, as_tuple=True)
if options.installer_choices_xml:
os_version = munkicommon.getOsVersion(
only_major_minor=False, as_tuple=True)
if os_version < (10, 6, 6):
options.installer_choices_xml = False
# circumvent cfprefsd plist scanning
if os_version >= (10, 8):
os.environ['__CFPREFERENCES_AVOID_DAEMON'] = "1"
catinfo = {}
installs = []
if arguments:
+8 -7
View File
@@ -844,17 +844,18 @@ def unmountdmg(mountpoint):
"""
Unmounts the dmg at mountpoint
"""
proc = subprocess.Popen(['/usr/bin/hdiutil', 'detach', mountpoint],
bufsize=1, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
cmd = ['/usr/bin/hdiutil', 'detach', mountpoint]
proc = subprocess.Popen(cmd, bufsize=1, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(unused_output, err) = proc.communicate()
if proc.returncode:
cmd.append('-force')
display_warning('Polite unmount failed: %s' % err)
display_info('Attempting to force unmount %s' % mountpoint)
display_warning('Attempting to force unmount %s' % mountpoint)
# try forcing the unmount
retcode = subprocess.call(['/usr/bin/hdiutil', 'detach', mountpoint,
'-force'])
if retcode:
proc = subprocess.Popen(cmd, bufsize=1, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if proc.returncode:
display_warning('Failed to unmount %s' % mountpoint)