# PURPOSE
# package a combination of sfa+sface into a snow leopard dmg install disk
#
-# NOTES
-# we leverage the first similar packaging initially made by Baris Metin
-#
# REQUIREMENTS
# sface-skel-snow-leopard<arch>.dmg is the skeleton that has Qt and all the other third-party software
# it is expected to be found in the local directory
# in order to retrieve the corresponding code and to label the resulting package properly
# alternatively, a build-dir and tags file can be used instead
+# NOTES
+# we initially leveraged the first similar packaging initially made by Baris Metin
+# as of sface-0.1-9 we have bootstrapped our own skeleton images,
+# i.e. you can use vn as a skeleton for vn+1
+# about that, the way the background image gets (or not) found
+# on the final system is as follows
+# before compressing the image, you should open the image through the finder
+# and tweak it, as described in http://el-tramo.be/guides/fancy-dmg
+# that's the raison d'ĂȘtre for the -i option
+# basically: open two finder windows, one on the .backgrounf dir (use cmd-shift G)
+# and one on the image itself; then using Finder->view->show view options
+# drag the background image as appropriate
+# the important point being that the filename for the background must
+# exist - and so be the same - on the target system.
+# that's why the image 'volname' is constant across versions
+
# the place to search for the skeleton
SKEL_REPO=http://mirror.onelab.eu/third-party
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}
- popd
+ popd >& /dev/null
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
}
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"
[ -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
- 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
#
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
+ 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
# 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
- # 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