MozillaFirefox/add-plugins.sh.in
author Wolfgang Rosenauer <wr@rosenauer.org>
Wed, 21 Nov 2012 19:04:48 +0100
changeset 585 5a44d417c9b5
parent 262 b680975515e0
permissions -rw-r--r--
prepare for Beta 18 phase
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
262
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
#! /bin/sh
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
# Copyright (c) 2008 Wolfgang Rosenauer.  All rights reserved.
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
#
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
# check if we are started as root
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
# only one of UID and USER must be set correctly
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
if test "$UID" != 0 -a "$USER" != root; then
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
    echo "You must be root to start $0."
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
    exit 1
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
fi
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
PREFIX="%PROGDIR"
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
# dictionaries
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
MYSPELL=/usr/share/myspell
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
MOZ_SPELL=$PREFIX/dictionaries
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
if [ -d $MOZ_SPELL ] ; then
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
  if [ -d $MYSPELL ] ; then
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
    for dict in $MYSPELL/??[-_]??.aff ; do
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
      # check is it is really the file or it is a string which contain '??_??'
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
      if ! [ -e $dict ] ; then
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
        continue
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
      fi
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
      # the dict file name
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
      dict_file=`echo ${dict##*/}`
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
      # the dict file has a valid name
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
      lang=`echo ${dict_file:0:2}`
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
      country=`echo ${dict_file:3:2}`
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
      
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
      # check for .dic file
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
      if [ ! -r $MYSPELL/${lang}[-_]${country}.dic ] ; then
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
        continue
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
      fi
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
      # create links
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
      if [ ! -r $MOZ_SPELL/${lang}[-_]${country}.aff ] ; then
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
        ln -sf $MYSPELL/${lang}[-_]${country}.aff \
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
               $MOZ_SPELL/${lang}-${country}.aff
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
      fi      
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
      if [ ! -r $MOZ_SPELL/${lang}[-_]${country}.dic ] ; then
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
        ln -sf $MYSPELL/${lang}[-_]${country}.dic \
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    45
               $MOZ_SPELL/${lang}-${country}.dic
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
      fi      
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
    done
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
    echo "-> added myspell dictionaries"
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
  fi
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    51
  # remove broken links
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
  for dict in $MOZ_SPELL/*.{aff,dic} ; do
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    53
    if ! [ -r $dict ] ; then
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    54
      rm -f $dict
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
    fi
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
  done
b680975515e0 probably last working Firefox-on-xulrunner build
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
fi