Files
pilotclient/installer/installbuilder/createbundledmg.xml
Roland Winklmeier 8ee73d18e9 [MacOS] Create installer disk image manually to workaround broken hdiutil
Summary:
Apple broke the hdiutil on MacOS 10.13. If one passes multiple -srcfolder
arguments, it dead locks with 100 % CPU forever. Since there is no way to
tell Bitrock to use only one -srcfolder argument, we have to go the
advanced way and create the disk image file manually. This also allows
us to customize it more in the future.

Reviewers: #swift_pilot_client, msutcliffe

Reviewed By: #swift_pilot_client, msutcliffe

Subscribers: jenkins

Maniphest Tasks: T181

Differential Revision: https://dev.swift-project.org/D58
2017-11-03 12:05:16 +01:00

133 lines
5.2 KiB
XML

<actionDefinition>
<name>createBundleDmg</name>
<actionList>
<createTimeStamp>
<format>%Y%m%d%H%M%S</format>
<variable>timestamp</variable>
</createTimeStamp>
<setInstallerVariable>
<name>tempDir</name>
<value>/tmp/.tmpDir${timestamp}</value>
</setInstallerVariable>
<setInstallerVariableFromRegEx>
<name>installerBasename</name>
<pattern>(swift-installer-osx-\d+-\d.\d.\d).app</pattern>
<substitution>\1</substitution>
<text>${project.installerFilename}</text>
</setInstallerVariableFromRegEx>
<setInstallerVariable>
<name>dmgName</name>
<value>${project.outputDirectory}/${installerBasename}.dmg</value>
</setInstallerVariable>
<setInstallerVariable>
<name>tempDmgFile</name>
<value>${tempDir}/tmp.dmg</value>
</setInstallerVariable>
<deleteFile>
<path>${project.outputDirectory}/${installerBasename}.dmg</path>
</deleteFile>
<deleteFile>
<path>${tempDir}</path>
</deleteFile>
<createDirectory>
<path>${tempDir}/output</path>
</createDirectory>
<createDirectory>
<path>${tempDir}/mnt</path>
</createDirectory>
<copyFile>
<destination>${tempDir}/output</destination>
<origin>${project.outputDirectory}/${project.installerFilename}</origin>
</copyFile>
<!-- Volume Icon -->
<actionGroup>
<actionList>
<createDirectory>
<path>${tempDir}/output/.background</path>
</createDirectory>
<copyFile>
<destination>${tempDir}/output/.background/background.png</destination>
<origin>${build_project_directory}/../images/background.png</origin>
</copyFile>
</actionList>
<ruleList>
<fileExists path="${build_project_directory}/../images/background.png"/>
</ruleList>
</actionGroup>
<runProgram>
<program>hdiutil</program>
<programArguments>create -srcfolder "${tempDir}/output" -volname "${project.fullName}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW "${tempDmgFile}"</programArguments>
</runProgram>
<actionGroup>
<actionList>
<runProgram>
<abortOnError>0</abortOnError>
<program>hdiutil</program>
<programArguments>detach "/Volumes/${project.fullName}"</programArguments>
<showMessageOnError>0</showMessageOnError>
</runProgram>
<runProgram>
<program>hdiutil</program>
<programArguments>attach -readwrite -noverify -noautoopen "${tempDmgFile}"</programArguments>
</runProgram>
<runProgram>
<program>osascript</program>
<programArguments>-e 'tell application "Finder"
tell disk "${project.fullName}"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {${dmgWindowBounds}}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to ${dmgIconSize}
delay 5
update without registering applications
set position of item "${project.installerFilename}" of container window to {${dmgIconPosition}}
update without registering applications
delay 5
end tell
end tell'
</programArguments>
</runProgram>
<runProgram>
<program>hdiutil</program>
<programArguments>detach "/Volumes/${project.fullName}"</programArguments>
</runProgram>
</actionList>
</actionGroup>
<runProgram>
<program>hdiutil</program>
<programArguments>convert "${tempDmgFile}" -format UDZO -imagekey zlib-level=9 -o "${dmgName}"</programArguments>
</runProgram>
<deleteFile>
<path>${tempDir}</path>
</deleteFile>
</actionList>
<parameterList>
<stringParameter name="dmgIconPosition" value="186, 186" ask="0">
<description></description>
<explanation></explanation>
<default></default>
<allowEmptyValue>1</allowEmptyValue>
<width>40</width>
</stringParameter>
<stringParameter name="dmgWindowBounds" value="400, 100, 765, 465" ask="0">
<description></description>
<explanation></explanation>
<default></default>
<allowEmptyValue>1</allowEmptyValue>
<width>40</width>
</stringParameter>
<stringParameter name="dmgIconSize" value="128" ask="0">
<description></description>
<explanation></explanation>
<default></default>
<allowEmptyValue>1</allowEmptyValue>
<width>40</width>
</stringParameter>
</parameterList>
</actionDefinition>