GARNAME = dhcdbd
GARVERSION = 2.2
CATEGORIES = bootstrap
DISTFILES = $(GARNAME)-$(GARVERSION).tar.bz2
PATCHFILES = makefile-fix.diff

MASTER_SITES = http://people.redhat.com/dcantrel/dhcdbd/

DESCRIPTION = bootstrap
define BLURB
dhcdbd exists to :
o  provide D-BUS control of the ISC dhclient software,
o  store DHCP configuration parameters (options) persistently
o  providing access to DHCP options over D-BUS
o  notify applications of changes to DHCP IP interface configuration
endef

BUILD_SCRIPTS = custom
INSTALL_SCRIPTS = custom

include ../category.mk

build-custom:
	@if test ! -e $(WORKSRC)/include/dhcdbd.h.orig; then \
	mv $(WORKSRC)/include/dhcdbd.h $(WORKSRC)/include/dhcdbd.h.orig; \
	$(SED) -e 's?/var/run/dhcdbd.pid?$(localstatedir)/run/dhcdbd.pid?' $(WORKSRC)/include/dhcdbd.h.orig > $(WORKSRC)/include/dhcdbd.h; fi
	CC="$(CC)" $(MAKE) -C $(WORKSRC);
	$(MAKECOOKIE)

install-custom:
	@if test ! -e $(WORKSRC)/dhcdbd.service.orig; then \
	mv $(WORKSRC)/dhcdbd.service $(WORKSRC)/dhcdbd.service.orig ;\
	$(SED) -e 's?/sbin?$(prefix)/sbin?' $(WORKSRC)/dhcdbd.service.orig > $(WORKSRC)/dhcdbd.service; fi
	@if test ! -e $(WORKSRC)/system.d/dhcdbd.conf.orig; then \
	mv $(WORKSRC)/dhcdbd.conf $(WORKSRC)/dhcdbd.conf.orig ;\
	$(SED) -e 's?/usr/share?$(datadir)?' $(WORKSRC)/dhcdbd.conf.orig > $(WORKSRC)/dhcdbd.conf; fi
	DESTDIR=$(prefix) $(MAKE) -C $(WORKSRC) install;
	$(MAKECOOKIE)

uninstall:
	rm -f $(sbindir)/dhcdbd
	rm -f $(sysconfdir)/dbus-1/system.d/dhcdbd.conf
	rm -f $(sharedstatedir)/dbus-1/services/dhcdbd.service
	rm -rf cookies/main.d/install*
