summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Aillon <caillon@redhat.com>2011-03-12 20:16:49 -0800
committerChristopher Aillon <caillon@redhat.com>2011-03-18 15:00:19 -0700
commit36d2d050894ae5f929ff8b3afc1e9a83787ea714 (patch)
tree9d471719f71bef9b664476b65169729c8a6a6f9e
parentWe don't need to pass -UILocale (diff)
downloadlibrewolf-fedora-ff-36d2d050894ae5f929ff8b3afc1e9a83787ea714.tar.gz
librewolf-fedora-ff-36d2d050894ae5f929ff8b3afc1e9a83787ea714.tar.bz2
librewolf-fedora-ff-36d2d050894ae5f929ff8b3afc1e9a83787ea714.zip
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. This will make it easier to switch to a packed langpack extension format in the future, which will help with startup performance.
-rw-r--r--firefox.sh.in35
1 files changed, 14 insertions, 21 deletions
diff --git a/firefox.sh.in b/firefox.sh.in
index 44f87d3..656f0e4 100644
--- a/firefox.sh.in
+++ b/firefox.sh.in
@@ -191,28 +191,21 @@ if [ $MOZILLA_DOWN -ne 0 ]; then
# So that pt-BR doesn't try to use pt for example
SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g"`
MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g"`
- MANIFEST="chrome.manifest"
-
- # Try to link global langpacks to an extension directory
- if [ -f $MOZ_LANGPACKS_DIR/langpack-${SHORTMOZLOCALE}@firefox.mozilla.org/$MANIFEST ]; then
- if [ -d $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@firefox.mozilla.org ]; then
- rmdir "$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@firefox.mozilla.org" > /dev/null 2>&1
- fi
- if ! [ -e $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@firefox.mozilla.org ]; then
- ln -s $MOZ_LANGPACKS_DIR/langpack-${SHORTMOZLOCALE}@firefox.mozilla.org \
- $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@firefox.mozilla.org
- echo "$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@firefox.mozilla.org" > $FEDORA_LANGPACK_CONFIG
- fi
- elif [ -f $MOZ_LANGPACKS_DIR/langpack-${MOZLOCALE}@firefox.mozilla.org/$MANIFEST ]; then
- if [ -d $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${MOZLOCALE}@firefox.mozilla.org ]; then
- rmdir "$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${MOZLOCALE}@firefox.mozilla.org" > /dev/null 2>&1
- fi
- if ! [ -e $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${MOZLOCALE}@firefox.mozilla.org ]; then
- ln -s $MOZ_LANGPACKS_DIR/langpack-${MOZLOCALE}@firefox.mozilla.org \
- $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${MOZLOCALE}@firefox.mozilla.org
- echo "$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${MOZLOCALE}@firefox.mozilla.org" > $FEDORA_LANGPACK_CONFIG
+
+ function create_langpack_link() {
+ local language=$*
+ local langpack=langpack-${language}@firefox.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
- fi
+ return 1
+ }
+
+ create_langpack_link $SHORTMOZLOCALE || create_langpack_link $MOZLOCALE || true
fi
# Prepare command line arguments
bgstack15