[frogr] Generate the DMG file using the proper filename



commit 8af23da5afeda1030357c3a2471af19c0d3e750a
Author: Mario Sanchez Prada <msanchez gnome org>
Date:   Wed Dec 19 19:43:32 2012 +0100

    Generate the DMG file using the proper filename

 osx/makedmg.sh |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/osx/makedmg.sh b/osx/makedmg.sh
index bc20620..d4aeb77 100755
--- a/osx/makedmg.sh
+++ b/osx/makedmg.sh
@@ -7,38 +7,40 @@ pushd $(dirname $0) &>/dev/null
 echo "Generating bundle..."
 ./makebundle.sh
 
-export VOLUME_NAME=frogr
+volume_name=frogr
 
-if [ "$1x" = "x" ]; then
-    export DMG_FILE=$VOLUME_NAME.dmg
-else
-    export DMG_FILE=$1.dmg
+# Build the name of the DMG file
+app_version=$(cat ../configure.ac | grep AC_INIT | cut -d "[" -f 3 | cut -d "]" -f 1)
+if [ "x$app_version" = "x" ]; then
+    echo "No package version for $volume_name was found"
+    exit 1;
 fi
+dmg_filename="$volume_name-$app_version.macosx.intel.dmg"
 
-export DMG_APP=frogr.app
-export MOUNT_POINT=$VOLUME_NAME.mounted
+dmg_app=frogr.app
+mount_point=$volume_name.mounted
 
-rm -f $DMG_FILE
+rm -f $dmg_filename
 
 # Compute an approximated image size in MB, and bloat by 15 MB
-export image_size=$(du -ck $DMG_APP | tail -n1 | cut -f1)
-export image_size=$((($image_size + 15000) / 1000))
+image_size=$(du -ck $dmg_app | tail -n1 | cut -f1)
+image_size=$((($image_size + 15000) / 1000))
 
 echo "Creating disk image (${image_size}MB)..."
 cp template.dmg tmp.dmg
 hdiutil resize -size ${image_size}m tmp.dmg
 
 echo "Attaching to disk image..."
-hdiutil attach tmp.dmg -readwrite -noautoopen -mountpoint $MOUNT_POINT -quiet
+hdiutil attach tmp.dmg -readwrite -noautoopen -mountpoint $mount_point -quiet
 
 echo "Populating image..."
-cp -r $DMG_APP $MOUNT_POINT
+cp -r $dmg_app $mount_point
 
 echo "Detaching from disk image..."
-hdiutil detach $MOUNT_POINT -quiet
+hdiutil detach $mount_point -quiet
 
 echo "Converting to final image..."
-hdiutil convert -quiet -format UDBZ -o $DMG_FILE tmp.dmg
+hdiutil convert -quiet -format UDBZ -o $dmg_filename tmp.dmg
 rm tmp.dmg
 
 echo "Done."



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]