#!/usr/bin/make -f

export PATH := /usr/lib/go-1.13/bin:${PATH}
# do what newer dh-golang would do to work with Go 1.13
export GOCACHE := ${CURDIR}/_build/go-build
export GO111MODULE = off

%:
	dh $@ --builddirectory=_build --buildsystem=golang --with=golang,systemd

override_dh_auto_configure:
	cp -r debian/extra/vendor ./
	dh_auto_configure

override_dh_auto_build:
	dh_auto_build -O--buildsystem=golang -- -ldflags="-s -w -X main.version=$(shell dpkg-parsechangelog -S Version)"

override_dh_auto_install:
	dh_auto_install -- --no-source

override_dh_installsystemd:
	dh_installsystemd google-guest-agent.service
	dh_installsystemd --no-start --no-restart-after-upgrade google-startup-scripts.service google-shutdown-scripts.service

override_dh_clean:
	dh_clean vendor/
