1 | #!/bin/sh
|
---|
2 |
|
---|
3 | osarch=$1
|
---|
4 | usagemsg="Usage: $0 linux-x64|linux"
|
---|
5 | if [ -z "$osarch" ]; then
|
---|
6 | echo $usagemsg
|
---|
7 | exit 1;
|
---|
8 | fi
|
---|
9 | # https://stackoverflow.com/questions/3265803/bash-string-equality
|
---|
10 | if [ "$osarch" != "linux-x64" ] && [ "$osarch" != "linux" ]; then
|
---|
11 | echo "Parameter is (slightly?) incorrect."
|
---|
12 | echo $usagemsg
|
---|
13 | exit 1
|
---|
14 | fi
|
---|
15 |
|
---|
16 |
|
---|
17 | echo "Creating tarball and zip for $osarch"
|
---|
18 |
|
---|
19 | if [ ! -d tesseract ]; then
|
---|
20 | mkdir tesseract
|
---|
21 |
|
---|
22 | cp src/setup.ba* tesseract/.
|
---|
23 |
|
---|
24 | if [ ! -d src/linux ]; then
|
---|
25 | echo "No src/linux folder, can't proceed tarring and zipping up tesseract."
|
---|
26 | exit 1;
|
---|
27 | else
|
---|
28 | echo "Moving src/linux into tesseract folder"
|
---|
29 | #mv src/linux tesseract/.
|
---|
30 | cp -r src/linux tesseract/.
|
---|
31 |
|
---|
32 | echo "Copying licence files"
|
---|
33 | cp src/packages/*LICENSE.txt tesseract/linux/.
|
---|
34 |
|
---|
35 | echo "Copying user info files"
|
---|
36 | cp GETTING-OCR-SUPPORT-FOR-MORE-LANGS.txt tesseract/.
|
---|
37 |
|
---|
38 | echo "Removing tesseract/linux/man"
|
---|
39 | rm -rf tesseract/linux/man
|
---|
40 |
|
---|
41 | echo "Removing all but folder 'tessdata' from tesseract/linux/share folder"
|
---|
42 | #rm -rf tesseract/linux/share/aclocal
|
---|
43 | #rm -rf tesseract/linux/share/doc
|
---|
44 | #rm -rf tesseract/linux/share/info/
|
---|
45 | #rm -rf tesseract/linux/share/libtool/
|
---|
46 | #rm -rf tesseract/linux/share/man
|
---|
47 | mv tesseract/linux/share tesseract/linux/share.del
|
---|
48 | mkdir tesseract/linux/share
|
---|
49 | mv tesseract/linux/share.del/tessdata tesseract/linux/share/.
|
---|
50 | rm -rf tesseract/linux/share.del
|
---|
51 | fi
|
---|
52 | else
|
---|
53 | echo "Folder tesseract already exists. Using existing."
|
---|
54 | echo "For creating a fresh tarball and zip, delete the existing tesseract folder"
|
---|
55 | echo "at this script level ($0) first."
|
---|
56 | fi
|
---|
57 |
|
---|
58 | # just try to create it for the OS
|
---|
59 | outfile="tesseract-$osarch"
|
---|
60 | if [ -f "$outfile.tar.gz" ]; then
|
---|
61 | rm "$outfile.tar.gz"
|
---|
62 | fi
|
---|
63 | tar -cvzf "$outfile.tar.gz" tesseract
|
---|
64 |
|
---|
65 | if [ -f "$outfile.zip" ]; then
|
---|
66 | rm "$outfile.zip"
|
---|
67 | fi
|
---|
68 | zip -r "$outfile.zip" tesseract
|
---|
69 |
|
---|
70 | echo "Done making $outfile tarball/zip"
|
---|
71 | echo ""
|
---|