~charmers/charms/precise/opengrok/trunk

« back to all changes in this revision

Viewing changes to hooks/install

  • Committer: Peter M. Petrakis
  • Date: 2012-10-19 20:43:23 UTC
  • Revision ID: peter.petrakis@canonical.com-20121019204323-4yxb1szid7gg3fpg
* Added sha256 checking per https://juju.ubuntu.com/CryptographicSourceVerification
* Disabled -x in hooks/install
* Dramatically condensed hooks/install
* Removed todo block from hooks/install, that's what ${ROOT}/TODO is for
* Updated TODO
* Updated README with extended description demonstration of basic index update
* Updated metadata.yaml with improved description
* Added current revision file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
 
set -eux
3
 
# TODO 
4
 
# * idempontent
5
 
# * rework to switch/case "common script" with symlink architecture
6
 
# * create hook to integrate with existing tomcat6 service.
7
 
# * parameterize opengrok config at runtime
8
 
# * attach and manage persistant storage for src & data
 
2
set -eu # -x for verbose logging to juju debug-log
9
3
 
10
4
tarball=opengrok-0.11.1.tar.gz
 
5
tarball_sha256=b49e795f3421117e0e1176bf786335c3aba70ad67ad77fb2800f9f4d6ae246c5
11
6
grokjar=http://hub.opensolaris.org/bin/download/Project+opengrok/files/${tarball}
12
7
 
13
8
juju-log "Preparing to install OpenGrok"
14
 
export DEBIAN_FRONTEND=noninteractive
15
 
apt-get -q -y install tomcat6 exuberant-ctags wget bzr
 
9
add-apt-repository ppa:charmers/charm-helpers
 
10
apt-get update
 
11
apt-get -qqy install tomcat6 exuberant-ctags wget bzr charm-helper-sh
16
12
 
17
13
juju-log "Installing opengrok 11.1 JAR from tarball"
18
 
pushd /opt
19
 
wget ${grokjar} 2>/dev/null
20
 
tar xzvf ${tarball}
21
 
ln -s opengrok-0.11.1 opengrok
22
 
popd
 
14
. /usr/share/charm-helper/sh/net.sh
 
15
templocation=`ch_get_file ${grokjar} ${tarball_sha256}`
 
16
tar xzf ${templocation} -C /opt
 
17
ln -s /opt/opengrok-0.11.1 /opt/opengrok
23
18
 
24
19
juju-log "deploying opengrok war to servlet root"
25
20
# deploy script scans for common servlets and had hardcoded paths
26
21
# should you use tomcat7 this will probably not work.
27
 
pushd /opt/opengrok/bin
28
 
./OpenGrok deploy
29
 
popd
 
22
cd /opt/opengrok/bin && ./OpenGrok deploy
30
23
 
31
24
juju-log "creating opengrok src and data store"
32
25
mkdir -p /var/opengrok/src /var/opengrok/data
33
26
 
34
27
juju-log "acquiring example source code: juju"
35
 
pushd /var/opengrok/src
36
 
bzr branch lp:juju 2>/dev/null
37
 
popd
 
28
bzr branch lp:juju /var/opengrok/src/juju 2>/dev/null
38
29
 
39
30
juju-log "indexing..."
40
 
pushd /opt/opengrok/bin
41
 
./OpenGrok index
42
 
popd
 
31
cd /opt/opengrok/bin && ./OpenGrok index
43
32
 
44
33
open-port 8080/tcp
45
34
 
46
35
juju-log "opengrok installed, expose service and visit http://HOSTIP:8080/source"
 
36
 
 
37
# vim:ts=4:sw=4:et: