Changed files:
browser-plugins-update.sh -> 1.4
#!/bin/sh
# Author: Elan Ruusamäe <glen@pld-linux.org>
#!/bin/sh
# Author: Elan Ruusamäe <glen@pld-linux.org>
-# Date: 2006-09-13
-# See more browser-plugins.README
-
+# Date: 2006-09-13, Initial revision
+# Date: 2006-10-31, Added arch checking
+#
+# For more information see browser-plugins.README
+#
-# - implement blacklist.d/anyfile-browser.arch.blacklist support
-# - check not to link amd64 plugins to opera.i386 dir
sysconfdir='/etc/browser-plugins'
browsersdir="$sysconfdir/browsers.d"
sysconfdir='/etc/browser-plugins'
browsersdir="$sysconfdir/browsers.d"
+# bool arch_compatible(char *browser, char *plugindir)
+# returns true if browser and plugindir are from same arch
+arch_compatible() {
+ local browser="$1"
+ local plugindir="$2"
+
+ if ([[ "$browser" = *.x86_64 ]] && [[ "$plugindir" != */lib64/* ]]) || \
+ ([[ "$browser" != *.x86_64 ]] && [[ "$plugindir" = */lib64/* ]]); then
+ echo >&3 " $browser not compatible with $plugindir"
+ return 1
+ fi
+ return 0
+}
+
# bool blacklisted(char *browser, char *pluginfile)
# returns true if pluginfile is blacklisted for browser
# bool blacklisted(char *browser, char *pluginfile)
# returns true if pluginfile is blacklisted for browser
+# returns also true if pluginfile is from incompatible arch
blacklisted() {
local browser="$1"
local pluginfile="$2"
blacklisted() {
local browser="$1"
local pluginfile="$2"
local dir
dir=$(readlink "$browsersdir/$browser")
if [ -z "$dir" ]; then
local dir
dir=$(readlink "$browsersdir/$browser")
if [ -z "$dir" ]; then
- echo >&2 "$0: browser plugin dir empty for $browser; exiting!"
+ echo >&2 "$0: ERROR: browser plugin dir pointing to nowhere for $browser!"
+# kill dead links to plugins from browser dirs.
+# dead links appear if plugin is removed or if newer plugin version no longer
+# includes previously packaged file
for browser in $browsers; do
find $(browserplugindir "$browser") -type l | while read link; do
for browser in $browsers; do
find $(browserplugindir "$browser") -type l | while read link; do
- [ -f "$link" ] || rm -f "$link"
+ if [ ! -f "$link" ]; then
+ echo "Removing $link"
+ rm -f "$link"
+ fi
echo >&3 " check $pluginfile for $browser"
browserplugindir=$(browserplugindir "$browser")
link="$browserplugindir/$pluginfile"
echo >&3 " check $pluginfile for $browser"
browserplugindir=$(browserplugindir "$browser")
link="$browserplugindir/$pluginfile"
+
+ if ! arch_compatible "$browser" "$plugindir"; then
+ continue
+ fi
+
if blacklisted "$browser" "$pluginfile"; then
# just in case unlink it
if [ -f "$link" ]; then
if blacklisted "$browser" "$pluginfile"; then
# just in case unlink it
if [ -f "$link" ]; then
else
# skip existing links
[ ! -L $link ] || continue
else
# skip existing links
[ ! -L $link ] || continue
+ if [[ "$pluginfile" = */* ]]; then
+ # FIXME: what's the proper handling for this?
+ echo >&2 "$0: Warning: pluginfile $pluginfile includes subdir, file ignored"
+ continue
+ fi
echo "Installing $pluginfile to $browserplugindir"
ln -s "$plugindir/$pluginfile" "$link"
fi
echo "Installing $pluginfile to $browserplugindir"
ln -s "$plugindir/$pluginfile" "$link"
fi