diff options
Diffstat (limited to 'meta/recipes-connectivity/dhcp/dhcp.inc')
-rw-r--r-- | meta/recipes-connectivity/dhcp/dhcp.inc | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/dhcp/dhcp.inc b/meta/recipes-connectivity/dhcp/dhcp.inc new file mode 100644 index 0000000000..512127cd4c --- /dev/null +++ b/meta/recipes-connectivity/dhcp/dhcp.inc | |||
@@ -0,0 +1,100 @@ | |||
1 | SECTION = "console/network" | ||
2 | SUMMARY = "Internet Software Consortium DHCP package" | ||
3 | DESCRIPTION = "DHCP (Dynamic Host Configuration Protocol) is a protocol \ | ||
4 | which allows individual devices on an IP network to get their own \ | ||
5 | network configuration information from a server. DHCP helps make it \ | ||
6 | easier to administer devices." | ||
7 | |||
8 | HOMEPAGE = "http://www.isc.org/" | ||
9 | |||
10 | LICENSE = "ISC" | ||
11 | LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;md5=c5c64d696107f84b56fe337d14da1753" | ||
12 | |||
13 | DEPENDS = "openssl bind" | ||
14 | |||
15 | SRC_URI = "ftp://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \ | ||
16 | file://site.h \ | ||
17 | file://init-relay file://default-relay \ | ||
18 | file://init-server file://default-server \ | ||
19 | file://dhclient.conf file://dhcpd.conf" | ||
20 | |||
21 | inherit autotools | ||
22 | |||
23 | TARGET_CFLAGS += "-D_GNU_SOURCE" | ||
24 | EXTRA_OECONF = "--with-srv-lease-file=${localstatedir}/lib/dhcp/dhcpd.leases \ | ||
25 | --with-srv6-lease-file=${localstatedir}/lib/dhcp/dhcpd6.leases \ | ||
26 | --with-cli-lease-file=${localstatedir}/lib/dhcp/dhclient.leases \ | ||
27 | --with-cli6-lease-file=${localstatedir}/lib/dhcp/dhclient6.leases \ | ||
28 | --with-libbind=${STAGING_LIBDIR}/ \ | ||
29 | " | ||
30 | |||
31 | do_compile_prepend () { | ||
32 | cp -f ${WORKDIR}/site.h ${S}/includes | ||
33 | } | ||
34 | |||
35 | do_install_append () { | ||
36 | install -d ${D}${sysconfdir}/init.d | ||
37 | install -d ${D}${sysconfdir}/default | ||
38 | install -d ${D}${sysconfdir}/dhcp | ||
39 | install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay | ||
40 | install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay | ||
41 | install -m 0755 ${WORKDIR}/init-server ${D}${sysconfdir}/init.d/dhcp-server | ||
42 | install -m 0644 ${WORKDIR}/default-server ${D}${sysconfdir}/default/dhcp-server | ||
43 | |||
44 | rm -f ${D}${sysconfdir}/dhclient.conf* | ||
45 | rm -f ${D}${sysconfdir}/dhcpd.conf* | ||
46 | install -m 0644 ${WORKDIR}/dhclient.conf ${D}${sysconfdir}/dhcp/dhclient.conf | ||
47 | install -m 0644 ${WORKDIR}/dhcpd.conf ${D}${sysconfdir}/dhcp/dhcpd.conf | ||
48 | |||
49 | install -d ${D}${base_sbindir}/ | ||
50 | if [ "${sbindir}" != "${base_sbindir}" ]; then | ||
51 | mv ${D}${sbindir}/dhclient ${D}${base_sbindir}/ | ||
52 | fi | ||
53 | install -m 0755 ${S}/client/scripts/linux ${D}${base_sbindir}/dhclient-script | ||
54 | } | ||
55 | |||
56 | PACKAGES += "dhcp-server dhcp-server-config dhcp-client dhcp-relay dhcp-omshell" | ||
57 | |||
58 | FILES_${PN} = "" | ||
59 | RDEPENDS_${PN}-dev = "" | ||
60 | RDEPENDS_${PN}-staticdev = "" | ||
61 | |||
62 | FILES_dhcp-server = "${sbindir}/dhcpd ${sysconfdir}/init.d/dhcp-server" | ||
63 | RRECOMMENDS_dhcp-server = "dhcp-server-config" | ||
64 | |||
65 | FILES_dhcp-server-config = "${sysconfdir}/default/dhcp-server ${sysconfdir}/dhcp/dhcpd.conf" | ||
66 | |||
67 | FILES_dhcp-relay = "${sbindir}/dhcrelay ${sysconfdir}/init.d/dhcp-relay ${sysconfdir}/default/dhcp-relay" | ||
68 | |||
69 | FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf" | ||
70 | RDEPENDS_dhcp-client = "bash" | ||
71 | |||
72 | FILES_dhcp-omshell = "${bindir}/omshell" | ||
73 | |||
74 | pkg_postinst_dhcp-server() { | ||
75 | mkdir -p $D/${localstatedir}/lib/dhcp | ||
76 | touch $D/${localstatedir}/lib/dhcp/dhcpd.leases | ||
77 | touch $D/${localstatedir}/lib/dhcp/dhcpd6.leases | ||
78 | } | ||
79 | |||
80 | pkg_postinst_dhcp-client() { | ||
81 | mkdir -p $D/${localstatedir}/lib/dhcp | ||
82 | } | ||
83 | |||
84 | pkg_postrm_dhcp-server() { | ||
85 | rm -f $D/${localstatedir}/lib/dhcp/dhcpd.leases | ||
86 | rm -f $D/${localstatedir}/lib/dhcp/dhcpd6.leases | ||
87 | |||
88 | if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then | ||
89 | echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty." | ||
90 | fi | ||
91 | } | ||
92 | |||
93 | pkg_postrm_dhcp-client() { | ||
94 | rm -f $D/${localstatedir}/lib/dhcp/dhclient.leases | ||
95 | rm -f $D/${localstatedir}/lib/dhcp/dhclient6.leases | ||
96 | |||
97 | if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then | ||
98 | echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty." | ||
99 | fi | ||
100 | } | ||