3 # thunderbrand3 - a script to brand Thunderbird 3.0 without recompilation
5 # Based on firebrand script from http://bbs.archlinux.org/viewtopic.php?id=44320
6 # and thunderbrand script from archlinux-fr repository
8 # Currently works for en-US locale. Modifications are necessary for other locales.
10 # This script replaces and changes (a few) files in an existing Thunderbird
11 # installation. Run it after a Thunderbird installation or upgrade, and restart
12 # Thunderbird. The program icon may not be (visibly) replaced until your desktop
13 # environment is restarted.
15 # To revert to the original brand, simply reinstall Thunderbird.
17 # Dependencies: wget, unzip, zip
20 THUNDERBIRDDIR
="" # Where Thunderbird's data files resides. Usually something like /usr/lib/thunderbird-3.0.
21 # If empty, autodetection is attempted.
22 NEWICONSDIR
="" # If empty, the script uses a temporary directory for the replacement icons.
23 # If you want to avoid downloading the icons every time you rebrand Thunderbird,
24 # point NEWICONSDIR to a suitable directory.
25 SOURCEBASE
="http://mxr.mozilla.org/comm-1.9.1/source/other-licenses/branding/thunderbird" # The URL under which the branding directory resides.
29 echo "This script must be launched as root to work."
50 if [ -e "$NEWICONSDIR/$ICON" ] ; then
51 if [ -f "$NEWICONSDIR/$ICON" ] ; then
55 die
1 " is present but is not a file. Quitting."
59 echo -n ": Downloading... "
60 if wget
-q -O - "${SOURCEBASE}${SOURCEFILE}" > "$NEWICONSDIR/$ICON" ; then
70 for EXEC
in wget
unzip zip ; do
71 if ! which $EXEC > /dev
/null
2>&1 ; then
72 die
1 "This script requires $EXEC to work."
78 if [ "x$THUNDERBIRDDIR" == "x" ] ; then
79 THUNDERBIRDDIR
=$
(ls -1d /usr
/lib
/thunderbird-
* |
sort |
tail -1)
81 if [ "x$THUNDERBIRDDIR" == "x" ] ; then
82 die
1 "Could not find the Thunderbird data directory."
85 echo "Thunderbird data directory is ${THUNDERBIRDDIR}."
88 if [ ! -d "$THUNDERBIRDDIR" ] ; then
89 die
1 "$THUNDERBIRDDIR is not a directory."
92 CHROMEDIR
=$THUNDERBIRDDIR/chrome
# Simply the Thunderbird chrome directory.
96 TEMPDIR
=$
(mktemp
-d -t thunderbrand-XXXXXXXX
)
98 if [ $?
-ne 0 ] ; then
99 die
1 "Could not create temporary work directory."
102 if [ "x$NEWICONSDIR" == "x" ] ; then
103 NEWICONSDIR
=$
(mktemp
-d -t firebrand-icon-XXXXXXXX
)
105 if [ $?
-ne 0 ] ; then
106 die
1 "Could not create temporary icon directory."
109 [ -e "$NEWICONSDIR" ] || mkdir
-p "$NEWICONSDIR" || die
1 "Could not create icon directory $NEWICONSDIR."
114 echo -e "\033[1mChecking replacement icons\033[0m"
115 get_icon
"about-credits.png" "/content/about-credits.png?raw=1"
116 get_icon
"about.png" "/content/about.png?raw=1"
117 get_icon
"icon48.png" "/content/icon48.png?raw=1"
118 get_icon
"icon64.png" "/content/icon64.png?raw=1"
119 get_icon
"default16.png" "/mailicon16.png?raw=1"
120 get_icon
"default22.png" "/mailicon22.png?raw=1"
121 get_icon
"default24.png" "/mailicon24.png?raw=1"
122 get_icon
"default32.png" "/mailicon32.png?raw=1"
123 get_icon
"default48.png" "/mailicon48.png?raw=1"
124 get_icon
"default256.png" "/mailicon256.png?raw=1"
128 echo -e "\033[1mRE-BRANDING chrome/en-US.jar\033[0m"
129 echo -n " - Unzipping en-US.jar to ${TEMPDIR}... "
130 unzip -q -d "$TEMPDIR" "$CHROMEDIR/en-US.jar" locale
/branding
/brand.dtd
locale
/branding
/brand.properties
&& echo "Done." || die
1 "Could not unzip branding files."
132 sed -r -i 's_(brandShortName=)[^"]+_\1Thunderbird_g' $TEMPDIR/locale
/branding
/brand.properties
&& echo " - Successfully edited ${TEMPDIR}/locale/branding/brand.properties" || die
1 "Could not edit ${TEMPDIR}/locale/branding/brand.properties"
133 sed -r -i 's_(brandFullName=)[^"]+_\1Mozilla Thunderbird_g' $TEMPDIR/locale
/branding
/brand.properties
&& echo " - Successfully edited ${TEMPDIR}/locale/branding/brand.properties" || die
1 "Could not edit ${TEMPDIR}/locale/branding/brand.properties"
134 sed -r -i 's_(vendorShortName=)[^"]+_\1Mozilla_g' $TEMPDIR/locale
/branding
/brand.properties
&& echo " - Successfully edited ${TEMPDIR}/locale/branding/brand.properties" || die
1 "Could not edit ${TEMPDIR}/locale/branding/brand.properties"
135 sed -r -i 's_(brandShortName[ \t]+)"[^"]+"_\1"Thunderbird"_g' $TEMPDIR/locale
/branding
/brand.dtd
&& echo " - Successfully edited ${TEMPDIR}/locale/branding/brand.dtd" || die
1 "Could not edit file ${TEMPDIR}/locale/branding/brand.dtd"
136 sed -r -i 's_(brandFullName[ \t]+)"[^"]+"_\1"Mozilla Thunderbird"_g' $TEMPDIR/locale
/branding
/brand.dtd
&& echo " - Successfully edited ${TEMPDIR}/locale/branding/brand.dtd" || die
1 "Could not edit file ${TEMPDIR}/locale/branding/brand.dtd"
137 sed -r -i 's_(vendorShortName[ \t]+)"[^"]+"_\1"Mozilla"_g' $TEMPDIR/locale
/branding
/brand.dtd
&& echo " - Successfully edited ${TEMPDIR}/locale/branding/brand.dtd" || die
1 "Could not edit file ${TEMPDIR}/locale/branding/brand.dtd"
139 echo " - Replacing branding files in en-US.jar"
140 ( cd $TEMPDIR && zip -q -r "$CHROMEDIR/en-US.jar" locale
/branding
/* )
144 echo -e "\033[1mRE-BRANDING chrome/messenger.jar\033[0m"
145 echo " - Replacing branded icons in messenger.jar"
146 mkdir
-p "$TEMPDIR/content/branding"
147 cp "$NEWICONSDIR"/{about-credits.png
,about.png
,icon48.png
,icon64.png
} "$TEMPDIR/content/branding/"
148 ( cd $TEMPDIR && zip -q -r "$CHROMEDIR/messenger.jar" content
/branding
/* )
152 echo -e "\033[1mRE-BRANDING defaults/pref/all-thunderbird.js\033[0m"
153 sed -r -i 's_^(pref\("general.useragent.extra.thunderbird", ")[^/]+(/.*"\);[ \t]*)$_\1Thunderbird\2_' $THUNDERBIRDDIR/defaults
/pref
/all-thunderbird.js
&& echo " - Successfully edited $THUNDERBIRDDIR/defaults/pref/all-thunderbird.js" || die
1 "Could not edit $THUNDERBIRDDIR/defaults/pref/all-thunderbird.js"
157 echo -e "\033[1mRE-BRANDING thunderbird\033[0m"
158 sed -i 's|Shredder|Thunderbird|g' $THUNDERBIRDDIR/thunderbird
&& echo " - Successfully edited $THUNDERBIRDDIR/thunderbird" || die
1 "Could not edit $THUNDERBIRDDIR/thunderbird"
162 echo -e "\033[1mReplacing icons...\033[0m"
163 cp "$NEWICONSDIR"/{default16.png
,default22.png
,default24.png
,default32.png
,default48.png
,default256.png
} $THUNDERBIRDDIR/chrome
/icons
/default
/
164 cp "$NEWICONSDIR/icon64.png" /usr
/share
/pixmaps
/thunderbird.png
165 chmod 644 /usr
/share
/pixmaps
/thunderbird.png
166 chown root
:root
/usr
/share
/pixmaps
/thunderbird.png