#!/usr/bin/make -f

%:
	dh ${@} --parallel

override_dh_auto_build:
	# disabled

override_dh_auto_install:
	dh_auto_install

	rm -f debian/open-infrastructure-system-images/usr/share/doc/system-images/CHANGELOG.txt
	rm -f debian/open-infrastructure-system-images/usr/share/doc/system-images/LICENSE.txt

	mv debian/open-infrastructure-system-images/usr/share/doc/system-images debian/open-infrastructure-system-images/usr/share/doc/open-infrastructure-system-images

override_dh_compress:
	dh_compress -Xusr/share/system-images

override_dh_link:
	dh_link

	for DIRECTORY in debian/*/usr/share/system-images/*; \
	do \
		IMAGE="$$(basename $${DIRECTORY})"; \
		rm -rf debian/open-infrastructure-system-images/usr/share/system-images/$${IMAGE}/config/bootloaders; \
		cp -a share/images/$${IMAGE}/config/bootloaders debian/open-infrastructure-system-images/usr/share/system-images/$${IMAGE}/config/bootloaders; \
	done
