#! /bin/bash
set -e
for env in 'GOROOT' 'GOBIN' ; do
    if [ -z '${$env}' ]; then
        echo "$env not defined. Is go installed?"
        exit 1
    fi
done
export GOPATH=`pwd`
echo "Installing required go libraries..."
for req in `cat go_deps.lst`; do
    echo -n "   $req..."
    go get -v $req
    echo " done"
done
echo "Libraries installed"
if [ ! -e config.ini ]; then
    echo "Copying sample ini file to config.ini"
    cp config.sample.ini config.ini
fi
echo "Please edit config.ini for local settings."

#! /bin/bash
set -e
for env in 'GOROOT' 'GOBIN' ; do
    if [ -z '${$env}' ]; then
        echo "$env not defined. Is go installed?"
        exit 1
    fi
done
export GOPATH=`pwd`
echo "Installing required go libraries..."
for req in `cat go_deps.lst`; do
    echo -n "   $req..."
    go get -v $req
    echo " done"
done
echo "Libraries installed"
if [ ! -e config.ini ]; then
    echo "Copying sample ini file to config.ini"
    cp config.sample.ini config.ini
fi
if [ ! -z '$HOST' ]; then
    echo "Setting local shard host name"
    echo "shard.currentHost = $HOST:8080" >> config.ini
fi
echo "Please edit config.ini for local settings."

Add auto shard.host to config.ini if $HOST defined.
Add auto shard.host to config.ini if $HOST defined.

AWS does not provide a useful os.hostname() value. This hack addresses
this by sort of taking advantage of a different hack I have installed.
in my .bashrc file I have which is basically:

HOST=`/usr/bin/wget -q -O-
http://169.254.169.254/latest/meta-data/public-hostname`

also useful, would be either the internal or external IP address.
Basically, any way we can connect to the machine that actually handles
this.
