Fix issue with missing link to /Applications dir in dmg and applescript cleanup.

This commit is contained in:
Martin Zibricky 2012-12-01 14:23:08 +01:00
parent 8c25375e04
commit 74f18abbe6
2 changed files with 13 additions and 19 deletions

View File

@ -13,22 +13,13 @@ on run
set arrangement of theViewOptions to not arranged set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 128 set icon size of theViewOptions to 128
set background picture of theViewOptions to file ".background:installer-background.png" set background picture of theViewOptions to file ".background:installer-background.png"
if not exists file "Applications" then
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
end if
delay 1
set position of item "%s" of container window to {160, 200} set position of item "%s" of container window to {160, 200}
set position of item ".Trashes" of container window to {100, 500}
set position of item ".background" of container window to {200, 500}
set position of item ".DS_Store" of container window to {400, 500}
set position of item "Applications" of container window to {550, 200} set position of item "Applications" of container window to {550, 200}
if exists file ".VolumeIcon.icns" then set position of item ".background" of container window to {100, 500}
set position of item ".VolumeIcon.icns" of container window to {500, 500} set position of item ".DS_Store" of container window to {200, 500}
end if
set position of item ".fseventsd" of container window to {300, 500} set position of item ".fseventsd" of container window to {300, 500}
if exists POSIX file ".SymAVx86QSFile" then set position of item ".Trashes" of container window to {400, 500}
set position of item ".SymAVx86QSFile" of container window to {600, 500} set position of item ".VolumeIcon.icns" of container window to {500, 500}
end if
open open
close close
update without registering applications update without registering applications

View File

@ -581,6 +581,10 @@ class MacosxBuilder(object):
self._run_command(['SetFile', '-a', 'C', dmg_volume_path], self._run_command(['SetFile', '-a', 'C', dmg_volume_path],
'Could not set dmg icon attributes.') 'Could not set dmg icon attributes.')
# Create symlink in dmg pointing to the /Applications directory on OS X.
self._print('... Creating symlink to /Applications.')
os.symlink('/Applications', os.path.join(dmg_volume_path, 'Applications'))
# Set dmg background. Requires running Mac OS X gui. # Set dmg background. Requires running Mac OS X gui.
# TODO: better formatting and code refactoring # TODO: better formatting and code refactoring
if not self.args.devel: if not self.args.devel:
@ -593,20 +597,19 @@ class MacosxBuilder(object):
u'Could not copy the background image, dmg creation failed.' u'Could not copy the background image, dmg creation failed.'
) )
print 10 * 'A'
self.adjust_dmg_view(os.path.basename(dmg_volume_path)) self.adjust_dmg_view(os.path.basename(dmg_volume_path))
## Unmount dmg file. ## Unmount dmg file.
self._print('... unmounting the dmg.') self._print('... unmounting the dmg.')
# Sometimes it could happen that OSX Finder is blocking umount. # Sometimes it could happen that OSX Finder is blocking umount.
# We need to find this process and kill it. # We need to find this process and kill it.
try: try:
output = subprocess.check_output(['fuser', dmg_volume_path]) output = subprocess.check_output(['fuser', dmg_volume_path]).strip()
blocking_proc_pid = int(output.strip().split()[0]) if output:
if blocking_proc_pid: blocking_proc_pid = int(output.split()[0])
os.kill(int(blocking_proc_pid), signal.SIGKILL) os.kill(int(blocking_proc_pid), signal.SIGKILL)
except: except Exception as e:
print str(e)
self._print('... failed to kill process using %s' % dmg_volume_path) self._print('... failed to kill process using %s' % dmg_volume_path)
# Unmount dmg file. # Unmount dmg file.
self._run_command([self.hdiutil, 'detach', dmg_volume_path], self._run_command([self.hdiutil, 'detach', dmg_volume_path],