chore: devcontainer pre-creates as vscode, resilient postStart script

This commit is contained in:
Jonas Miederer 2026-09-07 05:04:41 +00:00
parent 0a2b73f3b4
commit 74831483eb
3 changed files with 28 additions and 4 deletions

View file

@ -0,0 +1,19 @@
#!/bin/bash
# Post-start hook: copies SSH keys from the host into the container, then
# adds the git host. Never fails the devcontainer run: any missing file on
# the host (e.g. no id_rsa) must not abort the lifecycle command.
set -u
mkdir -p ~/.ssh
for f in id_rsa id_rsa.pub known_hosts; do
cp -f "/mnt/host-ssh/$f" ~/.ssh/ 2>/dev/null || true
done
ssh-keyscan -t ed25519,rsa gitlab.jonas-miederer.com >> ~/.ssh/known_hosts 2>/dev/null || true
chmod 700 ~/.ssh 2>/dev/null || true
chmod 600 ~/.ssh/id_rsa 2>/dev/null || true
chmod 644 ~/.ssh/id_rsa.pub ~/.ssh/known_hosts 2>/dev/null || true
exit 0