Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: tools/mac_build_editor_dmg.sh

Issue 28773003: Changes to annotated step scripts: dart-editor-installer-* builders will build installer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/mac_build_editor_dmg.sh
diff --git a/tools/mac_build_editor_dmg.sh b/tools/mac_build_editor_dmg.sh
index 2da8c0fec139963b3e1ffd4b0cdab72fd0332b58..13f881f9d1011928c78079692b2aee3e7c64835b 100755
--- a/tools/mac_build_editor_dmg.sh
+++ b/tools/mac_build_editor_dmg.sh
@@ -9,29 +9,26 @@
# Fail if a command failed
set -e
+set -o errexit
+set -o nounset
if [ $# -ne 4 ]; then
- echo "Usage $0 <output.dmg> <app-folder> <icon.icns> <volume-name>"
+ echo "Usage $0 <output.dmg> <raw-editor-bundle> <folder-icon> <volume-name>"
exit 1
fi
OUTPUT_DMG_FILE=$1
-INPUT_APP_FOLDER_PATH=$2
-INPUT_ICON=$3
+INPUT_FOLDER_PATH=$2
+FOLDER_ICON=$3
INPUT_VOLUME_NAME=$4
-APP_FOLDER_NAME=$(basename "$INPUT_APP_FOLDER_PATH")
+FOLDER_NAME="Dart"
VOLUME_MOUNTPOINT="/Volumes/$INPUT_VOLUME_NAME"
SPARSEIMAGE="$OUTPUT_DMG_FILE.sparseimage"
# Input validations
-if [ "${INPUT_APP_FOLDER_PATH##*.}" != "app" ]; then
- echo "Application folder has to end in '.app' " \
- "(but was $INPUT_APP_FOLDER_PATH)."
- exit 1
-fi
-if [ "${INPUT_ICON##*.}" != "icns" ]; then
- echo "Volume icon has to end in '.icns'."
+if [ ! -d "$INPUT_FOLDER_PATH" ]; then
+ echo "Editor bundle folder does not exist ($INPUT_FOLDER_PATH)"
exit 1
fi
@@ -48,22 +45,44 @@ if [ -f "$OUTPUT_DMG_FILE" ]; then
rm "$OUTPUT_DMG_FILE"
fi
+replace_folder_icon() {
ricow1 2013/10/18 11:18:08 could you give a little context here in a comment,
kustermann 2013/10/18 14:12:13 Done.
+ FOLDER="$1"
+ ICON="$2"
+ TEMP_ICON_RESOURCE='/tmp/icns.rsrc'
+ ICON_RESOURCE="$FOLDER"/$'Icon\r'
+
+ # Add finder icon to the image file
+ sips -i "$ICON" > /dev/null
+
+ # Extract the finder icon resource
+ DeRez -only icns "$ICON" > "$TEMP_ICON_RESOURCE"
+
+ # Create the icon resource
+ rm -f "$ICON_RESOURCE"
+ Rez -append "$TEMP_ICON_RESOURCE" -o "$ICON_RESOURCE"
+ rm "$TEMP_ICON_RESOURCE"
+
+ # Set the 'custom icon' attribute on $FOLDER
+ SetFile -a C "$FOLDER"
+
+ # Make the $ICON_RESOURCE invisible for finder
+ SetFile -a V "$ICON_RESOURCE"
+}
+
+
# Create a new image and attach it
-hdiutil create -size 300m -type SPARSE -volname "$INPUT_VOLUME_NAME" -fs \
+hdiutil create -size 400m -type SPARSE -volname "$INPUT_VOLUME_NAME" -fs \
'Journaled HFS+' "$SPARSEIMAGE"
hdiutil attach "$SPARSEIMAGE"
# Add link to /Applications (so the user can drag-and-drop into it)
ln -s /Applications "$VOLUME_MOUNTPOINT/"
# Copy our application
-ditto "$INPUT_APP_FOLDER_PATH" "$VOLUME_MOUNTPOINT/$APP_FOLDER_NAME"
-# Make sure that the folder gets opened when mounting the image
+ditto "$INPUT_FOLDER_PATH" "$VOLUME_MOUNTPOINT/$FOLDER_NAME"
+# Set custom icon on this folder
+replace_folder_icon "$VOLUME_MOUNTPOINT/$FOLDER_NAME" "$FOLDER_ICON"
+# Make sure that the dmg gets opened when mounting the image
bless --folder "$VOLUME_MOUNTPOINT" --openfolder "$VOLUME_MOUNTPOINT"
-# Copy the volume icon
-cp "$INPUT_ICON" "$VOLUME_MOUNTPOINT/.VolumeIcon.icns"
-
-# Set the 'custom-icon' attribute on the volume
-SetFile -a C "$VOLUME_MOUNTPOINT"
# Use an applescript to setup the layout of the folder.
osascript << EOF
@@ -81,7 +100,7 @@ tell application "Finder"
set arrangement to not arranged
set icon size to 128
end tell
- set position of item "$APP_FOLDER_NAME" to {64, 64}
+ set position of item "$FOLDER_NAME" to {64, 64}
ricow1 2013/10/18 11:18:08 consider removing tabs
kustermann 2013/10/18 14:12:13 Done.
set position of item "Applications" to {320, 64}
eject
end tell
« editor/build/build.py ('K') | « tools/bots/bot_utils.py ('k') | tools/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698