-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtika-patch.sh
executable file
·62 lines (46 loc) · 1.05 KB
/
tika-patch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
##
## Filename: tika-patch.sh
##
## Description: Removes language detection from tika-server-1.1[78].jar to speed things up.
##
SOURCE="org/apache/tika/server/resource"
JARFILE=$1
echo "INFO: removing language detection from Apache Tika Server"
##
## ERROR CHECKING
##
if [ "a"$1 == "a" ]; then
echo "ERROR: arguments: tika-patch.sh tika-server-*.jar"
exit
fi
if [ "a"`which zip` == "a" ]; then
echo "ERROR: zip not found - please install program!"
exit
fi
JAR=`echo $JARFILE | tr "." " " | awk '{ print $NF }'`
if [ ! "a"$JAR == "ajar" ]; then
echo "ERROR: is this really a jarfile: $JARFILE ?"
exit
fi
if [ ! -f $JARFILE ]; then
echo "ERROR: $JARFILE not found!"
exit
fi
if [ ! -d $SOURCE ]; then
echo "ERROR: unable to find directory: $SOURCE"
exit
fi
##
## UPDATE JAR FILE
##
echo "INFO: updating jar-file with patched class-files ..."
cp $JARFILE $JARFILE".patched.jar"
zip -qq -u $JARFILE".patched.jar" $SOURCE/*.class
##
## DONE
##
echo "INFO: Done! Try: $JARFILE.patched.jar"
##
## EOF
##