Permalink
Browse files

Enhance build scripts to set custom installer icon and build dmg file

  • Loading branch information...
1 parent 4d5b7bb commit 684fbd97590516f994e3966e1839424a3df205f5 @deadprogram deadprogram committed Sep 9, 2011
Showing with 157 additions and 1 deletion.
  1. +130 −0 assign_icon.sh
  2. +8 −1 build_installer.sh
  3. BIN kidsruby.icns
  4. +19 −0 makedmg
View
@@ -0,0 +1,130 @@
+#!/bin/bash
+
+#
+# ----------------------------------------------------------------
+#
+# DESCRIPTION:
+#
+# A Script that assigns an icon to a file or a folder
+#
+# (c) Ali Rantakari, 2007
+# http://hasseg.org
+# fromassigniconscript.20.hasseg@spamgourmet.com
+#
+# ----------------------------------------------------------------
+#
+# REQUIRES:
+#
+# - OS X 10.4 (Tiger) or later
+# - Developer Tools installed (found on OS discs)
+#
+# ----------------------------------------------------------------
+#
+# Thanks to "KenFerry" for posting instructions on how to do
+# this at cocoadev.com:
+#
+# http://www.cocoadev.com/index.pl?HowToSetACustomIconWithRez
+#
+#
+
+
+
+
+
+
+
+# ----------------------------------------------------------------
+#
+# SETTINGS:
+#
+#
+
+
+# locations of CLI apps used
+#
+# system:
+#
+FILE=/usr/bin/file
+OSASCRIPT=/usr/bin/osascript
+#
+# installed with developer tools:
+#
+SETFILE=/Developer/Tools/SetFile
+REZ=/usr/bin/Rez
+
+
+
+# - - - - - - - - - - - - - - - - - - - - - -
+# settings end here.
+# ----------------------------------------------------------------
+#
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Script IMPLEMENTATION begins here ---------------------------
+# -------------------------------------------------------------
+#
+
+
+
+# see if parameters are set
+if [ -n "$1" ] || [ -n "$2" ];then
+
+ echo " "
+
+ # determine if second parameter is a file or a folder
+ if [ "`$FILE -b \"$2\"`" == "directory" ];then
+
+ echo "Assigning icon to folder \"$2\"..."
+
+ echo "read 'icns' (-16455) \"$1\";" | $REZ -o "`printf "$2/Icon\r"`"
+
+ else
+
+ echo "Assigning icon to file \"$2\"..."
+
+ echo "read 'icns' (-16455) \"$1\";" | $REZ -o "$2"
+
+ fi
+
+ $SETFILE -a "C" "$2"
+
+ echo "...done"
+ echo " "
+
+ if [ "$3" != "-r" ];then
+ echo "Telling Finder to refresh the item..."
+
+ TARGETSPATH=`dirname $2`
+ TARGETSFULLPATH="`cd $TARGETSPATH; pwd`/$2"
+
+ $OSASCRIPT -e "tell application \"Finder\" to update POSIX file \"$TARGETSFULLPATH\""
+ echo "...done"
+ echo " "
+ fi
+
+else
+
+ echo " "
+ echo "usage: `basename \"$0\"` <iconfile> <target> -r"
+ echo " "
+ echo " <iconfile> is the .icns icon you want to assign"
+ echo " <target> is the file or folder you want to"
+ echo " assign the icon to"
+ echo " "
+ echo " -r if this option is set, Finder will not be"
+ echo " told to update the target"
+ echo " "
+
+fi
View
@@ -28,10 +28,17 @@ copy_scripts() {
}
build_installer() {
- /usr/local/bin/platypus -AR -l -i '/Applications/Platypus.app/Contents/Resources/PlatypusDefault.icns' -a 'KidsRuby Installer for OSX' -o 'Progress Bar' -p '/bin/sh' -u 'The Hybrid Group + Friends' -V '0.6' -I 'org.kidsruby.installer' -f 'resources/git-1.7.6-i386-snow-leopard.dmg' -f 'resources/ruby-1.9.2-p290.universal.tar.gz' -f 'resources/yaml-0.1.4.universal.tar.gz' -f 'resources/qt-mac-opensource-4.7.3.dmg' -f 'resources/qtbindings-4.7.3-universal-darwin-10.gem' -f 'resources/kidsruby.tar.gz' -f 'resources/kidsirb.sh' -f 'resources/KidsRuby.app.tar.gz' -f "resources/gosu-0.7.36.2-universal-darwin.gem" -f "resources/htmlentities-4.3.0.gem" -f "resources/install_gems.sh" -g '#000000' -b '#ffffff' -c 'installer.sh' 'build/KidsRubyInstaller.app'
+ /usr/local/bin/platypus -AR -l -i 'kidsruby.icns' -a 'KidsRuby Installer for OSX' -o 'Progress Bar' -p '/bin/sh' -u 'The Hybrid Group + Friends' -V '0.6.1' -I 'org.kidsruby.installer' -f 'resources/git-1.7.6-i386-snow-leopard.dmg' -f 'resources/ruby-1.9.2-p290.universal.tar.gz' -f 'resources/yaml-0.1.4.universal.tar.gz' -f 'resources/qt-mac-opensource-4.7.3.dmg' -f 'resources/qtbindings-4.7.3-universal-darwin-10.gem' -f 'resources/kidsruby.tar.gz' -f 'resources/kidsirb.sh' -f 'resources/KidsRuby.app.tar.gz' -f "resources/gosu-0.7.36.2-universal-darwin.gem" -f "resources/htmlentities-4.3.0.gem" -f "resources/install_gems.sh" -g '#000000' -b '#ffffff' -c 'installer.sh' 'build/KidsRubyInstaller.app'
+}
+
+build_dmg() {
+ cd build
+ ../makedmg KidsRubyInstaller.app
+ cd ..
}
cleanup
build_launcher
copy_scripts
build_installer
+build_dmg
View
Binary file not shown.
View
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+
+# usage error
+if ARGV.length < 1 or ARGV.length > 2 then
+ $stderr.puts( "Usage: #{File.basename( $0 )} directory [cd name]" )
+ exit( 1 )
+end
+
+# get variables
+dir = ARGV.shift.sub( /\/$/, "" )
+volname = if ARGV.length == 0 then
+ File.basename( File.expand_path( dir ) )
+ else
+ ARGV.shift
+ end
+output = "#{dir}.dmg"
+
+# dmg the folder
+`hdiutil create -fs HFS+ -srcfolder "#{dir}" -volname "#{volname}" "#{output}"`

0 comments on commit 684fbd9

Please sign in to comment.