#!/bin/bash


##
## ssh config
##

cp src/etc/ssh/lxc_git_access_id_rsa /etc/ssh/lxc_git_access_id_rsa
chmod 0600 /etc/ssh/lxc_git_access_id_rsa

SSH_CONFIG_DIR=~/.ssh

mkdir -p "$SSH_CONFIG_DIR"

if ! [ -e "$SSH_CONFIG_DIR/config.pre-install" ]; then
    cp "$SSH_CONFIG_DIR/config" "$SSH_CONFIG_DIR/config.pre-install"
else
    cp "$SSH_CONFIG_DIR/config.pre-install" "$SSH_CONFIG_DIR/config"
fi


cat <<EOF >> "$SSH_CONFIG_DIR"/config

Host 0k-ro
    Hostname git.0k.io
    Port 10022
    User lxc-user
    IdentityFile /etc/ssh/lxc_git_access_id_rsa
    UserKnownHostsFile /dev/null
    StrictHostKeyChecking no

EOF