1 | #!/bin/bash
|
---|
2 |
|
---|
3 | OS_ALLCAPS=`uname | tr 'a-z' 'A-Z'`
|
---|
4 |
|
---|
5 | selfcon_ext=selfcontained-ant
|
---|
6 | installed_dir=${selfcon_ext}/apache-ant
|
---|
7 |
|
---|
8 | if [ ! -d selfcontained-jdk ] ; then
|
---|
9 | echo ""
|
---|
10 | echo "Checking for java ..."
|
---|
11 | command -v java
|
---|
12 |
|
---|
13 | if [ $? != 0 ] ; then
|
---|
14 | echo ""
|
---|
15 | echo "Failed to find 'java'"
|
---|
16 | echo "After 5 seconds, initiating: "
|
---|
17 | echo ""
|
---|
18 | echo " ./get-selfcontained-jdk.sh"
|
---|
19 | echo "[Press ^C to stop]"
|
---|
20 | sleep 5
|
---|
21 | ./get-selfcontained-jdk.sh
|
---|
22 | else
|
---|
23 | echo ""
|
---|
24 | echo "Detected 'java' but it is not the Greenstone3 supplied 'selfcontained-jdk'"
|
---|
25 | echo "=> Recommend running:"
|
---|
26 | echo ""
|
---|
27 | echo " ./get-selfcontained-jdk.sh"
|
---|
28 | echo ""
|
---|
29 | echo "After 5 seconds, continuing with getting ant"
|
---|
30 | echo "[Press ^C to stop]"
|
---|
31 | sleep 5
|
---|
32 | fi
|
---|
33 | fi
|
---|
34 |
|
---|
35 | echo ""
|
---|
36 | if [ ! -d $selfcon_ext ] ; then
|
---|
37 | echo "Checking out from svn: Greenstone3's $selfcon_ext extension"
|
---|
38 | svn co https://svn.greenstone.org/gs3-extensions/$selfcon_ext/trunk $selfcon_ext
|
---|
39 |
|
---|
40 | if [ $? != 0 ] ; then
|
---|
41 | echo "Error encountered checking out: " 1>&2
|
---|
42 | echo " svn co https://svn.greenstone.org/gs3-extensions/$selfcon_ext/trunk $selfcon_ext" 1>&2
|
---|
43 | exit 1
|
---|
44 | fi
|
---|
45 | else
|
---|
46 | echo "Detected directory '$selfcon_ext'"
|
---|
47 | echo "=> Taken to mean that the svn check-out command has already been run"
|
---|
48 | fi
|
---|
49 |
|
---|
50 | echo ""
|
---|
51 | if [ ! -d $installed_dir ] ; then
|
---|
52 | echo "Runing the $selfcon_ext/PREPARE-UNIX.sh"
|
---|
53 |
|
---|
54 | cd $selfcon_ext && ./PREPARE-UNIX.sh
|
---|
55 |
|
---|
56 | if [ $? != 0 ] ; then
|
---|
57 | echo "Error encountered running: " 1>&2
|
---|
58 | echo " cd $selfcon_ext && ./PREPARE-UNIX.sh" 1>&2
|
---|
59 | exit 1
|
---|
60 | fi
|
---|
61 |
|
---|
62 | else
|
---|
63 | echo "Detected directory '$installed_dir'"
|
---|
64 | echo "=> Taken to mean that the $selfcon_ext/PREPARE-UNIX.sh command has already been run"
|
---|
65 | fi
|
---|
66 |
|
---|
67 |
|
---|
68 | if [ "x$ANT_HOME" != "x$PWD/$installed_dir" ] ; then
|
---|
69 | echo ""
|
---|
70 | echo "To use this installed version of Apache Ant, in the top-level Greenstone3 directory run:"
|
---|
71 | echo " source ./gs3-setup-cli.sh"
|
---|
72 | echo ""
|
---|
73 | else
|
---|
74 | echo ""
|
---|
75 | echo "Detected ANT_HOME set to \$PWD/$installed_dir"
|
---|
76 | echo "=> Taken to mean that the $selfcon_ext SETUP.sh file has been sourced"
|
---|
77 | fi
|
---|
78 |
|
---|
79 | echo ""
|
---|