iteration on the dmg packager
[sface.git] / macos / build-dmg.sh
index 0144705..b901ef0 100755 (executable)
@@ -39,17 +39,28 @@ function git_tag () { echo $1 | cut -d @ -f 2 ; }
 #     git://git.onelab.eu/sface.git@sface-0.1-5 
 #     sface 
 #     /Volumes/sface-skel-sn/sface.app/Contents/Resources/
+# or, with the -f (-file) option:
+# git_retrieve -f \
+#     git://git.onelab.eu/sface.git@sface-0.1-5 
+#     macos/appIcon.icns 
+#     /Volumes/sface-skel-sn/sface.app/appIcon.icns 
 function git_retrieve () {
+    filemode=""
+    case "$1" in -f|--file) filemode=true; shift;; esac
     gitpath=$1; shift
     path=$1; shift
     dest=$1; shift
 
     giturl=$(git_url $gitpath)
     gittag=$(git_tag $gitpath)
-    [ -d $dest ] || mkdir -p $dest
-    pushd $dest >& /dev/null
-    git archive --remote=${giturl} ${gittag} | tar -xf - ${path}
-    popd
+    if [ -z "$filemode"] ; then
+       [ -d $dest ] || mkdir -p $dest
+       pushd $dest >& /dev/null
+       git archive --remote=${giturl} ${gittag} | tar -xf - ${path}
+       popd
+    else
+       git archive --remote=${giturl} ${gittag} | tar -xOf - ${path} > ${dest}
+    fi
 }
 
 function die () {
@@ -110,11 +121,13 @@ Also make sure to trash the current one before retrying"
     git_retrieve $sface_GITPATH sface $img_mnt/$resource_path/
     # copy binaries from sface to the bin dir
     for bin in sface.bin sface-run; do 
-       git_retrieve $sface_GITPATH $bin $img_mnt/$bin_path
+       git_retrieve --file $sface_GITPATH $bin $img_mnt/$bin_path/$bin
     done
     # install background and app icons
-    git_retrieve $sface_GITPATH macos/background.png $img_mnt/$background_path
-    git_retrieve $sface_GITPATH macos/appIcon.icns $img_mnt/$icon_path
+    git_retrieve --file $sface_GITPATH macos/background.png $img_mnt/$background_path/background.png
+    git_retrieve --file $sface_GITPATH macos/appIcon.icns $img_mnt/$icon_path/appIcon.icns
+    # xxx ?
+    git_retrieve --file $sface_GITPATH macos/appIcon.icns $img_mnt/.VolumeIcon.icns
 
     # this apparently requires xcode
     /Developer/Tools/SetFile -a V $img_mnt/$background_path