-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_djatoka.sh
executable file
·107 lines (90 loc) · 3.85 KB
/
get_djatoka.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# Copyright (C) 2008 Phil Cryer ([email protected])
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# get_djatoka.sh
# a simple script to download/setup djatoka image viewer in tomcat under Debian/Ubuntu
UNAME=`uname`
if [ "$UNAME" = "Linux" ] ; then
if [ -f /etc/lsb-release ] ; then
OSNAME="ubuntu"
elif [ -f /etc/debian_version ] ; then
OSNAME="debian"
else
echo " > ERROR: Unsupported Linux distribution"
echo " > this script will only work on Debian or Ubuntu"
exit 1
fi
fi
echo " > Linux distro $OSNAME - supported..."
echo " > checking for tomcat..."
if [ ! -d "/var/lib/tomcat5.5" ]; then
echo " > installing tomcat..."
apt-get install tomcat5.5
fi
echo " > getting djatoka files..."
cd /tmp
if [ ! -f "adore-djatoka-1.0.tar.gz" ]; then
wget http://african.lanl.gov/aDORe/projects/djatoka/download/adore-djatoka-1.0.tar.gz
fi
if [ ! -f "adore-djatoka-viewer-1.0.tar.gz" ]; then
wget http://african.lanl.gov/aDORe/projects/djatoka/download/adore-djatoka-viewer-1.0.tar.gz
fi
tar -zxf adore-djatoka-1.0.tar.gz ; tar -zxf adore-djatoka-viewer-1.0.tar.gz
echo " > fixing URL..."
cd adore-djatoka-1.0
export HOSTNAME=`hostname -f`; cat src/web/index.html | sed -e "s/localhost/${HOSTNAME}/g" | sed -e 's/8080/8180/g' > src/web/index.html.new
mv src/web/index.html.new src/web/index.html
echo " > building new war..."
ant clean
ant
cd -
echo " > installing djatoka to /var/lib..."
mv adore-djatoka-1.0 /var/lib/adore-djatoka
echo " > installing djatoka to tomcat..."
if [ -d "/var/lib/tomcat5.5/webapps/adore-djatoka" ]; then
rm -rf /var/lib/tomcat5.5/webapps/adore-djatoka*
fi
cp /var/lib/adore-djatoka/dist/adore-djatoka.war /var/lib/tomcat5.5/webapps
echo " > adding djatoka variables to default/tomcat5.5"
echo "" >> /etc/default/tomcat5.5
echo "#### added for adore-djatoka support `date +%Y%m%d.%H%M%S` - start #### " >> /etc/default/tomcat5.5
echo "DJATOKA_HOME=\"/var/lib/adore-djatoka\"" >> /etc/default/tomcat5.5
echo "LAUNCHDIR=$DJATOKA_HOME/bin" >> /etc/default/tomcat5.5
tail -n46 /var/lib/adore-djatoka/bin/env.sh >> /etc/default/tomcat5.5
echo "#### added for adore-djatoka support - end #### " >> /etc/default/tomcat5.5
echo "" >> /etc/default/tomcat5.5
echo " > restarting tomcat..."
/etc/init.d/tomcat5.5 restart
#cat /root/bin/get_djatoka.sh
#exit 0
sleep 10
echo " > installing djatoka viewer..."
#cd /tmp/adore-djatoka-viewer-1.0
#cat viewer.html | sed -e "s/host\:port/$HOSTNAME\:8180/g" > viewer.html.new
#mv viewer.html.new viewer.html
#
#head -n18 index.html > index.html.foo; echo "<input type='text' id='input_addUrl' name='addUrl' size='50' value=\"http://memory.loc.gov/gmd/gmd433/g4330/g4330/np000066.jp2\">" >> index.html.foo; tail -n7 index.html >> index.html.foo; mv index.html.foo index.html
#mv index.html index_viewer.html
cp -R /tmp/adore-djatoka-viewer-1.0/* /var/lib/tomcat5.5/webapps/adore-djatoka/
echo " > cleaning up..."
rm -rf adore-djatoka-1.0 adore-djatoka-viewer-1.0
echo " > done"
echo " > to see the base djatoka install hit:"
echo " > http://${HOSTNAME}:8180/adore-djatoka"
echo " > test URL=http://memory.loc.gov/gmd/gmd433/g4330/g4330/np000066.jp2"
#echo " > the optional viewer is available here:"
#echo " > http://$HOSTNAME:8180/adore-djatoka/index_viewer.html"
exit 0