start.sh 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. if [ "$WIKI_CONTEXT" != "" ];then
  3. if [ ! -f "${JETTY_BASE}/webapps/${WIKI_CONTEXT}" ];then
  4. mv ${JETTY_BASE}/webapps/ROOT ${JETTY_BASE}/webapps/${WIKI_CONTEXT}
  5. #curl http://download.forge.ow2.org/xwiki/xwiki-enterprise-web-8.0-milestone-2.war --output webapps/xwiki8.war
  6. sed -i "s|MYSQL_HOST|${MYSQL_HOST}|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/hibernate.cfg.xml
  7. sed -i "s|MYSQL_USER|${MYSQL_USER}|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/hibernate.cfg.xml
  8. sed -i "s|MYSQL_PASSWORD|${MYSQL_PASSWORD}|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/hibernate.cfg.xml
  9. if [[ "${SMTP_HOST}" != "" ]]; then
  10. sed -i "s|.*mail\.sender\.host = .*|mail.sender.host = ${SMTP_HOST}|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  11. fi
  12. if [[ "${SMTP_LOGIN}" != "" ]]; then
  13. sed -i "s|.*mail\.sender\.username = .*|mail.sender.username = ${SMTP_LOGIN}|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  14. fi
  15. if [[ "${SMTP_PASSWORD}" != "" ]]; then
  16. sed -i "s|.*mail\.sender\.password = .*|mail.sender.password = ${SMTP_PASSWORD}|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  17. fi
  18. if [[ "${ADMIN_EMAIL}" != "" ]]; then
  19. sed -i "s|.*mail\.sender\.from = .*|mail.sender.from = ${ADMIN_EMAIL}|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  20. fi
  21. if [[ "${SMTP_PROTOCOL}" == "tls" ]]; then
  22. sed -i "s|.*mail\.sender\.port = .*|mail.sender.port = 587|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  23. sed -i "s|.*mail\.sender\.properties = .*|mail.sender.properties = mail.smtp.starttls.enable = true|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  24. elif [[ "${SMTP_PROTOCOL}" == "ssl" ]]; then
  25. sed -i "s|.*mail\.sender\.port = .*|mail.sender.port = 465|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  26. else
  27. sed -i "s|.*mail\.sender\.port = .*|mail.sender.port = 25|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  28. fi
  29. set XWIKI_OPTS=%XWIKI_OPTS% -Doffice.path=/usr/lib/libreoffice/
  30. sed -i "s|.*openoffice.serverType=0|openoffice.serverType=0|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  31. sed -i "s|.*openoffice.autoStart=false|openoffice.autoStart=true|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  32. sed -i "s|.*openoffice.homePath=/opt/openoffice.org3/|openoffice.homePath=/usr/lib/libreoffice/|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  33. sed -i "s|.*openoffice.taskExecutionTimeout=30000|openoffice.taskExecutionTimeout=120000|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  34. sed -i "s|.*environment.permanentDirectory=/var/local/xwiki/|environment.permanentDirectory=/var/local/xwiki/|" ${JETTY_BASE}/webapps/${WIKI_CONTEXT}/WEB-INF/xwiki.properties
  35. fi
  36. fi
  37. cd ${JETTY_BASE}
  38. java -jar start.jar