should be good to bootstrap skeletons once and for good
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 15 Mar 2011 13:33:29 +0000 (14:33 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 15 Mar 2011 13:33:29 +0000 (14:33 +0100)
including the background image

macos/build-dmg.sh

index 2ca5260..836e062 100755 (executable)
@@ -52,14 +52,14 @@ function git_retrieve () {
     giturl=$(git_url $gitpath)
     gittag=$(git_tag $gitpath)
     if [ -z "$filemode" ] ; then
     giturl=$(git_url $gitpath)
     gittag=$(git_tag $gitpath)
     if [ -z "$filemode" ] ; then
-       [ -d $dest ] || mkdir -p $dest
-       pushd $dest
+       [ -d "$dest" ] || mkdir -p "$dest"
+       pushd "$dest" >& /dev/null
        git archive --remote=${giturl} ${gittag} | tar -xf - ${path}
        git archive --remote=${giturl} ${gittag} | tar -xf - ${path}
-       popd
+       popd >& /dev/null
     else
     else
-       destdir=$(dirname $dest)
-       [ -d $destdir ] || mkdir -p $destdir
-       git archive --remote=${giturl} ${gittag} | tar -xOf - ${path} > ${dest}
+       destdir=$(dirname "$dest")
+       [ -d "$destdir" ] || mkdir -p "$destdir"
+       git archive --remote=${giturl} ${gittag} | tar -xOf - ${path} > "${dest}"
     fi
 }
 
     fi
 }
 
@@ -85,7 +85,8 @@ function package () {
     img_name=${sface_release}-${sfa_release}-${arch}
     img_dmg=./${img_name}.dmg
     img_raw_dmg=./${img_name}.raw.dmg
     img_name=${sface_release}-${sfa_release}-${arch}
     img_dmg=./${img_name}.dmg
     img_raw_dmg=./${img_name}.raw.dmg
-    img_mnt="/Volumes/${img_name}"
+    img_mnt_name="sface ($arch)"
+    img_mnt="/Volumes/${img_mnt_name}"
 
     # check we're clear
     [ -f $img_dmg ] && die "output dmg $img_dmg already exists"
 
     # check we're clear
     [ -f $img_dmg ] && die "output dmg $img_dmg already exists"
@@ -117,11 +118,13 @@ Also make sure to trash the current one before retrying"
     [ -d "$img_mnt" ] && die "Image already mounted on $img_mnt"
 
     echo "Initializing image ..."
     [ -d "$img_mnt" ] && die "Image already mounted on $img_mnt"
 
     echo "Initializing image ..."
-    hdiutil create -quiet -size $DISK_SIZE -fs HFS -volname ${img_name} $img_raw_dmg 
-    hdiutil attach -readwrite -mount required $img_raw_dmg 
-
+    hdiutil create -quiet -size $DISK_SIZE -fs HFS -volname "${img_mnt_name}" $img_raw_dmg 
+    hdiutil attach -readwrite -mount required "$img_raw_dmg"
+    
     # copy skeleton as-is
     # copy skeleton as-is
-    tar -C "$skel_mnt" --exclude .Trashes -cf - . | tar -C "$img_mnt" -xf -
+    echo "Populating from  skeleton.."
+    ( cd "$skel_mnt" ; find . 2> /dev/null | cpio --quiet -c -o) | ( cd "$img_mnt" ; cpio -diu )
+
     # places relative to mount point
     app=sface.app
     # xxx tmp
     # places relative to mount point
     app=sface.app
     # xxx tmp
@@ -133,9 +136,9 @@ Also make sure to trash the current one before retrying"
     # 
     resource_path=$app/Contents/Resources
     bin_path=$app/Contents/MacOS
     # 
     resource_path=$app/Contents/Resources
     bin_path=$app/Contents/MacOS
-    icon_path=$app/Contents/Resources/
-    background_path=background
+
     # retrieve sfa/sfa and sface/sface in the image
     # retrieve sfa/sfa and sface/sface in the image
+    rm -rf "$img_mnt"/$resource_path/{sfa,sface}
     git_retrieve $sfa_GITPATH sfa "$img_mnt"/$resource_path/
     git_retrieve $sface_GITPATH sface "$img_mnt"/$resource_path/
     # copy binaries from sface to the bin dir
     git_retrieve $sfa_GITPATH sfa "$img_mnt"/$resource_path/
     git_retrieve $sface_GITPATH sface "$img_mnt"/$resource_path/
     # copy binaries from sface to the bin dir
@@ -143,20 +146,20 @@ Also make sure to trash the current one before retrying"
        # don't use the --file mode as this loses the executable bit
        git_retrieve $sface_GITPATH $bin "$img_mnt"/$bin_path
     done
        # don't use the --file mode as this loses the executable bit
        git_retrieve $sface_GITPATH $bin "$img_mnt"/$bin_path
     done
-    # install background and app icons
-#    git_retrieve --file $sface_GITPATH macos/graphic-install-background.png "$img_mnt"/$background_path/background.png
-    git_retrieve --file $sface_GITPATH macos/graphic-install-background.png "$img_mnt"/.background.png
-    git_retrieve --file $sface_GITPATH macos/graphic-sfa.icns "$img_mnt"/$icon_path/appIcon.icns
-    # the volume icons
-    git_retrieve --file $sface_GITPATH macos/graphic-vol-sface.icns "$img_mnt"/.VolumeIcon.icns
+
+    ### install background and app icons
+    # clean up any 'background' dir if exists
+    rm -rf "$img_mnt"/{,.}background 
+    git_retrieve --file $sface_GITPATH macos/graphic-install-background.png "$img_mnt"/.background/background.png
+    git_retrieve --file $sface_GITPATH macos/graphic-sfa.icns "$img_mnt"/$resource_path/appIcon.icns
+    # the volume icons won't work - who cares
+#    git_retrieve --file $sface_GITPATH macos/graphic-vol-sface.icns "$img_mnt"/.background/volumeIcon.icns
+#    git_retrieve --file $sface_GITPATH macos/graphic-vol-sface.png "$img_mnt"/.background/volumeIcon.png
 
     # instantiate version
     sed -e "s,@VERSIONTAG@,$sfa_release,g" -e "s,@SCMURL@,${sfa_GITPATH},g" \
        "$img_mnt"/$resource_path/sfa/util/version.py.in > "$img_mnt"/$resource_path/sfa/util/version.py
 
 
     # instantiate version
     sed -e "s,@VERSIONTAG@,$sfa_release,g" -e "s,@SCMURL@,${sfa_GITPATH},g" \
        "$img_mnt"/$resource_path/sfa/util/version.py.in > "$img_mnt"/$resource_path/sfa/util/version.py
 
-    # this apparently requires xcode
-    /Developer/Tools/SetFile -a V "$img_mnt"/$background_path
-
     # clean up just in case
     find "$img_mnt" -name '*pyc' | xargs rm -f
     find "$img_mnt" -name '*~' | xargs rm -f
     # clean up just in case
     find "$img_mnt" -name '*pyc' | xargs rm -f
     find "$img_mnt" -name '*~' | xargs rm -f
@@ -166,6 +169,9 @@ Also make sure to trash the current one before retrying"
        read _
     fi
 
        read _
     fi
 
+    # this apparently requires xcode
+#    /Developer/Tools/SetFile -a V "$img_mnt"/$background_path
+
     hdiutil detach "$img_mnt"
     rm -f $img_dmg
     echo "Compressing..."
     hdiutil detach "$img_mnt"
     rm -f $img_dmg
     echo "Compressing..."