#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@ --with quilt

MOO=COW

override_dh_auto_install:
	# Make sur we log to console during install as there is no syslog daemon ib pbuilder
	sed -i "s:# \$$LogSocket = 'unix';:\$$LogSocket = 'console';:" etc/nfsen-dist.conf
	# Use the broken installer
	./install.pl etc/nfsen-dist.conf
	# Remove the dist etc file
	rm debian/nfsen/etc/nfsen/nfsen-dist.conf
	# Cleanup the installed paths
	for i in `rgrep -l debian/nfsen debian/nfsen`; do sed -i 's:debian/nfsen::' $$i; done
	sed -i 's:$$BASEDIR = "";:$$BASEDIR = "/usr";:' debian/nfsen/etc/nfsen/nfsen.conf
	sed -i "s:\$$LogSocket = 'console';:# \$$LogSocket = 'unix';:" debian/nfsen/etc/nfsen/nfsen.conf
	# Move files around
	mv debian/nfsen/usr/bin/RebuildHierarchy.pl debian/nfsen/usr/bin/RebuildHierarchy

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog upstream
