#!/bin/sh set -e # Set up git-shell-commands in the repositories directory (volume-safe) echo "Setting up git-shell-commands..." mkdir -p /var/lib/git/repositories/git-shell-commands cp -r /usr/local/share/git-shell-commands/* /var/lib/git/repositories/git-shell-commands/ chmod +x /var/lib/git/repositories/git-shell-commands/* chown -R code:code /var/lib/git/repositories chmod 755 /var/lib/git/repositories # Verify setup echo "Git-shell commands installed:" ls -la /var/lib/git/repositories/git-shell-commands/ # Set up SSH host keys (with volume support) echo "Setting up SSH host keys..." mkdir -p /etc/ssh/host_keys # Check if host keys are mounted from a volume, if not generate them if [ -f /etc/ssh/host_keys/ssh_host_rsa_key ]; then echo "Using existing host keys from volume..." cp /etc/ssh/host_keys/ssh_host_* /etc/ssh/ else echo "Generating new SSH host keys..." ssh-keygen -A # Copy generated keys to the persistent location if it's writable if [ -w /etc/ssh/host_keys ]; then cp /etc/ssh/ssh_host_* /etc/ssh/host_keys/ 2>/dev/null || true fi fi echo "Starting SSH daemon..." /usr/sbin/sshd echo "Starting fcgiwrap..." su -l www-data -s /bin/bash -c "/usr/sbin/fcgiwrap -s unix:/run/sock/fcgiwrap.socket" & echo "Waiting for fcgiwrap socket to appear..." while [ ! -S /run/sock/fcgiwrap.socket ]; do sleep 0.1 done echo "fcgiwrap socket found." echo "Starting Nginx..." exec nginx -g 'daemon off;'