mirror of
https://github.com/munki/munki.git
synced 2026-04-22 12:38:23 -05:00
copyAppFromDMG() now uses munkicommon.isApplication() instead of just looking for items ending with ".app"
git-svn-id: http://munki.googlecode.com/svn/trunk@408 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
@@ -219,36 +219,39 @@ def copyAppFromDMG(dmgpath):
|
||||
# find an app at the root level, copy it to /Applications
|
||||
for item in os.listdir(mountpoint):
|
||||
itempath = os.path.join(mountpoint,item)
|
||||
if item.endswith('.app'):
|
||||
if munkicommon.isApplication(itempath):
|
||||
appfound = True
|
||||
destpath = os.path.join("/Applications", item)
|
||||
if os.path.exists(destpath):
|
||||
retcode = subprocess.call(["/bin/rm", "-r", destpath])
|
||||
if retcode:
|
||||
munkicommon.display_error("Error removing existing "
|
||||
"%s" % destpath)
|
||||
if retcode == 0:
|
||||
munkicommon.display_status(
|
||||
"Copying %s to Applications folder" % item)
|
||||
retcode = subprocess.call(["/bin/cp", "-pR",
|
||||
itempath, destpath])
|
||||
if retcode:
|
||||
munkicommon.display_error("Error copying %s to %s" %
|
||||
(itempath, destpath))
|
||||
if retcode == 0:
|
||||
# remove com.apple.quarantine attribute from copied app
|
||||
cmd = ["/usr/bin/xattr", destpath]
|
||||
p = subprocess.Popen(cmd, shell=False, bufsize=1,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
(out, err) = p.communicate()
|
||||
if out:
|
||||
xattrs = out.splitlines()
|
||||
if "com.apple.quarantine" in xattrs:
|
||||
err = subprocess.call(["/usr/bin/xattr", "-d",
|
||||
"com.apple.quarantine",
|
||||
destpath])
|
||||
break
|
||||
|
||||
if appfound:
|
||||
destpath = os.path.join("/Applications", item)
|
||||
if os.path.exists(destpath):
|
||||
retcode = subprocess.call(["/bin/rm", "-r", destpath])
|
||||
if retcode:
|
||||
munkicommon.display_error("Error removing existing "
|
||||
"%s" % destpath)
|
||||
if retcode == 0:
|
||||
munkicommon.display_status(
|
||||
"Copying %s to Applications folder" % item)
|
||||
retcode = subprocess.call(["/bin/cp", "-pR",
|
||||
itempath, destpath])
|
||||
if retcode:
|
||||
munkicommon.display_error("Error copying %s to %s" %
|
||||
(itempath, destpath))
|
||||
if retcode == 0:
|
||||
# remove com.apple.quarantine attribute from copied app
|
||||
cmd = ["/usr/bin/xattr", destpath]
|
||||
p = subprocess.Popen(cmd, shell=False, bufsize=1,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
(out, err) = p.communicate()
|
||||
if out:
|
||||
xattrs = out.splitlines()
|
||||
if "com.apple.quarantine" in xattrs:
|
||||
err = subprocess.call(["/usr/bin/xattr", "-d",
|
||||
"com.apple.quarantine",
|
||||
destpath])
|
||||
|
||||
munkicommon.unmountdmg(mountpoint)
|
||||
if not appfound:
|
||||
|
||||
Reference in New Issue
Block a user