Files
pilotclient/installer/installbuilder/createbundledmg.xml
2017-12-08 12:36:12 +01:00

134 lines
5.3 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>(swiftinstaller-macos-\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>
<!-- Apple script cannot talk to Finder when running via ssh -->
<!-- <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>