Browse Source

Address ISLANDORA-993

pull/514/head
nruest 11 years ago
parent
commit
a963af1794
  1. 2
      .travis.yml
  2. 19
      tests/scripts/adore.sh
  3. 24
      tests/scripts/tesseract.sh

2
.travis.yml

@ -17,6 +17,8 @@ env:
before_install:
- export ISLANDORA_DIR=$TRAVIS_BUILD_DIR
- $TRAVIS_BUILD_DIR/tests/scripts/travis_setup.sh
- sudo sh $TRAVIS_BUILD_DIR/tests/scripts/adore.sh
- sudo sh $TRAVIS_BUILD_DIR/tests/scripts/tesseract.sh
- cd $HOME/drupal-*
script:
- ant -buildfile sites/all/modules/islandora/build.xml lint

19
tests/scripts/adore.sh

@ -0,0 +1,19 @@
# Download, install and configure adore-djatoka
cd /opt
wget http://sourceforge.net/projects/djatoka/files/djatoka/1.1/adore-djatoka-1.1.tar.gz/download
mv download adore-djatoka-1.1.tar.gz
tar xf adore-djatoka-1.1.tar.gz && rm -rf adore-djatoka-1.1.tar.gz
ln -s adore-djatoka-1.1 adore-djatoka
cp adore-djatoka/dist/adore-djatoka.war $CATALINA_HOME/webapps
echo -e '#!/bin/sh\n# setup environment variables for shell script\nCURRENTDIR=$PWD\n# Define DJATOKA_HOME dynamically\nLAUNCHDIR=/opt/adore-djatoka/bin\n#cd ..\nDJATOKA_HOME=/opt/adore-djatoka\nLIBPATH=$DJATOKA_HOME/lib\n\nif [ `uname` = 'Linux' ] ; then\n if [ `uname -m` = "x86_64" ] ; then\n # Assume Linux AMD 64 has 64-bit Java\n PLATFORM="Linux-x86-64"\n LD_LIBRARY_PATH="$LIBPATH/$PLATFORM"\n export LD_LIBRARY_PATH\n KAKADU_LIBRARY_PATH="-DLD_LIBRARY_PATH=$LIBPATH/$PLATFORM"\n else\n # 32-bit Java\n PLATFORM="Linux-x86-32"\n LD_LIBRARY_PATH="$LIBPATH/$PLATFORM"\n export LD_LIBRARY_PATH\n KAKADU_LIBRARY_PATH="-DLD_LIBRARY_PATH=$LIBPATH/$PLATFORM"\n fi\nelif [ `uname` = 'Darwin' ] ; then\n # Mac OS X\n PLATFORM="Mac-x86"\n export PATH="/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/bin:$PATH"\n export DYLD_LIBRARY_PATH="$LIBPATH/$PLATFORM"\n KAKADU_LIBRARY_PATH="-DDYLD_LIBRARY_PATH=$LIBPATH/$PLATFORM"\nelif [ `uname` = 'SunOS' ] ; then\n if [ `uname -p` = "i386" ] ; then\n # Assume Solaris x86\n PLATFORM="Solaris-x86"\n LD_LIBRARY_PATH="$LIBPATH/$PLATFORM"\n export LD_LIBRARY_PATH\n else\n # Sparcv9\n PLATFORM="Solaris-Sparcv9"\n LD_LIBRARY_PATH="$LIBPATH/$PLATFORM"\n export LD_LIBRARY_PATH\n fi\nelse\n echo "djatoka env: Unsupported platform: `uname`"\n exit\nfi\n\nKAKADU_HOME=$DJATOKA_HOME/bin/$PLATFORM\n#export KAKADU_HOME\n#cd $LAUNCHDIR\n#for line in `ls -1 $LIBPATH | grep '.jar'`\n# do\n# classpath="$classpath:$LIBPATH/$line"\n#done\n#DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"\n#CLASSPATH=.:../build/:$classpath\nJAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Dkakadu.home=$KAKADU_HOME -Djava.library.path=$LIBPATH/$PLATFORM $KAKADU_LIBRARY_PATH"\n\n# If a proxy server is used in your institution... uncomment and set the following:\n#proxySet=true\n#proxyPort=8080\n#proxyHost=proxyout.lanl.gov\n#JAVA_OPTS="$JAVA_OPTS -DproxySet=$proxySet -DproxyPort=$proxyPort -DproxyHost=$proxyHost"' > /opt/adore-djatoka/bin/env.sh
echo -e '#!/bin/sh\n\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the "License"); you may not use this file except in compliance with\n# the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an "AS IS" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# -----------------------------------------------------------------------------\n# Start Script for the CATALINA Server\n#\n# $Id: startup.sh 562770 2007-08-04 22:13:58Z markt $\n# -----------------------------------------------------------------------------\n\n# Better OS/400 detection: see Bugzilla 31132\nos400=false\ndarwin=false\ncase "`uname`" in\nCYGWIN*) cygwin=true;;\nOS400*) os400=true;;\nDarwin*) darwin=true;;\nesac\n\n# resolve links - $0 may be a softlink\nPRG="$0"\n\nwhile [ -h "$PRG" ] ; do\n ls=`ls -ld "$PRG"`\n link=`expr "$ls" : \0047.*-> \(.*\)$\0047`\n if expr "$link" : \0047/.*\0047 > /dev/null; then\n PRG="$link"\n else\n PRG=`dirname "$PRG"`/"$link"\n fi\ndone\n \nPRGDIR=`dirname "$PRG"`\nEXECUTABLE=catalina.sh\n\n# Check that target executable exists\nif $os400; then\n # -x will Only work on the os400 if the files are: \n # 1. owned by the user\n # 2. owned by the PRIMARY group of the user\n # this will not work if the user belongs in secondary groups\n eval\nelse\n if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then\n echo "Cannot find $PRGDIR/$EXECUTABLE"\n echo "This file is needed to run this program"\n exit 1\n fi\nfi \n\n. /opt/adore-djatoka/bin/env.sh\nexport JAVA_OPTS\nexport FEDORA_HOME=/usr/local/fedora\nexport DJATOKA_HOME=/usr/opt/adore-djatoka\nexport KAKADU_HOME=$DJATOKA_HOME/bin/Linux-x86-64\nexport CATALINA_HOME=$FEDORA_HOME/tomcat\nexport PATH=$FEDORA_HOME/server/bin:$FEDORA_HOME/client/bin:$JAVA_HOME/bin:$CATALINA_HOME/bin:$KAKADU_HOME:$PATH\nexport LD_LIBRARY_PATH=$DJATOKA_HOME/lib/Linux-x86-64:$LD_LIBRARY_PATH\nexport SOLR_HOME=$FEDORA_HOME/solr\n\necho $JAVA_OPTS\n\n\nexec "$PRGDIR"/"$EXECUTABLE" start "$@"' > $CATALINA_HOME/bin/startup.sh
# Make djatoka available on the command line
ln -s /opt/adore-djatoka/bin/Linux-x86-32/kdu_expand /usr/bin/kdu_expand
ln -s /opt/adore-djatoka/bin/Linux-x86-32/kdu_compress /usr/bin/kdu_compress
echo "/opt/adore-djatoka/lib/Linux-x86-32" > /etc/ld.so.conf.d/kakadu.conf
ldconfig
# Try to create a propert log4j.properties file for adore-djatoka
# echo -e '# REPORTING LEVELS: OFF, DEBUG, INFO, WARN, ERROR and FATAL\nlog.dir=/usr/local/fedora/server/logs/\ndatestamp=yyyy-MM-dd/HH:mm:ss.SSS/zzz\nroll.pattern.hourly=.yyyy-MM-dd.HH\nroll.pattern.daily=.yyyy-MM-dd\n\n#djatoka.log -- Default catch-all.\nlog4j.rootLogger=DEBUG, defaultLog\nlog4j.appender.defaultLog=org.apache.log4j.DailyRollingFileAppender\nlog4j.appender.defaultLog.DatePattern=${roll.pattern.daily}\nlog4j.appender.defaultLog.File=${log.dir}/djatoka.log\nlog4j.appender.defaultLog.layout=org.apache.log4j.PatternLayout\nlog4j.appender.defaultLog.layout.ConversionPattern=%d{${datestamp}} [%t] %-5p %m%n' > $CATALINA_HOME/webapps/adore-djatoka/WEB-INF/classes/log4j.properties
# sed -i "s|log.dir=/usr/local/fedora/server/logs/|log.dir=$FEDORA_HOME/server/logs/|g" $CATALINA_HOME/webapps/adore-djatoka/WEB-INF/classes/log4j.properties

