2013-06-11 23:13:50 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-06-13 16:43:09 +08:00
|
|
|
verbose=no
|
2013-07-04 18:50:57 +08:00
|
|
|
tiler_url=http://dev.localhost.lan:8181/tiles/layergroup
|
|
|
|
|
|
|
|
# This is for direct windshaft connection
|
|
|
|
#tiler_url=http://dev.localhost.lan:8083/database/cartodb_dev_user_1_db/layergroup
|
2013-06-13 16:43:09 +08:00
|
|
|
|
|
|
|
while test -n "$1"; do
|
|
|
|
if test "$1" = "-v"; then
|
|
|
|
verbose=yes
|
2013-07-04 18:50:57 +08:00
|
|
|
elif test -z "$cfg"; then
|
|
|
|
cfg="$1"
|
2013-06-13 16:43:09 +08:00
|
|
|
else
|
2013-07-04 18:50:57 +08:00
|
|
|
tiler_url="$1"
|
2013-06-13 16:43:09 +08:00
|
|
|
fi
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -z "$cfg"; then
|
2013-07-04 18:50:57 +08:00
|
|
|
echo "Usage: $0 [-v] <config_file> [<tiler_url>]" >&2
|
|
|
|
echo "Default <tiler_url> is ${tiler_url}" >&2
|
2013-06-11 23:13:50 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-07-04 18:50:57 +08:00
|
|
|
cmd="curl -skH Content-Type:application/json --data-binary @${cfg} ${tiler_url}"
|
2013-07-04 17:15:21 +08:00
|
|
|
if test x${verbose} = xyes; then
|
|
|
|
cmd="${cmd} -v"
|
|
|
|
fi
|
2013-07-04 17:04:12 +08:00
|
|
|
res=`${cmd}`
|
|
|
|
if test $? -gt 0; then
|
|
|
|
echo "curl command failed: ${cmd}"
|
|
|
|
fi
|
2013-06-13 16:43:09 +08:00
|
|
|
|
|
|
|
if test x${verbose} = xyes; then
|
|
|
|
echo "${res}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
tok=`echo "$res" | sed 's/.*"layergroupid":"\([^"]*\)".*/\1/'`
|
|
|
|
echo $tok
|