From 28609af439ab1e7ec0dd1f8fc8ab2ca6b944af6d Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sat, 8 May 2021 17:17:20 +0200 Subject: [PATCH] feat: define configuration for ssh and mirror key --- docker-entrypoint.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 03186fe..aaa28c8 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -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 "$@"