Bash 我在travis ci的前一部分有一个安装脚本';这是我的剧本,但特拉维斯;can';“不要打开它”;

Bash 我在travis ci的前一部分有一个安装脚本';这是我的剧本,但特拉维斯;can';“不要打开它”;,bash,sh,travis-ci,Bash,Sh,Travis Ci,在我的.travis.yml脚本中,我有以下内容: before_install: - cd $HOME - git clone -b 7.x git://github.com/Islandora/islandora.git - sh adore-djakota-install.sh 在其他一些事情中。此处引用的脚本如下所示: # Download, install and configure adore-djatoka cd /opt wget http://sourceforg

在我的
.travis.yml
脚本中,我有以下内容:

before_install:
  - cd $HOME
  - git clone -b 7.x git://github.com/Islandora/islandora.git
  - sh adore-djakota-install.sh
在其他一些事情中。此处引用的脚本如下所示:

# 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
但正如我所说,每次travis试图运行脚本并测试推送时,它都会这样说:

...
$ sh adore-djakota-install.sh
sh: 0: Can't open adore-djakota-install.sh
The command "sh adore-djakota-install.sh" failed and exited with 127 during before_install.

sh:0:无法打开adore djakota安装。sh
表示
sh
找不到该文件。在我看来,您好像忘记了将
cd
放入文件所在的目录中


另外,请记住,在编写脚本之前,您必须在
的末尾将cd放回
$TRAVIS_BUILD_DIR
,以便TRAVIS可以运行实际的测试(默认构建脚本预计将从
$TRAVIS_build_DIR

运行
chmod+x adore djakota install.sh
帮助?尝试使用sudo启动它,我supose TRAVIS没有管理权限?(将sudo添加到sh adore djakota install.sh)如果Travis无法在opt中执行任何操作,它将失败:我得到:
$chmod+x adore.sh chmod:无法访问adore.sh”:没有这样的文件或目录
,我甚至将文件更改为adore.sh,以确保我调用的是一个存在的文件……您上面提到的文件名为
adore djakota install.sh
而不仅仅是
adore.sh