#!/bin/sh

[ -f /var/lib/fic/ssh/sshd_config ] && exit 0

mkdir -p /var/lib/fic/ssh/

cp /containers/services/sshd/lower/etc/ssh/* /var/lib/fic/ssh/

mount -o bind /dev /containers/services/sshd/lower/dev
mount -o bind /proc /containers/services/sshd/lower/proc
mount -o bind /sys /containers/services/sshd/lower/sys
mount -o bind /var/lib/fic/ssh/ /containers/services/sshd/lower/etc/ssh

chroot /containers/services/sshd/lower/ ssh-keygen -A

umount /containers/services/sshd/lower/dev /containers/services/sshd/lower/proc /containers/services/sshd/lower/sys /containers/services/sshd/lower/etc/ssh