24
tests/scripts/tesseract.sh

@ -0,0 +1,24 @@
apt-get update
apt-get install build-essential checkinstall
mkdir ~/tesseract
cd ~/tesseract
wget http://www.leptonica.org/source/leptonica-1.69.tar.gz
tar xf leptonica-1.69.tar.gz && rm -rf leptonica-1.69.tar.gz
cd leptonica-1.69
./configure
make && checkinstall --pkgname=libleptonica --pkgversion="1.69" --backup=no --deldoc=yes --fstrans=no --default
cd ~/tesseract
wget https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz
tar xf tesseract-ocr-3.02.02.tar.gz && rm -rf tesseract-ocr-3.02.02.tar.gz
cd tesseract-ocr
./autogen.sh
./configure
make && checkinstall --pkgname=tesseract-ocr --pkgversion="3.02.02" --backup=no --deldoc=yes --fstrans=no --default && ldconfig
mkdir ~/tesseract/langs
cd ~/tesseract/langs
wget https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.eng.tar.gz
echo "Extracting language files"
for i in *.tar.gz; do echo -e "\nworking on $i\n"; tar xvzf $i ; done
cp tesseract-ocr/tessdata/* /usr/local/share/tessdata/
echo -e "\ntesseract output:"
tesseract --version && tesseract --list-langs && cd ~ && rm -rf ~/tesseract
Loading…
Cancel
Save