You are not logged in.
Hi, all
Prompted by firebrand I've written another piece of script which will brand thunderbird without recompiling. Enjoy.
Thanks to Bebo, your original script helps a lot.
#!/bin/sh
#
# thunderbrand a script to brand thunderbird without recompilation
#
# NOTE 1: It has only been tested on Thunderbird 2.x.
# NOTE 2: It will only work on "Mail/News" branded thunderbirds.
#
# This script replaces and changes (a few) files in an existing thunderbird
# installation. Run it after a thunderbird installation or upgrade, and restart
# thunderbird. The program icon may not be (visibly) replaced until your desktop
# environment is restarted.
#
# To revert to the original Mail/News brand, simply reinstall thunderbird.
#
# Dependencies: curl, zip, unzip, imagemagick
#
THUNDERBIRDDIR=/usr/lib/thunderbird # Where thunderbird's data files resides.
NEWICONSDIR="" # If empty, the script uses a temporary directory for the replacement icons.
# If you want to avoid downloading the icons every time you rebrand thunderbird,
# point NEWICONSDIR to a suitable directory.
SOURCEBASE="http://lxr.mozilla.org/seamonkey/source" # The URL under which the "other-licenses" directory resides.
CHROMEDIR=$THUNDERBIRDDIR/chrome # Simply the thunderbird chrome directory.
die() {
EXITCODE="${1:-9}"
MESSAGE="$2"
echo -e "\n$MESSAGE"
exit $EXITCODE
}
get_icon() {
local ICON="$1"
local SOURCEFILE="$2"
echo -n " - $ICON"
if [ -e "$NEWICONSDIR/$ICON" ] ; then
if [ -f "$NEWICONSDIR/$ICON" ] ; then
echo " is present."
return 0
else
echo " is present but is not a file. Quitting."
exit 1
fi
fi
echo -n ": Downloading... "
if curl -sS "${SOURCEBASE}${SOURCEFILE}" > "$NEWICONSDIR/$ICON" ; then
echo "Done."
return 0
else
exit 1
fi
}
TEMPDIR=$(mktemp -d -t thunderbrand-work-XXXXXXXX)
if [ $? -ne 0 ] ; then
die 1 "Could not create temporary work directory."
fi
if [ "x$NEWICONSDIR" == "x" ] ; then
NEWICONSDIR=$(mktemp -d -t thunderbrand-icon-XXXXXXXX)
if [ $? -ne 0 ] ; then
die 1 "Could not create temporary icon directory."
fi
else
[ -e "$NEWICONSDIR" ] || mkdir -p "$NEWICONSDIR" || die 1 "Could not create icon directory $NEWICONSDIR."
fi
echo -e "\033[1mChecking replacement icons\033[0m"
get_icon "mozicon50.xpm" "/other-licenses/branding/thunderbird/mozicon50.xpm?raw=1"
get_icon "mozicon16.xpm" "/other-licenses/branding/thunderbird/mozicon16.xpm?raw=1"
get_icon "mozicon128.png" "/other-licenses/branding/thunderbird/mozicon128.png?raw=1"
get_icon "icon64.png" "/other-licenses/branding/thunderbird/content/icon64.png?raw=1"
get_icon "about-thunderbird.png" "/other-licenses/branding/thunderbird/content/about-thunderbird.png?raw=1"
get_icon "about-credits.png" "/other-licenses/branding/thunderbird/content/about-credits.png?raw=1"
get_icon "thunderbird-watermark.png" "/other-licenses/branding/thunderbird/content/aboutFooter.png?raw=1"
get_icon "thunderbird-wizard-badge.png" "/other-licenses/branding/thunderbird/content/aboutFooter.png?raw=1"
cp "$NEWICONSDIR/mozicon50.xpm" "$NEWICONSDIR/default.xpm"
echo -e "\033[1mBranding chrome/en-US.jar\033[0m"
echo -n " - Unzipping branding files in chrome/en-US.jar to temporary directory... "
unzip -q -d "$TEMPDIR" "$CHROMEDIR/en-US.jar" locale/en-US/branding/brand.dtd locale/en-US/branding/brand.properties && echo "Done." || die 1 "Failed."
for FILE in $TEMPDIR/locale/en-US/branding/* ; do
sed -i 's|Mail/News Client|Mozilla Thunderbird|g' "$FILE" && echo " - Successfully edited ${FILE}" || die 1 "Could not edit ${FILE}."
sed -i 's|Mail/News|Thunderbird|g' "$FILE" && echo " - Successfully edited ${FILE}" || die 1 "Could not edit ${FILE}."
done
echo -n " - Replacing old branding files in chrome/en-US.jar... "
( cd $TEMPDIR && zip -q -r "$CHROMEDIR/en-US.jar" locale/en-US/branding/* ) && echo "Done." || die 1 "Failed."
echo -e "\033[1mBranding chrome/messenger.jar\033[0m"
echo -n " - Making new branding icon structure in temporary directory... "
mkdir -p "$TEMPDIR/content/branding" || die 1 "Could not create $TEMPDIR/content/branding."
cp "$NEWICONSDIR"/{about-thunderbird.png,about-credits.png,thunderbird-wizard-badge.png,thunderbird-watermark.png,icon64.png} "$TEMPDIR/content/branding/" || die 1 "Could not copy new icons to $TEMPDIR/content/branding/."
echo "Done."
echo -n " - Replacing old branding icon structure in chrome/messenger.jar... "
( cd $TEMPDIR && zip -q -r "$CHROMEDIR/messenger.jar" content/branding/* ) && echo "Done." || die 1 "Failed."
echo -e "\033[1mBranding icons\033[0m"
echo -n " - Replacing chrome/icons/default/default.xpm... "
cp "$NEWICONSDIR/default.xpm" $THUNDERBIRDDIR/chrome/icons/default/ && echo "Done." || die 1 "Failed."
echo -n " - Replacing chrome/icons/default/messengerWindow.xpm... "
cp "$NEWICONSDIR/default.xpm" $THUNDERBIRDDIR/chrome/icons/default/messengerWindow.xpm && echo "Done." || die 1 "Failed."
echo -n " - Replacing chrome/icons/default/messengerWindow16.xpm... "
cp "$NEWICONSDIR/mozicon16.xpm" $THUNDERBIRDDIR/chrome/icons/default/messengerWindow16.xpm && echo "Done." || die 1 "Failed."
echo -n " - Replacing branding icons in icons/... "
cp "$NEWICONSDIR"/{default.xpm,mozicon16.xpm,mozicon50.xpm} $THUNDERBIRDDIR/icons/ && echo "Done." || die 1 "Failed."
chmod 644 \
$THUNDERBIRDDIR/chrome/icons/default/default.xpm \
$THUNDERBIRDDIR/chrome/icons/default/messengerWindow.xpm \
$THUNDERBIRDDIR/chrome/icons/default/messengerWindow16.xpm \
$THUNDERBIRDDIR/icons/*
chown root:root \
$THUNDERBIRDDIR/chrome/icons/default/default.xpm \
$THUNDERBIRDDIR/chrome/icons/default/messengerWindow.xpm \
$THUNDERBIRDDIR/chrome/icons/default/messengerWindow16.xpm \
$THUNDERBIRDDIR/icons/*
echo -n " - Replacing /usr/share/pixmaps/thunderbird.png: "
convert "$NEWICONSDIR/default.xpm" /usr/share/pixmaps/thunderbird.png && echo "Done." || die 1 "Failed."
chmod 644 /usr/share/pixmaps/thunderbird.png
chown root:root /usr/share/pixmaps/thunderbird.png
arch x86_64 on Dell E7450
Offline
This script worked like a charm, but it does not anymore with thunderbird version 2.0.0.16.
Although the script runs without error, the icons are not replaced.
Does anyone have the same problem? Or maybe even an updated script?
Offline
I've got following error :
Branding icons
- Replacing chrome/icons/default/default.xpm... Done.
- Replacing chrome/icons/default/messengerWindow.xpm... Done.
- Replacing chrome/icons/default/messengerWindow16.xpm... Done.
- Replacing branding icons in icons/... Done.
- Replacing /usr/share/pixmaps/thunderbird.png: convert: Improper image header `/tmp/thunderbrand-icon-Lq0g3bL7/default.xpm'.
convert: missing an image filename `/usr/share/pixmaps/thunderbird.png'.
Failed.
Offline
I also get this error now. Maybe the image file (.xpm) is damaged? I can't convert it manually.
Edit: I found the solution in the firebrand thread. You have to edit the "SOURCEBASE" in the thunderbrand script.
SOURCEBASE="http://mxr.mozilla.org/seamonkey/source"
is correct.
Last edited by yodo (2008-08-06 16:45:03)
Offline
You will also have to change THUNDERBIRDDIR from /usr/lib/thunderbird to /usr/lib/thunderbird-2.0
Last edited by litemotiv (2008-12-07 11:31:53)
ᶘ ᵒᴥᵒᶅ
Offline
What package is the command "convert" supposed to be in?
Offline
What package is the command "convert" supposed to be in?
$ pkgfile convert
extra/imagemagick
arch x86_64 on Dell E7450
Offline
Here is an updated script for Thunderbird 3.0. I didn't notice this thread earlier, so I based it off a combination of the firebrand script from http://bbs.archlinux.org/viewtopic.php?id=44320 and the thunderbrand script from the archlinux-fr repo.
#!/bin/bash
#
# thunderbrand3 - a script to brand Thunderbird 3.0 without recompilation
#
# Based on firebrand script from http://bbs.archlinux.org/viewtopic.php?id=44320
# and thunderbrand script from archlinux-fr repository
#
# Currently works for en-US locale. Modifications are necessary for other locales.
#
# This script replaces and changes (a few) files in an existing Thunderbird
# installation. Run it after a Thunderbird installation or upgrade, and restart
# Thunderbird. The program icon may not be (visibly) replaced until your desktop
# environment is restarted.
#
# To revert to the original brand, simply reinstall Thunderbird.
#
# Dependencies: wget, unzip, zip
#
THUNDERBIRDDIR="" # Where Thunderbird's data files resides. Usually something like /usr/lib/thunderbird-3.0.
# If empty, autodetection is attempted.
NEWICONSDIR="" # If empty, the script uses a temporary directory for the replacement icons.
# If you want to avoid downloading the icons every time you rebrand Thunderbird,
# point NEWICONSDIR to a suitable directory.
SOURCEBASE="http://mxr.mozilla.org/comm-1.9.1/source/other-licenses/branding/thunderbird" # The URL under which the branding directory resides.
echo "This script must be launched as root to work."
die () {
EXITCODE="${1:-9}"
MESSAGE="$2"
echo -e "\n$MESSAGE"
exit $EXITCODE
}
get_icon() {
local ICON="$1"
local SOURCEFILE="$2"
echo -n " - $ICON"
if [ -e "$NEWICONSDIR/$ICON" ] ; then
if [ -f "$NEWICONSDIR/$ICON" ] ; then
echo " is present."
return 0
else
die 1 " is present but is not a file. Quitting."
fi
fi
echo -n ": Downloading... "
if wget -q -O - "${SOURCEBASE}${SOURCEFILE}" > "$NEWICONSDIR/$ICON" ; then
echo "Done."
return 0
else
die 1 "Failed."
fi
}
for EXEC in wget unzip zip ; do
if ! which $EXEC > /dev/null 2>&1 ; then
die 1 "This script requires $EXEC to work."
fi
done
if [ "x$THUNDERBIRDDIR" == "x" ] ; then
THUNDERBIRDDIR=$(ls -1d /usr/lib/thunderbird-* | sort | tail -1)
if [ "x$THUNDERBIRDDIR" == "x" ] ; then
die 1 "Could not find the Thunderbird data directory."
fi
echo "Thunderbird data directory is ${THUNDERBIRDDIR}."
fi
if [ ! -d "$THUNDERBIRDDIR" ] ; then
die 1 "$THUNDERBIRDDIR is not a directory."
fi
CHROMEDIR=$THUNDERBIRDDIR/chrome # Simply the Thunderbird chrome directory.
TEMPDIR=$(mktemp -d -t thunderbrand-XXXXXXXX)
if [ $? -ne 0 ] ; then
die 1 "Could not create temporary work directory."
fi
if [ "x$NEWICONSDIR" == "x" ] ; then
NEWICONSDIR=$(mktemp -d -t firebrand-icon-XXXXXXXX)
if [ $? -ne 0 ] ; then
die 1 "Could not create temporary icon directory."
fi
else
[ -e "$NEWICONSDIR" ] || mkdir -p "$NEWICONSDIR" || die 1 "Could not create icon directory $NEWICONSDIR."
fi
echo -e "\033[1mChecking replacement icons\033[0m"
get_icon "about-credits.png" "/content/about-credits.png?raw=1"
get_icon "about.png" "/content/about.png?raw=1"
get_icon "icon48.png" "/content/icon48.png?raw=1"
get_icon "icon64.png" "/content/icon64.png?raw=1"
get_icon "default16.png" "/mailicon16.png?raw=1"
get_icon "default22.png" "/mailicon22.png?raw=1"
get_icon "default24.png" "/mailicon24.png?raw=1"
get_icon "default32.png" "/mailicon32.png?raw=1"
get_icon "default48.png" "/mailicon48.png?raw=1"
get_icon "default256.png" "/mailicon256.png?raw=1"
echo -e "\033[1mRE-BRANDING chrome/en-US.jar\033[0m"
echo -n " - Unzipping en-US.jar to ${TEMPDIR}... "
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."
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"
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"
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"
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"
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"
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"
echo " - Replacing branding files in en-US.jar"
( cd $TEMPDIR && zip -q -r "$CHROMEDIR/en-US.jar" locale/branding/* )
echo -e "\033[1mRE-BRANDING chrome/messenger.jar\033[0m"
echo " - Replacing branded icons in messenger.jar"
mkdir -p "$TEMPDIR/content/branding"
cp "$NEWICONSDIR"/{about-credits.png,about.png,icon48.png,icon64.png} "$TEMPDIR/content/branding/"
( cd $TEMPDIR && zip -q -r "$CHROMEDIR/messenger.jar" content/branding/* )
echo -e "\033[1mRE-BRANDING defaults/pref/all-thunderbird.js\033[0m"
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"
echo -e "\033[1mRE-BRANDING thunderbird\033[0m"
sed -i 's|Shredder|Thunderbird|g' $THUNDERBIRDDIR/thunderbird && echo " - Successfully edited $THUNDERBIRDDIR/thunderbird" || die 1 "Could not edit $THUNDERBIRDDIR/thunderbird"
echo -e "\033[1mReplacing icons...\033[0m"
cp "$NEWICONSDIR"/{default16.png,default22.png,default24.png,default32.png,default48.png,default256.png} $THUNDERBIRDDIR/chrome/icons/default/
cp "$NEWICONSDIR/icon64.png" /usr/share/pixmaps/thunderbird.png
chmod 644 /usr/share/pixmaps/thunderbird.png
chown root:root /usr/share/pixmaps/thunderbird.png
Offline
Here is an updated script for Thunderbird 3.0. I didn't notice this thread earlier, so I based it off a combination of the firebrand script from http://bbs.archlinux.org/viewtopic.php?id=44320 and the thunderbrand script from the archlinux-fr repo.
Thanks, worked great.
Offline
Nice. Works great.
Thanks
Jithin
Offline
big Thanks
Offline
Has anyone thought about just making a firebrand/thunderbrand package for the AUR? maybe a single package called mozbrander...?
Offline
added to AUR: http://aur.archlinux.org/packages.php?ID=34560
ceated Git repo for coding: http://github.com/Lky/thunderbrand
-
TODO: rewrite the script and maybe merge it with firebrand
Offline
Hi there,
I have a suggestion concerning the firebrand and thunderbrand scripts.
Just store in a file the name,version,installation-date of thunderbird/firefox package.
If the current version of the firefox/thunderbird mismatches, then execute the download of the icons, if not, then leave as it was.
It would ease the whole thing very much. One could add the script in to the /etc/rc.local and the firefox or thunderbird would have "propper" names...
Last edited by Liuuutas (2010-03-01 07:34:12)
Offline
Hi Liuuutas,
i had think about your future request. The idea is not so good, because is more not important code in this simple script. If you run pacman, upgrades for thunderbird showes up and then you can run manually thunderbrand if you want. Why do you need an automatic way there?
Maybe later this option will be added, after merging it to an all in one script (name: mozbrand or so). btw. rc.local way is not good, because i do not reboot my system often. Cronjob would be better there.
Last edited by Lucky (2010-03-07 04:58:35)
Offline
mhmm i wrote a new script with this feature. script need firebrand and/or thunderbrand and/or sunbrand and run as root.
change:
APPS = remove programms in APPS if you don't need it.
CHECKFILE = storage information about updates
script is not complete but working!
#!/bin/bash
CHECKFILE="checkfile.txt"
APPS="firefox thunderbird sunbird"
if [[ ${EUID} -ne 0 ]]; then
echo "This script should be run as root."
exit 1
fi
for APP in ${APPS}; do
PM_INFO="$(grep "${APP} (" /var/log/pacman.log|tail -1|sed 's/\[//; s/\].*//')"
CF_INFO="$(grep "${APP}" "${CHECKFILE}"|sed "s/ ${APP}//")"
echo "program: ${APP}"
echo "pacman: ${PM_INFO}"
echo "checkfile: ${CF_INFO}"
if [[ ${PM_INFO} == ${CF_INFO} ]]; then
echo "${APP} up to date"
else
sed -i "/${APP}/d" ${CHECKFILE}
echo -e "$(grep "${APP} (" /var/log/pacman.log|tail -1|\
sed 's/\[//; s/\].*//') ${APP}" >> ${CHECKFILE}
if [[ ${APP} == firefox ]]; then
firebrand
elif [[ ${APP} == thunderbird ]]; then
thunderbrand
elif [[ ${APP} == sunbird ]]; then
sunbrand
fi
fi
done
Last edited by Lucky (2010-03-07 12:26:35)
Offline