When looking for a receipt id in the old /Library/Receipts location, make sure /Library/Receipts actually exists!

This commit is contained in:
Greg Neagle
2016-07-22 19:29:42 -07:00
parent 00922bf76a
commit 143fb90af4

View File

@@ -197,12 +197,13 @@ def findBundleReceiptFromID(pkgid):
if not pkgid:
return ''
receiptsdir = "/Library/Receipts"
for item in munkicommon.listdir(receiptsdir):
itempath = os.path.join(receiptsdir, item)
if item.endswith('.pkg') and os.path.isdir(itempath):
info = munkicommon.getOnePackageInfo(itempath)
if info.get('packageid') == pkgid:
return itempath
if os.path.isdir(receiptsdir):
for item in munkicommon.listdir(receiptsdir):
itempath = os.path.join(receiptsdir, item)
if item.endswith('.pkg') and os.path.isdir(itempath):
info = munkicommon.getOnePackageInfo(itempath)
if info.get('packageid') == pkgid:
return itempath
#if we get here, not found
return ''