#!/usr/bin/make -f

export DH_ALWAYS_EXCLUDE=.git
export DH_VERBOSE = 1

package = landscape-client
root_dir = debian/tmp
SHAREDIR = /usr/share/landscape
LIBDIR = /usr/lib/landscape

%:
	dh $@ --with python3 --buildsystem=pybuild


override_dh_auto_build:
	sed -i -e "s/^DEBIAN_REVISION = \"\"/DEBIAN_REVISION = \"-$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]*)-(.*),\2, p')\"/g" landscape/__init__.py
	dh_auto_build

override_dh_auto_install:
	dh_auto_install
	make -C apt-update
	install -D -o root -g root -m 755 debian/landscape-sysinfo.wrapper $(CURDIR)/$(root_dir)$(SHAREDIR)/landscape-sysinfo.wrapper
	install -D -o root -g root -m 755 apt-update/apt-update $(CURDIR)/$(root_dir)$(LIBDIR)/apt-update

override_dh_installsystemd:
	dh_installsystemd --no-enable --no-start
