56 lines
1.7 KiB
AppleScript
56 lines
1.7 KiB
AppleScript
on run argv
|
|
set image_name to item 1 of argv
|
|
|
|
tell application "Finder"
|
|
tell disk image_name
|
|
|
|
-- wait for the image to finish mounting
|
|
set open_attempts to 0
|
|
repeat while open_attempts < 4
|
|
try
|
|
open
|
|
delay 1
|
|
set open_attempts to 5
|
|
close
|
|
on error errStr number errorNumber
|
|
set open_attempts to open_attempts + 1
|
|
delay 10
|
|
end try
|
|
end repeat
|
|
delay 5
|
|
|
|
-- open the image the first time and save a DS_Store with just
|
|
-- background and icon setup
|
|
open
|
|
set current view of container window to icon view
|
|
set theViewOptions to the icon view options of container window
|
|
set background picture of theViewOptions to file ".background:background.png"
|
|
set arrangement of theViewOptions to not arranged
|
|
set icon size of theViewOptions to 192
|
|
set text size of theViewOptions to 16
|
|
delay 5
|
|
close
|
|
|
|
-- next setup the position of the app and Applications symlink
|
|
-- hide all the window decoration, and finally re-sign the binary
|
|
open
|
|
tell container window
|
|
set sidebar width to 0
|
|
set statusbar visible to false
|
|
set toolbar visible to false
|
|
set the bounds to { 400, 100, 1200, 725 }
|
|
set position of item "ashirt.app" to { 0, 225 }
|
|
set position of item "README.MD" to { 250, 0 }
|
|
set position of item "Applications" to { 500, 225 }
|
|
try
|
|
do shell script "codesign -v -f --timestamp --options runtime --sign \"$(cat @CMAKE_CURRENT_BINARY_DIR@/NOTARIZE_AS)\" /Volumes/" & image_name & "/ashirt.app/Contents/MacOS/ashirt"
|
|
end try
|
|
end tell
|
|
delay 5
|
|
close
|
|
|
|
end tell
|
|
delay 1
|
|
end tell
|
|
end run
|