aboutsummaryrefslogtreecommitdiffstats
path: root/main/dhcp/APKBUILD
blob: b48a369ac073961f21ef1e181e7049ec2063eaaf (plain)
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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=dhcp
pkgver=4.2.5
_realver=${pkgver/_p/-P}
pkgrel=0
pkgdesc="ISC Dynamic Host Configuration Protocol (DHCP)"
url="https://www.isc.org/"
arch="all"
license="ISC"
depends=
pkgusers="dhcp"
pkggroups="dhcp"
makedepends="perl"
install="dhcp.pre-install dhcp.pre-upgrade dhcp.post-upgrade"
subpackages="$pkgname-doc $pkgname-dev dhclient dhcrelay"
source="http://ftp.isc.org/isc/dhcp/${_realver}/$pkgname-$_realver.tar.gz
	linux_ipv6_discover.patch
	dhcp-3.0-fix-perms.patch
	dhcrelay.initd
	dhcrelay.confd
	dhcpd.confd
	dhcpd.initd"

prepare() {
	cd "$srcdir/$pkgname-$_realver"
	patch -p1 -i "$srcdir"/dhcp-3.0-fix-perms.patch || return 1
	# patch -p1 -i ../linux_ipv6_discover.patch || return 1
}

build() {
	cd "$srcdir/$pkgname-$_realver"
	# fix ipv6
	export CFLAGS="$CFLAGS -D_GNU_SOURCE"
	./configure --prefix=/usr \
		--sysconfdir=/etc/dhcp \
		--with-cli-pid-file=/var/run/dhcp/dhclient.pid \
		--with-cli-lease-file=/var/lib/dhcp/dhclient.leases \
		--with-srv-pid-file=/var/run/dhcp/dhcpd.pid \
		--with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
		--with-relay-pid-file=/var/run/dhcp/dhcrelay.pid \
		--enable-dhcpv6 \
		--enable-paranoia \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make || return 1
}

package() {
	cd "$srcdir/$pkgname-$_realver"
	make DESTDIR="$pkgdir" install

	install -m755 -D "$srcdir"/dhcpd.initd "$pkgdir"/etc/init.d/dhcpd
	install -m644 -D "$srcdir"/dhcpd.confd "$pkgdir"/etc/conf.d/dhcpd
	install -d "$pkgdir"/var/lib/dhcp
	install -d "$pkgdir"/var/run/dhcp
}

dhclient() {
	pkgdesc="ISC dhcp client"
	install -d -o dhcp -g dhcp "$subpkgdir"/var/lib/dhcp
	install -d -o dhcp -g dhcp "$subpkgdir"/var/run/dhcp
	install -d "$subpkgdir"/usr/sbin
	install -d "$subpkgdir"/etc/dhcp
	mv "$pkgdir"/usr/sbin/dhclient "$subpkgdir"/usr/sbin/
	mv "$pkgdir"/etc/dhcp/dhclient.conf* "$subpkgdir"/etc/dhcp/
}

dhcrelay() {
	pkgdesc="ISC dhcp relay server"
	replaces="dhcp"
	install -d "$subpkgdir"/var/run/dhcp \
		"$subpkgdir"/usr/sbin || return 1
	mv "$pkgdir"/usr/sbin/dhcrelay "$subpkgdir"/usr/sbin/
	install -m755 -D "$srcdir"/dhcrelay.initd \
		"$subpkgdir"/etc/init.d/dhcrelay 
	install -m644 -D "$srcdir"/dhcrelay.confd \
		"$subpkgdir"/etc/conf.d/dhcrelay
}

md5sums="6489e919ac093d17249270ee9be1020e  dhcp-4.2.5.tar.gz
37abf1fb047a353e91b022fafdabf39a  linux_ipv6_discover.patch
a9eaf182dae3984670da52f20ae10fba  dhcp-3.0-fix-perms.patch
1597c012bb1a2c0828254c87f0a904ad  dhcrelay.initd
db84514fe15fd7d81136afbaae738f55  dhcrelay.confd
026570f93fe76d2cdb0bbe6782b3ea5a  dhcpd.confd
215f9e4f8643d7356342ebc624bfc56d  dhcpd.initd"