#!/usr/bin/env bash
FILENAME="update"
rm -rf bin > /dev/null 2>&1
mkdir -p bin/{logs,static,docs}
if [ $1x = "releasex" ]; then
	FILENAME="release"
	mkdir -p bin/config
	cp config/*.ipdb bin/config/
	cp config/*.json bin/config/
	cp config/*.sql bin/config/
	cp config/*.conf bin/config/
	cp config/*.csv bin/config/
fi
rm -rf static/upload/* > /dev/null 2>&1
cp -r static bin/
cp -r docs bin/
cp readme.* bin/
go build -o gofly .
cp gofly bin
rm ${FILENAME}.tar.gz > /dev/null 2>&1
tar czf ${FILENAME}.tar.gz bin/
