[thunderbird] Refactor the langpack symlink creation stuff at startup
Christopher Aillon
caillon at fedoraproject.org
Sat Apr 2 04:51:46 UTC 2011
commit 79e360fca384b40c93b3b4d6c0d63bd85a71ddf6
Author: Christopher Aillon <caillon at redhat.com>
Date: Sat Mar 12 20:16:49 2011 -0800
Refactor the langpack symlink creation stuff at startup
We try to create a symlink for the short locale first if we can,
and then try the longer locale. The code to do this is extremely
similar, so create a bash function to do the work for each.
thunderbird.sh.in | 32 +++++++++++++-------------------
1 files changed, 13 insertions(+), 19 deletions(-)
---
diff --git a/thunderbird.sh.in b/thunderbird.sh.in
index 0630fd3..cf8d3ec 100644
--- a/thunderbird.sh.in
+++ b/thunderbird.sh.in
@@ -99,26 +99,20 @@ if [ $MOZILLA_DOWN -ne 0 ]; then
SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g"`
MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g"`
- # Try to link global langpacks to an extension directory
- if [ -f $MOZ_LANGPACKS_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org/chrome/$SHORTMOZLOCALE.jar ]; then
- if [ -d $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org ]; then
- rmdir "$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org" > /dev/null 2>&1
- fi
- if ! [ -e $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org ]; then
- ln -s $MOZ_LANGPACKS_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org \
- $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org
- echo "$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org" > $FEDORA_LANGPACK_CONFIG
+ function create_langpack_link() {
+ local language=$*
+ local langpack=langpack-${language}@thunderbird.mozilla.org
+ if [ -f $MOZ_LANGPACKS_DIR/$langpack/chrome.manifest ]; then
+ rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
+ ln -s $MOZ_LANGPACKS_DIR/$langpack \
+ $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
+ echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $FEDORA_LANGPACK_CONFIG
+ return 0
fi
- elif [ -f $MOZ_LANGPACKS_DIR/langpack-${MOZLOCALE}@thunderbird.mozilla.org/chrome/$MOZLOCALE.jar ]; then
- if [ -d $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${MOZLOCALE}@thunderbird.mozilla.org ]; then
- rmdir "$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${MOZLOCALE}@thunderbird.mozilla.org" > /dev/null 2>&1
- fi
- if ! [ -e $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${MOZLOCALE}@thunderbird.mozilla.org ]; then
- ln -s $MOZ_LANGPACKS_DIR/langpack-${MOZLOCALE}@thunderbird.mozilla.org \
- $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${MOZLOCALE}@thunderbird.mozilla.org
- echo "$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${MOZLOCALE}@thunderbird.mozilla.org" > $FEDORA_LANGPACK_CONFIG
- fi
- fi
+ return 1
+ }
+
+ create_langpack_link $SHORTMOZLOCALE || create_langpack_link $MOZLOCALE || true
fi
exec $MOZ_PROGRAM "$@"
More information about the scm-commits
mailing list