misc/docker-entrypoint.sh

Sun, 30 Dec 2018 09:43:36 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 30 Dec 2018 09:43:36 +0000
changeset 164
14500a149b31
parent 94
1b3e848b4394
permissions
-rw-r--r--

client: Ignore timeout timer if we received a stanza

#!/bin/bash

ARGS=""

if [[ "$SERVER_HOST" ]]; then
	ARGS="$ARGS -h $SERVER_HOST";
else
	# In the interests of sane convenient defaults, discover the host
	# IP address (only possible in bridged networks), and default to that
	GATEWAY_IP=$(printf "%d.%d.%d.%d" $(awk '$2 == 00000000 { for (i = 8; i >= 2; i=i-2) { print "0x" substr($3, i-1, 2) } }' /proc/net/route))

	if [[ "$GATEWAY_IP" != "0.0.0.0" ]]; then
		ARGS="$ARGS -h $GATEWAY_IP"
	fi
fi
if [[ "$SERVER_PORT" ]]; then
	ARGS="$ARGS -p $SERVER_PORT";
fi

exec /usr/local/bin/scansion $ARGS "$@"

mercurial