~ubuntu-branches/ubuntu/oneiric/isc-dhcp/oneiric-security

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/usr/bin/make -f
# Made with the iad of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Also some stuff taken from debmake scripts, by Cristopt Lameter.

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

DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS=CC=$(DEB_HOST_GNU_TYPE)-gcc
else
CROSS=
endif

DESTDIR = `pwd`/debian/tmp

PACKAGE = isc-dhcp

include /usr/share/dpatch/dpatch.make

CFLAGS = -Wall -g
INSTALL = install
INSTALL_FILE 	= $(INSTALL) -p -o root -g root -m 644

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif

CFLAGS += -D_PATH_DHCLIENT_SCRIPT='"/sbin/dhclient-script"'
CFLAGS += -D_PATH_DHCPD_CONF='"/etc/dhcp/dhcpd.conf"'
CFLAGS += -D_PATH_DHCLIENT_CONF='"/etc/dhcp/dhclient.conf"'
CFLAGS += -DNOMINUM

patched-ldap/build-stamp:
	dh_testdir

	aclocal
	autoconf
	autoheader
	automake --foreign --add-missing --copy
	
	./configure \
		--prefix=$(DESTDIR)/usr \
		--sysconfdir=$(DESTDIR)/etc/dhcp \
		--with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
		--with-srv6-lease-file=/var/lib/dhcp/dhcpd6.leases \
		--with-cli-lease-file=/var/lib/dhcp/dhclient.leases \
		--with-cli6-lease-file=/var/lib/dhcp/dhclient6.leases \
		--enable-ldap-conf --disable-ldap-casa
		
	for f in common ../minires ../dst ../omapip ../dhcpctl ../server; do \
		cd $$f;\
		$(MAKE) $(CROSS);\
	done
	mkdir -p patched-ldap
	mv server/dhcpd patched-ldap/
	
	touch $@
	
build: patch-stamp build-stamp

build-stamp: patched-ldap/build-stamp

	dpatch deapply-until dhcp-4.1.0-ldap-code

	aclocal
	autoconf
	autoheader
	automake --foreign --add-missing --copy
	
	./configure \
		--prefix=$(DESTDIR)/usr \
		--sysconfdir=$(DESTDIR)/etc/dhcp \
		--with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
		--with-srv6-lease-file=/var/lib/dhcp/dhcpd6.leases \
		--with-cli-lease-file=/var/lib/dhcp/dhclient.leases \
		--with-cli6-lease-file=/var/lib/dhcp/dhclient6.leases
	
	$(MAKE) $(CROSS)

	touch build-stamp

clean: unpatch
	dh_testdir
	rm -f build-stamp install-stamp
	rm -Rf patched-ldap

	[ ! -f Makefile ] || $(MAKE) distclean

	debconf-updatepo
	dh_clean

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs -A

	# Add here commands to install the package into debian/tmp.
	$(MAKE) install

	mkdir -p $(DESTDIR)/etc/dhcp

	# Install apparmor profile
	mkdir -p $(DESTDIR)/etc/apparmor.d
	$(INSTALL_FILE) debian/apparmor-profile.dhcpd $(DESTDIR)/etc/apparmor.d/usr.sbin.dhcpd
	$(INSTALL_FILE) debian/apparmor-profile.dhclient $(DESTDIR)/etc/apparmor.d/sbin.dhclient

	# Install dhcp's conffile.
	$(INSTALL_FILE) -m 644 debian/dhcpd.conf $(DESTDIR)/etc/dhcp

	# Install dhcp-client's conffiles.
	$(INSTALL_FILE) -m 644 debian/dhclient.conf $(DESTDIR)/etc/dhcp

	# udeb needs simplified dhclient script
	$(INSTALL_FILE) -m 755 `pwd`/debian/dhclient-script.$(DEB_HOST_ARCH_OS).udeb \
		`pwd`/debian/isc-dhcp-client-udeb/sbin/dhclient-script

	# Weird, weird Japanese manpages in weird, weird locations
	# need to be special-cased...
	mkdir -p $(DESTDIR)/usr/share/man/ja/man5
	for f in dhclient.conf dhcp-eval dhclient.leases dhcp-options; do \
		cp doc/ja_JP.eucJP/$$f.5 \
			$(DESTDIR)/usr/share/man/ja/man5; \
	done

	mkdir -p $(DESTDIR)/usr/share/man/ja/man8
	for f in dhclient dhclient-script; do \
		cp doc/ja_JP.eucJP/$$f.8 \
			$(DESTDIR)/usr/share/man/ja/man8; \
	done

	cp debian/debug-enter debian/isc-dhcp-client/etc/dhcp/dhclient-enter-hooks.d/debug
	cp debian/debug-exit debian/isc-dhcp-client/etc/dhcp/dhclient-exit-hooks.d/debug
	cp debian/rfc3442-classless-routes debian/isc-dhcp-client/etc/dhcp/dhclient-exit-hooks.d

	dh_install
	dh_link -a

	cp debian/dhclient-script.$(DEB_HOST_ARCH_OS) `pwd`/debian/isc-dhcp-client/sbin/dhclient-script

	# Install Linux specific documentation
ifeq ($(DEB_HOST_ARCH_OS), linux)
	for p in isc-dhcp-client isc-dhcp-relay isc-dhcp-server ; do \
		install -d -m 755 `pwd`/debian/$p/usr/share/doc; \
		install -m 644 `pwd`/debian/dhcp-on-linux.txt `pwd`/debian/$p/usr/share/doc; \
	done
endif
	dh_lintian

	touch install-stamp

# Build architecture-dependent files here (this package does not contain
#	architecture-independent files).
binary-arch: build install
	dh_testdir
	dh_testroot 
	dh_installdebconf
	dh_installdocs -A debian/README.Debian -X doc/ja_JP.eucJP
	dh_installdocs -pisc-dhcp-server-ldap contrib/dhcpd-conf-to-ldap.pl	
	dh_installexamples -a
	dh_installinit -pisc-dhcp-server --error-handler=init_script_error_handler
	dh_installinit -a -Nisc-dhcp-server
	dh_installchangelogs
	dh_installchangelogs -pisc-dhcp-server-ldap Changelog-LDAP 
	dh_install -pisc-dhcp-server-ldap	
	dh_apparmor -pisc-dhcp-client --profile-name=sbin.dhclient
	dh_apparmor -pisc-dhcp-server --profile-name=usr.sbin.dhcpd
	dh_apport -a
	dh_strip -pisc-dhcp-server-ldap 
	dh_strip -pisc-dhcp-server --dbg-package=isc-dhcp-server-dbg
	dh_strip -pisc-dhcp-relay --dbg-package=isc-dhcp-relay-dbg
	dh_strip -pisc-dhcp-client --dbg-package=isc-dhcp-client-dbg
	dh_strip -pisc-dhcp-common
	dh_strip -pisc-dhcp-client-udeb 
	dh_compress
	dh_fixperms -a
	dh_installdeb
	dh_shlibdeps -a
	dh_gencontrol
	dh_md5sums -a --no-package=isc-dhcp-client-udeb
	dh_builddeb

source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-arch
.PHONY: build clean binary-indep binary-arch binary