Mon, 10 Sep 2018 13:52:35 +0100
Revamp console output to be driven by log_data()
94 | 1 | #!/bin/bash |
2 | ||
3 | ARGS="" | |
4 | ||
5 | if [[ "$SERVER_HOST" ]]; then | |
6 | ARGS="$ARGS -h $SERVER_HOST"; | |
7 | else | |
8 | # In the interests of sane convenient defaults, discover the host | |
9 | # IP address (only possible in bridged networks), and default to that | |
10 | 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)) | |
11 | ||
12 | if [[ "$GATEWAY_IP" != "0.0.0.0" ]]; then | |
13 | ARGS="$ARGS -h $GATEWAY_IP" | |
14 | fi | |
15 | fi | |
16 | if [[ "$SERVER_PORT" ]]; then | |
17 | ARGS="$ARGS -p $SERVER_PORT"; | |
18 | fi | |
19 | ||
20 | exec /usr/local/bin/scansion $ARGS "$@" |