equal
deleted
inserted
replaced
1 #! /bin/sh |
|
2 # Copyright (c) 2008 Wolfgang Rosenauer. All rights reserved. |
|
3 # |
|
4 |
|
5 # check if we are started as root |
|
6 # only one of UID and USER must be set correctly |
|
7 if test "$UID" != 0 -a "$USER" != root; then |
|
8 echo "You must be root to start $0." |
|
9 exit 1 |
|
10 fi |
|
11 |
|
12 PREFIX="%PROGDIR" |
|
13 |
|
14 # dictionaries |
|
15 MYSPELL=/usr/share/myspell |
|
16 MOZ_SPELL=$PREFIX/dictionaries |
|
17 if [ -d $MOZ_SPELL ] ; then |
|
18 if [ -d $MYSPELL ] ; then |
|
19 for dict in $MYSPELL/??[-_]??.aff ; do |
|
20 |
|
21 # check is it is really the file or it is a string which contain '??_??' |
|
22 if ! [ -e $dict ] ; then |
|
23 continue |
|
24 fi |
|
25 |
|
26 # the dict file name |
|
27 dict_file=`echo ${dict##*/}` |
|
28 |
|
29 # the dict file has a valid name |
|
30 lang=`echo ${dict_file:0:2}` |
|
31 country=`echo ${dict_file:3:2}` |
|
32 |
|
33 # check for .dic file |
|
34 if [ ! -r $MYSPELL/${lang}[-_]${country}.dic ] ; then |
|
35 continue |
|
36 fi |
|
37 |
|
38 # create links |
|
39 if [ ! -r $MOZ_SPELL/${lang}[-_]${country}.aff ] ; then |
|
40 ln -sf $MYSPELL/${lang}[-_]${country}.aff \ |
|
41 $MOZ_SPELL/${lang}-${country}.aff |
|
42 fi |
|
43 if [ ! -r $MOZ_SPELL/${lang}[-_]${country}.dic ] ; then |
|
44 ln -sf $MYSPELL/${lang}[-_]${country}.dic \ |
|
45 $MOZ_SPELL/${lang}-${country}.dic |
|
46 fi |
|
47 done |
|
48 echo "-> added myspell dictionaries" |
|
49 fi |
|
50 |
|
51 # remove broken links |
|
52 for dict in $MOZ_SPELL/*.{aff,dic} ; do |
|
53 if ! [ -r $dict ] ; then |
|
54 rm -f $dict |
|
55 fi |
|
56 done |
|
57 fi |
|