#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules file - for whereami
# Copyright 1999-2006 by Andrew McMillan
# Based on the pcmcia package by Brian Mays
# Patterned after the hello package by Ian Jackson.

override_dh_auto_clean:
	rm -f man/*.?

override_dh_installinit:
	dh_installinit --no-stop-on-upgrade --update-rcd-params="defaults 35 65"

override_dh_install:
	dh_install

# If we want to run other than in "pre-up" then we should include something like this.  At this stage just "pre-up" seems right-ish...
# 	(cd debian/whereami/etc/network; ln -s ../if-pre-up.d/whereami if-up.d/whereami; ln -s ../if-pre-up.d/whereami if-post-down.d/whereami; ln -s ../if-pre-up.d/whereami if-down.d/whereami)

	mkdir -p debian/whereami/etc/apm/scripts.d debian/whereami/etc/dhcp/dhclient-exit-hooks.d debian/whereami/etc/network/if-pre-up.d debian/whereami/usr/share/whereami
	install -m755 bin/whereami.apm         debian/whereami/etc/apm/scripts.d/whereami
	cp debian/whereami.dhclient3-exit-hook debian/whereami/etc/dhcp/dhclient-exit-hooks.d/whereami
	cp debian/whereami.network-hook        debian/whereami/etc/network/if-pre-up.d/whereami

	cp -r scripts debian/whereami/usr/share/whereami/actions
	cd debian/whereami/usr/share/whereami && chmod 755 actions/tests/* && mv actions/tests .
	cd debian/whereami/usr/share/whereami && ln -s actions/* .

%:
	dh $@
