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 commit is contained in:
parent
d821ca98d4
commit
79e360fca3
@ -99,26 +99,20 @@ if [ $MOZILLA_DOWN -ne 0 ]; then
|
|||||||
SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g"`
|
SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g"`
|
||||||
MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g"`
|
MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g"`
|
||||||
|
|
||||||
# Try to link global langpacks to an extension directory
|
function create_langpack_link() {
|
||||||
if [ -f $MOZ_LANGPACKS_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org/chrome/$SHORTMOZLOCALE.jar ]; then
|
local language=$*
|
||||||
if [ -d $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org ]; then
|
local langpack=langpack-${language}@thunderbird.mozilla.org
|
||||||
rmdir "$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org" > /dev/null 2>&1
|
if [ -f $MOZ_LANGPACKS_DIR/$langpack/chrome.manifest ]; then
|
||||||
fi
|
rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
|
||||||
if ! [ -e $MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org ]; then
|
ln -s $MOZ_LANGPACKS_DIR/$langpack \
|
||||||
ln -s $MOZ_LANGPACKS_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org \
|
$MOZ_EXTENSIONS_PROFILE_DIR/$langpack
|
||||||
$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org
|
echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $FEDORA_LANGPACK_CONFIG
|
||||||
echo "$MOZ_EXTENSIONS_PROFILE_DIR/langpack-${SHORTMOZLOCALE}@thunderbird.mozilla.org" > $FEDORA_LANGPACK_CONFIG
|
return 0
|
||||||
fi
|
fi
|
||||||
elif [ -f $MOZ_LANGPACKS_DIR/langpack-${MOZLOCALE}@thunderbird.mozilla.org/chrome/$MOZLOCALE.jar ]; then
|
return 1
|
||||||
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
|
create_langpack_link $SHORTMOZLOCALE || create_langpack_link $MOZLOCALE || true
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec $MOZ_PROGRAM "$@"
|
exec $MOZ_PROGRAM "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user