Release/GrowlMail/scripts/postflight.sh
author Peter Hosey <hg@boredzo.org>
Fri Sep 11 05:52:27 2009 -0700 (2009-09-11)
changeset 4393 6328e4c4dd23
parent 4282 c4c6f65d4d31
child 4405 33214e271a53
permissions -rwxr-xr-x
Changed GrowlMail's Installer package to install to a subdirectory of /tmp, and then move these files to the correct place within the user's Home folder, as suggested by Jonathan “Wolf” Rentzsch on Twitter.

This sucks, but it appears to be the only way to overcome x-radar://problem/7215243, where Installer installs to the base of the volume that the user's Home folder is on instead of to the Home folder itself.
evands@3771
     1
#!/bin/sh
hg@4393
     2
hg@4393
     3
# Move our temporary installation into the real destination.
hg@4393
     4
mkdir -p ~/Library/Mail/Bundles
hg@4393
     5
rm -R ~/Library/Mail/Bundles/GrowlMail.mailbundle
hg@4393
     6
mv "$2/GrowlMail.mailbundle" ~/Library/Mail/Bundles
hg@4393
     7
evands@3960
     8
######
evands@3960
     9
# Note that we are running sudo'd, so these defaults will be written to
evands@3960
    10
# /Library/Preferences/com.apple.mail.plist
evands@3960
    11
#
evands@3960
    12
# Mail must NOT be running by the time this script executes
evands@3960
    13
######
evands@3961
    14
if [ `whoami` == root ] ; then
evands@3961
    15
    #defaults acts funky when asked to write to the root domain but seems to work with a full path
hg@4279
    16
	domain=/Library/Preferences/com.apple.mail
hg@4279
    17
else
hg@4279
    18
    domain=com.apple.mail
hg@4279
    19
fi
evands@3960
    20
hg@4282
    21
macosx_minor_version=$(sw_vers | /usr/bin/sed -Ene 's/.*[[:space:]]10\.([0-9][0-9]*)\.*[0-9]*/\1/p;')
hg@4282
    22
if [[ "$macosx_minor_version" == "" ]]; then
hg@4282
    23
	echo 'Unrecognized Mac OS X version!' > /dev/stderr
hg@4282
    24
	sw_vers > /dev/stderr
hg@4282
    25
elif [[ "$macosx_minor_version" -eq 5 ]]; then
hg@4282
    26
	bundle_compatibility_version=3
hg@4282
    27
else
hg@4282
    28
	bundle_compatibility_version=4
hg@4282
    29
fi
hg@4282
    30
hg@4279
    31
defaults write "$domain" EnableBundles -bool YES
evands@3961
    32
hg@4279
    33
# Mac OS X 10.5's Mail.app requires bundle version 3 or greater
hg@4282
    34
defaults write "$domain" BundleCompatibilityVersion -int "$bundle_compatibility_version"