#!/usr/bin/make -f

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh $@

override_dh_missing:
	dh_missing
	mkdir -pv debian/calamares-settings-tileos-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules
	cp -vr common/modules/bootloader-config debian/calamares-settings-tileos-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules
	cp -vr common/modules/dpkg-unsafe-io debian/calamares-settings-tileos-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules
	cp -vr common/modules/dpkg-unsafe-io-undo debian/calamares-settings-tileos-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules
	cp -vr common/modules/sources-final debian/calamares-settings-tileos-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules
	mkdir -pv debian/calamares-settings-tileos-common/etc/calamares/modules
	mkdir -pv debian/calamares-settings-tileos-common/usr/sbin
	cp -vr common/modules/*.conf debian/calamares-settings-tileos-common/etc/calamares/modules
	mkdir -pv debian/calamares-settings-tileos-common/usr/share/calamares/helpers
	cp -vr helpers/* debian/calamares-settings-tileos-common/usr/share/calamares/helpers
	chmod -R 755 debian/calamares-settings-tileos-common/usr/lib/
	chmod 644 debian/calamares-settings-tileos-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules/bootloader-config/module.desc
	chmod 644 debian/calamares-settings-tileos-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules/dpkg-unsafe-io/module.desc
	chmod 644 debian/calamares-settings-tileos-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules/dpkg-unsafe-io-undo/module.desc
	chmod 644 debian/calamares-settings-tileos-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules/sources-final/module.desc
