mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-27 22:59:27 +00:00
65d5bdff08
Add Dockerfiles for alpine and debian images, based on balenalib/arch-distro-node images. Change-type: minor Signed-off-by: Kyle Harding <kyle@balena.io>
31 lines
819 B
Bash
31 lines
819 B
Bash
#!/bin/bash
|
|
|
|
# start dockerd if env var is set
|
|
if [ "${DOCKERD}" = "1" ]
|
|
then
|
|
[ -e /var/run/docker.sock ] && rm /var/run/docker.sock
|
|
dockerd &
|
|
fi
|
|
|
|
# load private ssh key if one is provided
|
|
if [ -n "${SSH_PRIVATE_KEY}" ]
|
|
then
|
|
# if an ssh agent socket was not provided, start our own agent
|
|
[ -e "${SSH_AUTH_SOCK}" ] || eval "$(ssh-agent -s)"
|
|
echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add -
|
|
fi
|
|
|
|
# space-separated list of balena CLI commands (filled in through `sed`
|
|
# in a Dockerfile RUN instruction)
|
|
CLI_CMDS="help"
|
|
|
|
# treat the provided command as a balena CLI arg...
|
|
# 1. if the first word matches a known entry in CLI_CMDS
|
|
# 2. OR if the first character is a hyphen (eg. -h or --debug)
|
|
if [[ " ${CLI_CMDS} " =~ " ${1} " ]] || [ "${1:0:1}" = "-" ]
|
|
then
|
|
exec balena "$@"
|
|
else
|
|
exec "$@"
|
|
fi
|