#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_install:
	dh_auto_install
	install -D -m755 debian/makedumpfile-static.initramfs-hook \
	  debian/makedumpfile-static/usr/share/initramfs-tools/hooks/makedumpfile

override_dh_installinit:
	# Start right after syslog is available, and don't bother stopping
	# (which just unloads the kdump kernel) so that we can catch crashes
	# all the way until actual shutdown.
	dh_installinit -pkdump-tools -- start 11 2 3 4 5 .

# The upstream Makefile modifies makedumpfile.8 in place, so without this hack
# (or a patch to the Makefile, which would be harder to maintain), our clean
# target won't get us back to the original source.
override_dh_auto_build:
	cp makedumpfile.8 makedumpfile.8.orig
	dh_auto_build

override_dh_auto_clean:
	if [ -f makedumpfile.8.orig ]; then \
		mv makedumpfile.8.orig makedumpfile.8; \
	fi
	dh_auto_clean
