125 lines
4.0 KiB
Makefile
125 lines
4.0 KiB
Makefile
.PHONY: build
|
|
|
|
VERSION = $(shell git describe --tags)
|
|
|
|
# create the go.mod and go.sum if this is a brand new repo
|
|
# REDOMOD = $(shell if [ -e go.mod ]; then echo go.mod; else echo no go mod; fi)
|
|
REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE= go mod init; GO111MODULE= go mod tidy; fi)
|
|
|
|
PROTOGEN= $(shell if [ -e /usr/bin/protoc-gen-go ]; then echo probably wrong protoc-gen-go exists; else echo ok; fi)
|
|
|
|
PROTOGENLOCAL= $(shell if [ -e ~/go/bin/protoc-gen-go ]; then echo ~/go/bin/protoc-gen-go exists ok; else echo build the right one with: make protogen && exit 0; fi)
|
|
|
|
all:
|
|
@echo
|
|
@echo the build is complicated right now because you need
|
|
@echo the google version of protoc-gen-go which is not the one in debian
|
|
@echo sid right now. until that is fixed, this is a pain in the ass
|
|
@echo
|
|
@echo also, makefiles are awesome, but only for simple shit. this shit is
|
|
@echo way to complicated to be here so Im rather leaning towards making
|
|
@echo a go binary just to build this
|
|
@echo
|
|
@echo for now, add mirrors.wit.com to apt and run 'apt install virtigo'
|
|
@echo
|
|
|
|
build-attempt1:
|
|
@echo ${PROTOGEN}
|
|
@echo ${PROTOGENLOCAL}
|
|
@if [ ! -f ~/go/bin/protc-gen-go ]; then \
|
|
echo "you have not build ~/go/bin/protoc-gen-go from google's repo"; \
|
|
echo "run 'make protogen'" \
|
|
exit -1; \
|
|
fi
|
|
make build
|
|
./virtigo --version
|
|
@echo build worked
|
|
|
|
build:
|
|
GO111MODULE=off go build -v -ldflags "-X main.Version=${VERSION} -X gui.GUIVERSION=${VERSION}"
|
|
|
|
# makes a .deb package
|
|
debian:
|
|
rm -f ~/incoming/virtigo*deb
|
|
go-deb --no-gui --repo go.wit.com/apps/virtigo
|
|
|
|
xml-add:
|
|
./virtigo --libvirt ~/libvirt/*.xml --xml-ignore-disk=true
|
|
|
|
xml-add-save:
|
|
./virtigo --libvirt ~/libvirt/*.xml --xml-ignore-disk=true --save
|
|
|
|
start-pihole.wit.com: build
|
|
rm -f /tmp/blahcarr.xml /tmp/pihole.wit.com.xml
|
|
./virtigo --start pihole.wit.com
|
|
./virtigo --libvirt /tmp/pihole.wit.com.xml
|
|
|
|
start-pihole.wit.com-http:
|
|
curl --silent http://localhost:8080/start?hostname=pihole.wit.com
|
|
|
|
old-start-all-droplets:
|
|
curl --silent http://localhost:8080/start?start=git.wit.org
|
|
curl --silent http://localhost:8080/start?start=go.wit.com
|
|
curl --silent http://localhost:8080/start?start=rdate.wit.com
|
|
curl --silent http://localhost:8080/start?start=uptime.wit.com
|
|
curl --silent http://localhost:8080/start?start=www.wit.com
|
|
curl --silent http://localhost:8080/start?start=ping.wit.com
|
|
curl --silent http://localhost:8080/start?start=wekan.wit.com
|
|
curl --silent http://localhost:8080/start?start=caddy.wit.org
|
|
curl --silent http://localhost:8080/start?start=immich.wit.org
|
|
curl --silent http://localhost:8080/start?start=bernacchi
|
|
@#curl --silent http://localhost:8080/start?start=jcarr
|
|
@# ./virtigo --start jcarr
|
|
|
|
curl-uptime:
|
|
curl --silent http://localhost:8080/uptime
|
|
|
|
curl-droplets:
|
|
curl --silent http://localhost:8080/droplets
|
|
|
|
curl-writeconfig:
|
|
curl --silent http://localhost:8080/writeconfig
|
|
|
|
# this is for release builds using the go.mod files
|
|
release-build:
|
|
@echo ${REDOMOD}
|
|
go build -v -ldflags "-X main.Version=${VERSION} -X gui.GUIVERSION=${VERSION}"
|
|
|
|
# autofixes your import headers in your golang files
|
|
goimports:
|
|
goimports -w *.go
|
|
|
|
# remake the go.mod and go.sum files
|
|
redomod:
|
|
rm -f go.*
|
|
GO111MODULE= go mod init
|
|
GO111MODULE= go mod tidy
|
|
|
|
clean:
|
|
rm -f go.*
|
|
rm -f virtigo*
|
|
|
|
# git clone the sources and all the golang dependancies into ~/go/src
|
|
# if you don't have go-clone, you can get it from http://go.wit.com/
|
|
git-clone:
|
|
go-clone --recursive --go-src --no-work go.wit.com/apps/go-clone
|
|
go-clone --recursive --go-src --no-work go.wit.com/apps/virtigo
|
|
go-clone --recursive --go-src --no-work go.wit.com/apps/gowebd
|
|
go-clone --recursive --go-src --no-work go.wit.com/lib/daemons/virtigod
|
|
|
|
http-uptime:
|
|
curl --silent http://localhost:8080/uptime
|
|
|
|
http-droplets:
|
|
curl --silent http://localhost:8080/droplets
|
|
|
|
http-missing:
|
|
curl --silent http://localhost:8080/missing
|
|
|
|
http-dumplibvirtxml:
|
|
curl --silent http://localhost:8080//dumplibvirtxml
|
|
|
|
protogen:
|
|
go-clone google.golang.org/protobuf
|
|
cd ~/go/src/google.golang.org/protobuf/cmd/protoc-gen-go && go install
|