#!/usr/bin/make -f

%:
	dh $@ --with runit,openrc,s6

execute_after_dh_auto_install:
	# Removing useless files
	rm -f debian/live-tools/usr/share/doc/live-tools/COPYING
	# s6-rc oneshot + ordering hooks (after umountroot, before halt/reboot)
	mkdir -p debian/live-tools/etc/s6-rc/sv/live-tools/dependencies.d \
	         debian/live-tools/etc/s6-rc/sv/halt/dependencies.d \
	         debian/live-tools/etc/s6-rc/sv/reboot/dependencies.d
	cp -a debian/s6-rc/live-tools/. debian/live-tools/etc/s6-rc/sv/live-tools/
	cp -a debian/s6-rc/halt/dependencies.d/live-tools \
	      debian/live-tools/etc/s6-rc/sv/halt/dependencies.d/
	cp -a debian/s6-rc/reboot/dependencies.d/live-tools \
	      debian/live-tools/etc/s6-rc/sv/reboot/dependencies.d/

override_dh_installinit:
	# SysV used start on 0/6 only; OpenRC maps that to the shutdown runlevel.
	dh_installinit --no-scripts

override_dh_installsystemd:
	:
