Created
October 27, 2012 02:23
-
-
Save nicerobot/3962722 to your computer and use it in GitHub Desktop.
Jira WAR installation is crazy dumb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# From within CATALINA_HOME: | |
# curl -Lks https://raw.github.com/gist/3962722/install.sh | sh -s [JIRA_HOME] | |
# https://confluence.atlassian.com/display/JIRA051/Installing+JIRA+on+Tomcat+6.0 | |
JIRA_VERSION=5.1.7 | |
CATALINA_HOME=${CATALINA_HOME:-${PWD}} | |
[ -x ${CATALINA_HOME}/bin/catalina.sh ] || { | |
echo "${CATALINA_HOME} does not look like a CATALINA_HOME" >&2 | |
exit ${LINENO} | |
} | |
WEBAPPS=${CATALINA_HOME}/webapps | |
[ -d ${WEBAPPS} ] || { | |
echo "${WEBAPPS} is missing" >&2 | |
exit ${LINENO} | |
} | |
[ -w ${HOME}/.catalina ] || { | |
echo "export CATALINA_HOME=${CATALINA_HOME}" > ${HOME}/.catalina | |
echo 'export CATALINA_OPTS="$CATALINA_OPTS -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true -Xms128m -Xmx512m -XX:MaxPermSize=256m"' >> ${HOME}/.catalina | |
} | |
JIRA_HOME=${1:-${JIRA_HOME:-${TMP:-${TMPDIR}}}} | |
[ -w ${JIRA_HOME} ] || { | |
echo "${JIRA_HOME} is not writeable" >&2 | |
exit ${LINENO} | |
} | |
[ -w ${HOME}/.jira ] || { | |
cat > ${HOME}/.jira <<JIRA | |
export JIRA_HOME='${JIRA_HOME}' | |
export JIRA_VERSION='${JIRA_VERSION}' | |
JIRA | |
} | |
JIRA=atlassian-jira-${JIRA_VERSION} | |
JIRAN=${JIRA}-war | |
JIRA_BASE=${CATALINA_HOME}/atlassian-jira-${JIRA_VERSION} | |
( | |
cd ${JIRA_HOME} | |
curl -LOs http://www.atlassian.com/software/jira/downloads/binary/jira-jars-tomcat-distribution-5.1-tomcat-6x.zip | |
curl -Ls http://www.atlassian.com/software/jira/downloads/binary/${JIRAN}.tar.gz \ | |
| tar zx | |
cd ${JIRAN} || exit ${LINENO} | |
JIRAD=${PWD} | |
( | |
cd webapps/WEB-INF/lib | |
rm jcl-over-slf4j-*.jar jul-to-slf4j-*.jar log4j-*.jar slf4j-log4j12-*.jar | |
) | |
perl -pi -e 's|jira.home=$'"|${JIRA_HOME}|" webapp/WEB-INF/classes/jira-application.properties | |
./build.sh | |
[ -f dist-tomcat/${JIRA}.war ] || exit ${LINENO} | |
cp dist-tomcat/${JIRA}.war ${CATALINA_HOME}/webapps | |
cd ${CATALINA_HOME} | |
mkdir ${CATALINA_HOME}/conf/Catalina/localhost | |
cd ${CATALINA_HOME}/conf/Catalina/localhost | |
p=$(printf 'path="/%s" docBase="%s"' "${JIRA}" "${CATALINA_HOME}/conf/Catalina/localhost/") | |
perl -p -e "s|path=[^ ]+ docBase=..JIRA_WEBAPP..|${p}|" ${JIRAD}/etc/jira.xml > jira.xml | |
cd ${CATALINA_HOME}/lib | |
unzip ${JIRA_HOME}/jira-jars-tomcat-distribution-5.1-tomcat-6x.zip | |
exit 0 | |
) | |
exit ${?} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# curl -Lks https://raw.github.com/gist/3962722/run.sh | sh | |
[ -r ${HOME}/.catalina ] || exit 1 | |
[ -r ${HOME}/.jira ] || exit 1 | |
. ${HOME}/.catalina | |
. ${HOME}/.jira | |
JAVA_VERSION=$(java -version 2>&1 | tr -d '"' | awk -F'[ .]' 'NR>1 {exit}; {print $3,$4}') | |
echo $JAVA_VERSION $JIRA_VERSION \ | |
| awk -F'[. ]' '$1==1 && $2>6 && $3==5 && $4==1 {exit 1}; 0' || { | |
echo "Jira ${JIRA_VERSION} bugs out with Java > 1.6" >&2 | |
echo 'https://confluence.atlassian.com/display/JIRA/Supported+Platforms' | |
exit 1 | |
} | |
JIRA_BASE=${CATALINA_HOME}/atlassian-jira-${JIRA_VERSION} | |
for j in ${CATALINA_HOME}/lib/*.jar; do | |
n=$(basename ${j}) | |
rm ${JIRA_BASE}/WEB-INF/lib/${n} 2>/dev/null | |
done | |
catalina run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment