MozillaFirefox/add-plugins.sh.in

71 lines
1.6 KiB
Bash
Raw Normal View History

#! /bin/sh
# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany. All rights reserved.
# 2002-2003 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"
get_arch ()
{
file "$1" | sed -n 's/.*: ELF [^,]*, \([^,]*\),.*/\1/p'
}
mozilla_arch=`get_arch $PREFIX/$MOZ_APP-bin`
mozilla_lib=`file $PREFIX/$MOZ_APP-bin | awk '{ print $3 }'`
JAVA_CHECK_PATH="/usr/lib /usr/java"
JAVA_ORDER="mozilla ns7 ns610 [Ss]un IBM BEA"
case $mozilla_lib in
64-bit)
LIB=lib64
;;
*)
LIB=lib
;;
esac
find_java ()
{
TMP=$(find $JAVA_CHECK_PATH -name "$1" -type f)
for i in $TMP; do
if [ "`get_arch $i`" = "$mozilla_arch" ]; then
PLUGIN="$PLUGIN $i"
fi
done
TMP=""
}
# JAVA
if [ ! -L $PREFIX/plugins/libjavaplugin_oji.so ] ||
[ ! -f $PREFIX/plugins/libjavaplugin_oji.so ] ; then # link is here and valid
PLUGIN=""
find_java *javaplugin_oji.so
find_java *javaplugin_ojigcc3.so # IBMJava
if [ "$PLUGIN" ]; then
for i in $PLUGIN; do
if [[ $i == *mozilla* ]] || [[ $i == *gcc3* ]] || [[ $i == *ns7/* ]]; then
TMP=$i
break
fi
done
fi
if [ "$TMP" ]; then
PLUGIN=$TMP
ln -sf $PLUGIN $PREFIX/plugins/libjavaplugin_oji.so
echo "-> added Java2 plugin ($PLUGIN)"
else
echo "-> Java2: no change (no suitable JRE available)"
fi
else
echo "-> Java2: no change (existing link is valid)"
fi