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 | gsExt="tesseract"
|
---|
17 | echo "Creating $gsExt tarball and zip for $osarch"
|
---|
18 |
|
---|
19 | if [ ! -d $gsExt ]; then
|
---|
20 | mkdir $gsExt
|
---|
21 |
|
---|
22 | cp src/setup.ba* $gsExt/.
|
---|
23 |
|
---|
24 | if [ ! -d src/linux ]; then
|
---|
25 | echo "No src/linux folder, can't proceed tarring and zipping up $gsExt."
|
---|
26 | exit 1;
|
---|
27 | else
|
---|
28 | echo "Moving src/linux into $gsExt folder"
|
---|
29 | #mv src/linux $gsExt/.
|
---|
30 | cp -r src/linux $gsExt/.
|
---|
31 |
|
---|
32 | echo "Copying licence files"
|
---|
33 | cp src/packages/*LICENSE.txt $gsExt/linux/.
|
---|
34 |
|
---|
35 | echo "Copying user info files"
|
---|
36 | cp GETTING-OCR-SUPPORT-FOR-MORE-LANGS.txt $gsExt/.
|
---|
37 |
|
---|
38 | echo "Removing $gsExt/linux/man"
|
---|
39 | rm -rf $gsExt/linux/man
|
---|
40 |
|
---|
41 | echo "Removing all but folder 'tessdata' from $gsExt/linux/share folder"
|
---|
42 | #rm -rf $gsExt/linux/share/aclocal
|
---|
43 | #rm -rf $gsExt/linux/share/doc
|
---|
44 | #rm -rf $gsExt/linux/share/info/
|
---|
45 | #rm -rf $gsExt/linux/share/libtool/
|
---|
46 | #rm -rf $gsExt/linux/share/man
|
---|
47 | mv $gsExt/linux/share $gsExt/linux/share.del
|
---|
48 | mkdir $gsExt/linux/share
|
---|
49 | mv $gsExt/linux/share.del/tessdata $gsExt/linux/share/.
|
---|
50 | rm -rf $gsExt/linux/share.del
|
---|
51 | fi
|
---|
52 | else
|
---|
53 | echo "Folder $gsExt already exists. Using existing."
|
---|
54 | echo "For creating a fresh tarball and zip, delete the existing $gsExt folder"
|
---|
55 | echo "at this script level ($0) first."
|
---|
56 | fi
|
---|
57 |
|
---|
58 | # just try to create it for the OS
|
---|
59 | outfile="$gsExt-$osarch"
|
---|
60 | if [ -f "$outfile.tar.gz" ]; then
|
---|
61 | rm "$outfile.tar.gz"
|
---|
62 | fi
|
---|
63 | tar -cvzf "$outfile.tar.gz" $gsExt
|
---|
64 |
|
---|
65 | if [ -f "$outfile.zip" ]; then
|
---|
66 | rm "$outfile.zip"
|
---|
67 | fi
|
---|
68 | zip -r "$outfile.zip" $gsExt
|
---|
69 |
|
---|
70 | #rm -rf $gsExt
|
---|
71 |
|
---|
72 | echo "Done making $gsExt tarball/zip"
|
---|
73 | echo ""
|
---|