Skip to content
Snippets Groups Projects
Commit aa10a96e authored by jurgenhaas's avatar jurgenhaas
Browse files

#25 Improve code to support ssh key forwarding

parent 7f3cf17c
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
# Credit to https://github.com/uber-common/docker-ssh-agent-forward
# for this script to make L3D working on MaxOs/OSX too.
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
L3DHOSTOS="$(uname -s)"
case "${L3DHOSTOS}" in
Linux*)
SSHAUTH=${SSH_AUTH_SOCK}
SSHAUTHSOCK=/ssh-agent
;;
Darwin*)
${SCRIPTPATH}/prepareMac4L3d
SSHAUTH=ssh-agent
SSHAUTHSOCK=/ssh-agent/ssh-agent.sock
;;
*)
echo "Unkown OS"
exit
esac
ID=$(docker container ls --all -q -f name=^l3drun$)
if [[ ! -n ${ID} ]]; then
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
${SCRIPTPATH}/prepareMac4L3d
docker run --name=l3drun -dt --rm \
--env SCRIPTPATH=${SCRIPTPATH} \
--volume /var/run/docker.sock:/var/run/docker.sock \
......@@ -12,13 +30,6 @@ fi
if [[ -f ".env" ]]; then
export $(cat .env | xargs) > /dev/null 2>&1
fi
if [[ "$L3DHOSTOS" == "Linux" ]]; then
SSHAUTH=${SSH_AUTH_SOCK}
SSHAUTHSOCK=/ssh-agent
else
SSHAUTH=ssh-agent
SSHAUTHSOCK=/ssh-agent/ssh-agent.sock
fi
docker exec -it \
--env HOMEDIR=${HOME} \
--env WORKDIR=${PWD} \
......
#!/usr/bin/env bash
# Credit to https://github.com/uber-common/docker-ssh-agent-forward
# for this script to make L3D working on MaxOs/OSX too.
export L3DHOSTOS="$(uname -s)"
if [[ "$L3DHOSTOS" == "Linux" ]]; then
exit
fi
set -eo pipefail
IMAGE_NAME=uber/ssh-agent-forward:latest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment