Fix Gerrit site init of gerrit-master in the docker setup
The start-script in the gerrit-master docker container, failed if
an existing site was mounted. The error occurred during initialization.
Thus, this change starts initialization only if the site is not
initialized yet.
Change-Id: Ieb1b5b519a8e1862e6f6681792ba2c550c15fe61
diff --git a/container-images/gerrit-master/tools/start b/container-images/gerrit-master/tools/start
index b9c54c5..764a34e 100755
--- a/container-images/gerrit-master/tools/start
+++ b/container-images/gerrit-master/tools/start
@@ -7,9 +7,13 @@
/var/tools/validate_site.sh $dir $gerrit_uid $gerrit_gid || exit 1
done
-java -jar /var/gerrit/bin/gerrit.war init \
- --batch \
- -d /var/gerrit
+/var/gerrit/bin/gerrit.sh check >/dev/null
+if [[ $? -eq 1 ]]; then
+ echo "Performing Gerrit site initialization..."
+ java -jar /var/gerrit/bin/gerrit.war init \
+ --batch \
+ -d /var/gerrit
+fi
java -jar /var/gerrit/bin/gerrit.war reindex \
-d /var/gerrit