| #!/bin/bash -e |
| |
| ls -la /var/gerrit/* |
| |
| if [ ! -d /var/gerrit/git/All-Projects.git ] || [ "$1" == "init" ] |
| then |
| echo "Initializing Gerrit site ..." |
| java -jar /var/gerrit/bin/gerrit.war init --batch --install-all-plugins -d /var/gerrit |
| java -jar /var/gerrit/bin/gerrit.war reindex -d /var/gerrit |
| fi |
| |
| echo "Running hscloud init setup..." |
| |
| rm -f /var/gerrit/etc/gerrit.config |
| cp /var/gerrit-config/gerrit.config /var/gerrit/etc/gerrit.config |
| |
| rm -f /var/gerrit/etc/secure.config |
| cp /var/gerrit-secure/secure.config /var/gerrit/etc/secure.config |
| |
| cp /var/gerrit-plugins/* /var/gerrit/plugins/ |
| mkdir -p /var/gerrit/hooks/ |
| cp /var/gerrit-hooks/* /var/gerrit/hooks/ |
| |
| echo "Starting config updater..." |
| # Keep copying config over in background. We cannot run directly from |
| # the configmap filesystem as gerrit really wants a read-write FS. |
| ( |
| src=/var/gerrit-config/gerrit.config |
| dst=/var/gerrit/etc/gerrit.config |
| while true; do |
| sleep 60 |
| if ! cmp -s $src $dst; then |
| echo "HSCLOUD: bumping config" |
| cp $src $dst |
| fi |
| done |
| ) & |
| |
| ls -la /var/gerrit/* |
| |
| if [ "$1" != "init" ] |
| then |
| echo "Running Gerrit ..." |
| exec /var/gerrit/bin/gerrit.sh run |
| fi |