cavepedia/launch.sh

63 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
set -e
RELEASE=2.3
ln -sn /bigdata/archive/cavepedia/cavepedia-data ./cavepedia-data || true
build_docker () {
docker rm cavepedia-build || true
docker build -t cavepedia/cavepedia-build:latest ./src
docker create --name cavepedia-build cavepedia/cavepedia-build:latest
docker cp cavepedia-build:/go/src/app/cavepedia_linux_amd64 ./src/cavepedia_linux_amd64
docker cp cavepedia-build:/go/src/app/cavepedia_windows_amd64.exe ./src/cavepedia_windows_amd64.exe
}
build () {
pushd ./src &>/dev/null
go get honnef.co/go/tools/cmd/staticcheck
go get github.com/dgrijalva/jwt-go
go get github.com/zserge/lorca
gofmt -w .
# staticcheck .
CGO_ENABLED=1 GOARCH=amd64 go build -o ./cavepedia_linux_amd64 -v .
if [[ "$1" == "release" ]]; then
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc go build -ldflags -H=windowsgui -o ./cavepedia_windows_amd64.exe -v .
fi
popd &>/dev/null
}
# Default: bypass password and open in webview
run () {
./src/cavepedia_linux_amd64
}
# Disable webview, enable password
proxy () {
PROXY=1 PASSWORD=test ./src/cavepedia_linux_amd64
}
# Disable webview only
proxy_test () {
PROXY=1 ./src/cavepedia_linux_amd64
}
release () {
mkdir cavepedia-$RELEASE
mv src/{cavepedia_linux_amd64,cavepedia_windows_amd64.exe} ./cavepedia-$RELEASE/
mv cavepedia.bleve ./cavepedia-$RELEASE
mkdir cavepedia-$RELEASE/cavepedia-data/
cp -r cavepedia-data/{00_files,02_json} ./cavepedia-$RELEASE/cavepedia-data/
zip -r cavepedia-$RELEASE.zip ./cavepedia-$RELEASE
sudo cp cavepedia-$RELEASE.zip /bigdata/archive/cavepedia/release/
rm -rf cavepedia-$RELEASE
}
$@