#!/usr/bin/make -f

export DEB_GOMINCOMPAT := 1.26

export GOROOT := /usr/lib/go-1.26
export PATH := /usr/lib/go-1.26/bin:$(PATH)

export DH_GOLANG_INSTALL_EXTRA := internal/site/dist

# pocketbase
export GOFLAGS="-tags=no_ui"

%:
	dh ${@} --builddirectory=debian/_build --buildsystem=golang

execute_after_dh_auto_clean:
	$(MAKE) clean || true

execute_before_dh_auto_configure:
	# build-web-ui
	$(MAKE) build-web-ui

override_dh_auto_test:
	# disabled

override_dh_auto_install:
	dh_auto_install -- --no-source

	rm -f debian/tmp/usr/bin/fetchsmartctl
	mv debian/tmp/usr/bin/agent debian/tmp/usr/bin/beszel-agent
	mv debian/tmp/usr/bin/hub debian/tmp/usr/bin/beszel-hub

override_dh_installchangelogs:
	dh_installchangelogs supplemental/CHANGELOG.md
