feat: define configuration for ssh and mirror key

This commit is contained in:
Glenn Y. Rolland 2021-05-08 17:17:20 +02:00
parent 50b3b5ef68
commit 28609af439

View file

@ -17,11 +17,11 @@ fi
## Check existing variables
if [ -z "$GITIT_USER_EMAIL" ]; then
2>& echo "ERROR: Environment variable GITIT_USER_EMAIL not defined"
>&2 echo "ERROR: Environment variable GITIT_USER_EMAIL not defined"
exit 1
fi
if [ -z "$GITIT_USER_NAME" ]; then
2>& echo "ERROR: Environment variable GITIT_USER_NAME not defined"
>&2 echo "ERROR: Environment variable GITIT_USER_NAME not defined"
exit 1
fi
@ -40,9 +40,16 @@ git config --global user.name "$GITIT_USER_NAME"
if [ -n "$GITIT_REMOTE_REPOSITORY" ]; then
if [ -z "$GITIT_REMOTE_DOMAIN" ]; then
2>& echo "ERROR: Environment variable GITIT_REMOTE_DOMAIN not defined"
>&2 echo "ERROR: Environment variable GITIT_REMOTE_DOMAIN not defined"
exit 1
fi
mkdir -p /data/ssh
if [ ! -f /data/ssh/mirror_rsa ]; then
>&2 echo "ERROR: SSH Key file /data/ssh/mirror_rsa is missing."
>&2 echo " Please create it with 'ssh-keygen -f /data/ssh/mirror_rsa' ."
exit 1
fi
git remote remove origin
git remote add origin "$GITIT_REMOTE_REPOSITORY"
@ -62,6 +69,5 @@ if [ "$1" = 'gitit' ]; then
exec gitit "$@"
fi
exec "$@"