-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathentrypoint.sh
More file actions
32 lines (24 loc) · 812 Bytes
/
entrypoint.sh
File metadata and controls
32 lines (24 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# Entrypoint script for E2E configuration testing container
# Initializes SSH server via supervisor for Ansible connectivity
set -e
# Function to log messages
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >&2
}
log "Starting container initialization..."
# Create supervisor log directory
mkdir -p /var/log/supervisor
# Create SSH host keys if they don't exist
if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
log "Generating SSH host keys..."
ssh-keygen -A
fi
# Ensure SSH directory has proper permissions
chown torrust:torrust /home/torrust/.ssh
chmod 700 /home/torrust/.ssh
chmod 600 /home/torrust/.ssh/authorized_keys
# Signal that container is ready
log "Container initialization complete. Starting supervisor..."
# Execute the provided command (supervisor by default)
exec "$@"