blob: f3032635abebf8f2bd8c17760e093ee02e6d6438 [file] [log] [blame]
#!/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/static
cp -r /var/gerrit-theme/*png /var/gerrit/static/
cp -r /var/gerrit-theme/*css /var/gerrit/etc/
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