docker-borgserver/data/update-ssh-keys.sh
Pietro 0108fcf653
Split run.sh and add git retrival
This patch modularize run.sh, adding two new helper scripts and
make it possible to specify a git repository for ssh keys via a
new env variable `BORG_SSHKEYS_REPO`.

the modularization add two new files :
- `env.sh` : define a few envriroment variables
- `create-client-dirs.sh`  : update and create user directories and
  re-create authorized_keys

We also add a new script `update-ssh-keys.sh` to be called regurlarly
in a cron job to check if the git repository is up-to-date and
eventually adding/removing users.
2020-03-24 14:03:24 +01:00

18 lines
304 B
Bash
Executable file

#!/bin/bash
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
echo "Pull from git repository"
git pull
create-client-dirs.sh
else
echo "$0: Nothing to do"
fi
fi