From 7c9679e7acbbaec1691d073220f7efa73bc11e89 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Sat, 22 Aug 2020 19:52:48 +0200 Subject: [PATCH] Another attempt --- root/entrypoint.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/root/entrypoint.sh b/root/entrypoint.sh index 98f46f9..f7cc7a3 100755 --- a/root/entrypoint.sh +++ b/root/entrypoint.sh @@ -1,11 +1,6 @@ #!/bin/bash set -Eeo pipefail -if [ ! -e /etc/openvpn/sshd_config ]; then - echo "Configuration file sshd_config not found. Initializing..." - cp /config/sshd_config /etc/ssh/sshd_config -fi - # shellcheck disable=2154 trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR @@ -20,6 +15,14 @@ function log() { echo "[$0] $*" >&2 } +# Check that `sshd_config` exists +# In case `/etc/ssh/` is mounted as a volume the file `sshd_config` is not +# guaranteed to be there +if [ ! -e /etc/ssh/sshd_config ]; then + echo "Configuration file sshd_config not found. Initializing..." + cp /config/sshd_config /etc/ssh/sshd_config +fi + # Allow running other programs, e.g. bash if [[ -z "$1" || "$1" =~ $reArgsMaybe ]]; then startSshd=true