|
Revision 1, 1.0 kB
(checked in by mjoc, 2 years ago)
|
Initial import.
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
#!/bin/bash |
|---|
| 2 |
|
|---|
| 3 |
# OpenDict Plugin installation helper script |
|---|
| 4 |
# Copyright (c) 2005 Martynas Jocius <mjoc at akl.lt> |
|---|
| 5 |
# |
|---|
| 6 |
# With this script one can install OpenDict plugins without using |
|---|
| 7 |
# OpenDict itself. This may be handy for installing plugins from |
|---|
| 8 |
# scripts or other automatic method. |
|---|
| 9 |
|
|---|
| 10 |
PLUGINDIR=/home/`id -un`/.opendict/plugins |
|---|
| 11 |
|
|---|
| 12 |
if [ ! $1 ] |
|---|
| 13 |
then |
|---|
| 14 |
echo "OpenDict plugin installation helper" |
|---|
| 15 |
echo "Copyright (c) 2005 Martynas Jocius <mjoc at akl.lt>" |
|---|
| 16 |
echo |
|---|
| 17 |
echo "Usage: $0 <plugin> [--global]" |
|---|
| 18 |
echo |
|---|
| 19 |
echo " --global Install plugin globally to /usr/share/opendict" |
|---|
| 20 |
exit 1 |
|---|
| 21 |
fi |
|---|
| 22 |
|
|---|
| 23 |
if [ ! -e $1 ] |
|---|
| 24 |
then |
|---|
| 25 |
echo "Error: File '$1' does not exist" |
|---|
| 26 |
exit 1 |
|---|
| 27 |
fi |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
if [[ $2 = "--global" ]] |
|---|
| 31 |
then |
|---|
| 32 |
if [[ ! `id -u` = '0' ]] |
|---|
| 33 |
then |
|---|
| 34 |
echo "Error: You must be root (system administrator)" \ |
|---|
| 35 |
"to install globally" |
|---|
| 36 |
exit 1 |
|---|
| 37 |
fi |
|---|
| 38 |
|
|---|
| 39 |
PLUGINDIR=/usr/share/opendict/plugins |
|---|
| 40 |
fi |
|---|
| 41 |
|
|---|
| 42 |
mkdir -p $PLUGINDIR/$1 |
|---|
| 43 |
unzip -d $PLUGINDIR/$1 $1 |
|---|
| 44 |
|
|---|
| 45 |
echo "Done." |
|---|