
.PHONY: release dev deps install skel

release: deps
	CGO_ENABLED=1 go build -buildvcs=true .

dev:
	go build .
	./podterminal

deps:
	go mod download
	go mod tidy

install: 
	cp podterminal /usr/local/bin/podterminal
	ifeq ($(shell id podterminal 2>/dev/null))
	useradd -r -s /bin/false podterminal 
	endif
	mkdir -p /etc/podterminal/skel
	cp -n ./exampleconfig.yaml /etc/podterminal/config.yaml
	cp -n podterminal.service /etc/systemd/system/
	systemctl daemon-reload
	systemctl enable --now podterminal

skel:
	echo "Taring up /etc/podterminal/skel/"
	tar -czvf /etc/podterminal/skel.tar.gz -C /etc/podterminal/skel .
