#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/dpkg/default.mk
export DESTDIR=$(shell pwd)/debian/tmp

DIST := $(shell grep ^VERSION_CODENAME= /etc/os-release | cut -d = -f 2)

%:
	dh $@

override_dh_auto_build:

override_dh_auto_install:
	make -C repos install-vm-debian

override_dh_gencontrol:
	echo "dist: $(DIST)"
	if [ "$(DIST)" != "focal" ]; then \
		echo "qubessalt:Depends=qubes-mgmt-salt-vm-connector" \
			>> debian/qubes-vm-recommended.substvars; \
	fi
	if [ "$(DIST)" != "bullseye" ] && [ "$(DIST)" != "jammy" ] && [ "$(DIST)" != "focal" ]; then \
		echo "pulse:Depends=pipewire-qubes" >> debian/qubes-vm-recommended.substvars; \
	else \
		echo "pulse:Depends=pulseaudio-qubes" >> debian/qubes-vm-recommended.substvars; \
	fi
	dh_gencontrol
