Git key import again

This commit is contained in:
nold 2020-03-26 18:16:56 +01:00
parent 0108fcf653
commit 0dc25d5428
8 changed files with 69 additions and 71 deletions

View file

@ -1,17 +1,20 @@
#!/bin/bash
# This script updates the authorized_keys file
# Will clone/pull ssh-pubkeys from GIT_KEY_URL if set
set -e
source env.sh
if [ -d "${SSH_KEY_DIR}/clients/.git" ] ; then
cd "${SSH_KEY_DIR}/clients" || exit 0
git fetch
if ! git diff --quiet remotes/origin/HEAD; then
git -C "${SSH_KEY_DIR}/clients" fetch
if ! git -C "${SSH_KEY_DIR}/clients" diff --quiet remotes/origin/HEAD; then
echo "Pull from git repository"
git pull
git -C "${SSH_KEY_DIR}/clients" pull
create-client-dirs.sh
else
echo "$0: Nothing to do"
fi
elif [ ! -z "${KEY_GIT_URL}" ] ; then
git clone --depth=1 -b ${KEY_GIT_BRANCH} ${KEY_GIT_URL} ${SSH_KEY_DIR}/clients
fi
exit 0