File add-plugins.sh.in of Package MozillaFirefox (Revision bea82dc14bd43d9eb6099000a0cccceb)
Currently displaying revision bea82dc14bd43d9eb6099000a0cccceb, show latest
1
#! /bin/sh
2
# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany. All rights reserved.
3
# 2002-2003 SuSE Linux AG, Nuernberg, Germany
4
# 2005 SUSE Linux Products GmbH, Nuernberg, Germany
5
# 2007 Wolfgang Rosenauer <wr@rosenauer.org>
6
#
7
8
# check if we are started as root
9
# only one of UID and USER must be set correctly
10
if test "$UID" != 0 -a "$USER" != root; then
11
echo "You must be root to start $0."
12
exit 1
13
fi
14
15
PREFIX="%PROGDIR"
16
MOZ_APP="%APPNAME"
17
JAVA="%JAVA"
18
19
get_arch ()
20
{
21
file "$1" | sed -n 's/.*: ELF [^,]*, \([^,]*\),.*/\1/p'
22
}
23
24
mozilla_arch=`get_arch $PREFIX/$MOZ_APP-bin`
25
mozilla_lib=`file $PREFIX/$MOZ_APP-bin | awk '{ print $3 }'`
26
27
JAVA_CHECK_PATH="/usr/lib /usr/java"
28
JAVA_ORDER="mozilla ns7 ns610 [Ss]un IBM BEA"
29
case $mozilla_lib in
30
64-bit)
31
LIB=lib64
32
;;
33
*)
34
LIB=lib
35
;;
36
esac
37
38
find_java ()
39
{
40
TMP=$(find $JAVA_CHECK_PATH -name "$1" -type f)
41
for i in $TMP; do
42
if [ "`get_arch $i`" = "$mozilla_arch" ]; then
43
PLUGIN="$PLUGIN $i"
44
fi
45
done
46
TMP=""
47
}
48
49
# JAVA
50
if [ $JAVA -eq 1 ]; then
51
if [ ! -L $PREFIX/plugins/libjavaplugin_oji.so ] ||
52
[ ! -f $PREFIX/plugins/libjavaplugin_oji.so ] ; then # link is here and valid
53
PLUGIN=""
54
find_java *javaplugin_oji.so
55
find_java *javaplugin_ojigcc3.so # IBMJava
56
if [ "$PLUGIN" ]; then
57
for i in $PLUGIN; do
58
if [[ $i == *mozilla* ]] || [[ $i == *gcc3* ]] || [[ $i == *ns7/* ]]; then
59
TMP=$i
60
break
61
fi
62
done
63
fi
64
if [ "$TMP" ]; then
65
PLUGIN=$TMP
66
ln -sf $PLUGIN $PREFIX/plugins/libjavaplugin_oji.so
67
echo "-> added Java2 plugin ($PLUGIN)"
68
else
69
echo "-> Java2: no change (no suitable JRE available)"
70
fi
71
else
72
echo "-> Java2: no change (existing link is valid)"
73
fi
74
fi
75
76
# MySPELL
77
MYSPELL=/usr/share/myspell
78
MOZ_SPELL=$PREFIX/dictionaries
79
if [ -d $MOZ_SPELL ] ; then
80
if [ -d $MYSPELL ] ; then
81
for dict in $MYSPELL/??[-_]??.aff ; do
82
83
# check is it is really the file or it is a string which contain '??_??'
84
if ! [ -e $dict ] ; then
85
continue
86
fi
87
88
# the dict file name
89
dict_file=`echo ${dict##*/}`
90
91
# the dict file has a valid name
92
lang=`echo ${dict_file:0:2}`
93
country=`echo ${dict_file:3:2}`
94
95
# check for .dic file
96
if [ ! -r $MYSPELL/${lang}[-_]${country}.dic ] ; then
97
continue
98
fi
99
100
# create links
101
if [ ! -r $MOZ_SPELL/${lang}[-_]${country}.aff ] ; then
102
ln -sf $MYSPELL/${lang}[-_]${country}.aff \
103
$MOZ_SPELL/${lang}-${country}.aff
104
fi
105
if [ ! -r $MOZ_SPELL/${lang}[-_]${country}.dic ] ; then
106
ln -sf $MYSPELL/${lang}[-_]${country}.dic \
107
$MOZ_SPELL/${lang}-${country}.dic
108
fi
109
done
110
echo "-> added myspell dictionaries"
111
fi
112
113
# remove broken links
114
for dict in $MOZ_SPELL/*.{aff,dic} ; do
115
if ! [ -r $dict ] ; then
116
rm -f $dict
117
fi
118
done
119
fi
120