mirror of
https://github.com/munki/munki.git
synced 2026-04-23 04:59:17 -05:00
makepkginfo now warns when provided a read/write disk image, and does not generate an installer_item_hash.
This commit is contained in:
+10
-1
@@ -612,6 +612,14 @@ def main():
|
||||
itemhash = munkicommon.getsha256hash(item)
|
||||
|
||||
if item.endswith('.dmg'):
|
||||
if munkicommon.DMGisWritable(item):
|
||||
print >> sys.stderr, ("WARNING: %s is a writable disk "
|
||||
"image. Checksum verification is not supported."
|
||||
% item)
|
||||
print >> sys.stderr, ("WARNING: Consider converting "
|
||||
"%s to a read-only disk image."
|
||||
% item)
|
||||
itemhash = "N/A"
|
||||
catinfo = getCatalogInfoFromDmg(item, options)
|
||||
if (catinfo and
|
||||
catinfo.get('installer_type') == "AdobeCS5Installer"):
|
||||
@@ -668,7 +676,8 @@ def main():
|
||||
catinfo['version'] = options.pkgvers
|
||||
|
||||
catinfo['installer_item_size'] = int(itemsize/1024)
|
||||
catinfo['installer_item_hash'] = itemhash
|
||||
if itemhash != "N/A":
|
||||
catinfo['installer_item_hash'] = itemhash
|
||||
|
||||
# try to generate the correct item location
|
||||
temppath = item
|
||||
|
||||
@@ -757,6 +757,27 @@ def getFirstPlist(textString):
|
||||
|
||||
# dmg helpers
|
||||
|
||||
def DMGisWritable(dmgpath):
|
||||
'''Attempts to determine if the given disk image is writable'''
|
||||
proc = subprocess.Popen(
|
||||
['/usr/bin/hdiutil', 'imageinfo', dmgpath, '-plist'],
|
||||
bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
(out, err) = proc.communicate()
|
||||
if err:
|
||||
print >> sys.stderr, (
|
||||
'hdiutil error %s with image %s.' % (err, dmgpath))
|
||||
(pliststr, out) = getFirstPlist(out)
|
||||
if pliststr:
|
||||
try:
|
||||
plist = FoundationPlist.readPlistFromString(pliststr)
|
||||
format = plist.get('Format')
|
||||
if format in ['UDSB', 'UDSP', 'UDRW', 'RdWr']:
|
||||
return True
|
||||
except FoundationPlist.NSPropertyListSerializationException:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
def DMGhasSLA(dmgpath):
|
||||
'''Returns true if dmg has a Software License Agreement.
|
||||
These dmgs normally cannot be attached without user intervention'''
|
||||
|
||||
Reference in New Issue
Block a user