fix: entrypoint init

This commit is contained in:
Ravinou 2023-09-17 17:42:30 +02:00
parent f4479bb2f8
commit b5b4f1a766
No known key found for this signature in database
GPG key ID: EEEE670C40F6A4D7

View file

@ -14,10 +14,12 @@ init_ssh_server() {
fi
}
create_ssh_directory() {
check_ssh_directory() {
if [ ! -d "$SSH_DIR" ]; then
echo "The .ssh directory does not exist, creating..."
mkdir -p "$SSH_DIR"
echo "The .ssh directory does not exist, you need to mount it as docker volume."
exit 1
else
chown borgwarehouse:borgwarehouse "$SSH_DIR"
chmod 700 "$SSH_DIR"
fi
}
@ -26,20 +28,22 @@ create_authorized_keys_file() {
if [ ! -f "$AUTHORIZED_KEYS_FILE" ]; then
echo "The authorized_keys file does not exist, creating..."
touch "$AUTHORIZED_KEYS_FILE"
chmod 600 "$AUTHORIZED_KEYS_FILE"
fi
chmod 600 "$AUTHORIZED_KEYS_FILE"
}
create_repos_directory() {
check_repos_directory() {
if [ ! -d "$REPOS_DIR" ]; then
echo "The repos directory does not exist, creating..."
mkdir -p "$REPOS_DIR"
echo "The repos directory does not exist, you need to mount it as docker volume."
exit 2
fi
chown borgwarehouse:borgwarehouse "$REPOS_DIR"
chmod 700 "$REPOS_DIR"
}
init_ssh_server
create_ssh_directory
check_ssh_directory
create_authorized_keys_file
create_repos_directory
check_repos_directory
exec "$@"