Sergiusz Bazanski | a7e26cc | 2019-06-21 20:38:35 +0200 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | |
| 3 | ls -la /var/gerrit/* |
| 4 | |
| 5 | if [ ! -d /var/gerrit/git/All-Projects.git ] || [ "$1" == "init" ] |
| 6 | then |
| 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 |
| 10 | fi |
| 11 | |
| 12 | echo "Running hscloud init setup..." |
| 13 | |
| 14 | rm -f /var/gerrit/etc/gerrit.config |
| 15 | cp /var/gerrit-config/gerrit.config /var/gerrit/etc/gerrit.config |
| 16 | |
| 17 | rm -f /var/gerrit/etc/secure.config |
| 18 | cp /var/gerrit-secure/secure.config /var/gerrit/etc/secure.config |
| 19 | |
| 20 | cp /var/gerrit-plugins/* /var/gerrit/plugins/ |
| 21 | |
| 22 | echo "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 | |
| 37 | ls -la /var/gerrit/* |
| 38 | |
| 39 | if [ "$1" != "init" ] |
| 40 | then |
| 41 | echo "Running Gerrit ..." |
| 42 | exec /var/gerrit/bin/gerrit.sh run |
| 43 | fi |