blob: ffea5f30baf2e91a943715fff811d243df00f876 [file] [log] [blame]
Sergiusz Bazanskia7e26cc2019-06-21 20:38:35 +02001#!/bin/bash -e
2
3ls -la /var/gerrit/*
4
5if [ ! -d /var/gerrit/git/All-Projects.git ] || [ "$1" == "init" ]
6then
7 echo "Initializing Gerrit site ..."
8 java -jar /var/gerrit/bin/gerrit.war init --batch --install-all-plugins -d /var/gerrit
9 java -jar /var/gerrit/bin/gerrit.war reindex -d /var/gerrit
10fi
11
12echo "Running hscloud init setup..."
13
14rm -f /var/gerrit/etc/gerrit.config
15cp /var/gerrit-config/gerrit.config /var/gerrit/etc/gerrit.config
16
17rm -f /var/gerrit/etc/secure.config
18cp /var/gerrit-secure/secure.config /var/gerrit/etc/secure.config
19
20cp /var/gerrit-plugins/* /var/gerrit/plugins/
21
22echo "Starting config updater..."
23# Keep copying config over in background. We cannot run directly from
24# the configmap filesystem as gerrit really wants a read-write FS.
25(
26 src=/var/gerrit-config/gerrit.config
27 dst=/var/gerrit/etc/gerrit.config
28 while true; do
29 sleep 60
30 if ! cmp -s $src $dst; then
31 echo "HSCLOUD: bumping config"
32 cp $src $dst
33 fi
34 done
35) &
36
37ls -la /var/gerrit/*
38
39if [ "$1" != "init" ]
40then
41 echo "Running Gerrit ..."
42 exec /var/gerrit/bin/gerrit.sh run
43fi