#!/bin/sh set -e if [ ! -d /bootstrap/keys/git ]; then echo "ERROR: Can't find SSH public keys (ending in '.pub') in /bootstrap/keys/git" exit 1 fi if [ ! -d /bootstrap/keys/sshd_host_keys/ ]; then echo "ERROR: Can't find SSH host keys /bootstrap/keys/sshd_host_keys" exit 1 fi cp -R /bootstrap/keys/git/* /var/lib/git/.gitolite/keydir/ # NOTE: A symlink is not supported for gitolite.conf...see Dockerfile for hack if [ -f /var/lib/git/.gitolite/conf/gitolite.conf ]; then rm /var/lib/git/.gitolite/conf/gitolite.conf ln -s /bootstrap/configs/gitolite.conf /var/lib/git/.gitolite/conf/gitolite.conf fi echo "Configuring gitolite...ignore warnings about brand new install" gitolite compile gitolite setup --hooks-only >/dev/null gitolite trigger POST_COMPILE >/dev/null mkdir /srv/sshd/host_keys cp /bootstrap/keys/sshd_host_keys/ssh_host_rsa_key /srv/sshd/host_keys/ cp /bootstrap/keys/sshd_host_keys/ssh_host_rsa_key.pub /srv/sshd/host_keys/ chmod 400 /srv/sshd/host_keys/ssh_host_rsa_key echo "Starting git daemon in background" git daemon --base-path=/srv/git/repos --detach echo "Starting SSHD in foreground" /usr/sbin/sshd -f /srv/sshd/sshd_config -De