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/ |
Serge Bazanski | 7f5f209 | 2023-10-08 14:01:04 +0000 | [diff] [blame] | 21 | mkdir -p /var/gerrit/hooks/ |
| 22 | cp /var/gerrit-hooks/* /var/gerrit/hooks/ |
Sergiusz Bazanski | a7e26cc | 2019-06-21 20:38:35 +0200 | [diff] [blame] | 23 | |
Sergiusz Bazanski | a7e26cc | 2019-06-21 20:38:35 +0200 | [diff] [blame] | 24 | echo "Starting config updater..." |
| 25 | # Keep copying config over in background. We cannot run directly from |
| 26 | # the configmap filesystem as gerrit really wants a read-write FS. |
| 27 | ( |
| 28 | src=/var/gerrit-config/gerrit.config |
| 29 | dst=/var/gerrit/etc/gerrit.config |
| 30 | while true; do |
| 31 | sleep 60 |
| 32 | if ! cmp -s $src $dst; then |
| 33 | echo "HSCLOUD: bumping config" |
| 34 | cp $src $dst |
| 35 | fi |
| 36 | done |
| 37 | ) & |
| 38 | |
| 39 | ls -la /var/gerrit/* |
| 40 | |
| 41 | if [ "$1" != "init" ] |
| 42 | then |
| 43 | echo "Running Gerrit ..." |
| 44 | exec /var/gerrit/bin/gerrit.sh run |
| 45 | fi |