2007-01-15 23:49:32 +01:00
|
|
|
#! /bin/sh
|
|
|
|
# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany. All rights reserved.
|
|
|
|
# 2002-2004 SuSE Linux AG, Nuernberg, Germany
|
|
|
|
# 2005 SUSE LINUX Products GmbH, Nuernberg, Germany
|
|
|
|
#
|
|
|
|
|
|
|
|
# check if we are started as root
|
|
|
|
# only one of UID and USER must be set correctly
|
|
|
|
if test "$UID" != 0 -a "$USER" != root; then
|
|
|
|
echo "You must be root to start $0."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
PREFIX="%PROGDIR"
|
|
|
|
MOZ_APP="%APPNAME"
|
|
|
|
|
|
|
|
|
|
|
|
# MySPELL
|
|
|
|
MYSPELL=/usr/share/myspell
|
2008-10-23 22:52:20 +02:00
|
|
|
MOZ_SPELL=$PREFIX/dictionaries
|
2007-01-15 23:49:32 +01:00
|
|
|
if [ -d $MOZ_SPELL ] ; then
|
|
|
|
if [ -d $MYSPELL ] ; then
|
|
|
|
for dict in $MYSPELL/??[-_]??.aff ; do
|
|
|
|
|
|
|
|
# check is it is really the file or it is a string which contain '??_??'
|
|
|
|
if ! [ -e $dict ] ; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
# the dict file name
|
|
|
|
dict_file=`echo ${dict##*/}`
|
|
|
|
|
|
|
|
# the dict file has a valid name
|
|
|
|
lang=`echo ${dict_file:0:2}`
|
|
|
|
country=`echo ${dict_file:3:2}`
|
|
|
|
|
|
|
|
# check for .dic file
|
2008-10-23 22:52:20 +02:00
|
|
|
if [ ! -r $MYSPELL/${lang}[-_]${country}.dic ] ; then
|
2007-01-15 23:49:32 +01:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
# create links
|
|
|
|
if [ ! -r $MOZ_SPELL/${lang}[-_]${country}.aff ] ; then
|
|
|
|
ln -sf $MYSPELL/${lang}[-_]${country}.aff \
|
|
|
|
$MOZ_SPELL/${lang}-${country}.aff
|
|
|
|
fi
|
|
|
|
if [ ! -r $MOZ_SPELL/${lang}[-_]${country}.dic ] ; then
|
|
|
|
ln -sf $MYSPELL/${lang}[-_]${country}.dic \
|
|
|
|
$MOZ_SPELL/${lang}-${country}.dic
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "-> added myspell dictionaries"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# remove broken links
|
|
|
|
for dict in $MOZ_SPELL/*.{aff,dic} ; do
|
|
|
|
if ! [ -r $dict ] ; then
|
|
|
|
rm -f $dict
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|