#!/bin/bash

echo "$SSHKEY" > /tmp/keyfile
chmod 0400 /tmp/keyfile

GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url}

if [ $? == '0' ]
then
    echo "git clone the ${git_url} done"
    echo "All tasks complete!!!"
    echo "Attention! Before generate or renew certificates manual"
    echo "Please read https://git.sdsys.ru/sdsys/pki/src/master/iru/wildcard/acme-dns/README.md"
else
    echo "Cannot git clone the ${git_url}"; exit 1
fi

exec "$@"