summaryrefslogtreecommitdiff
path: root/testing/dhcp/PKGBUILD
blob: 31ace7328577e747a4e9a8beb4c53398c2244e5a (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
87
88
89
90
91
92
93
# $Id: PKGBUILD 165396 2012-08-17 23:27:19Z heftig $
# Maintainer: Daniel Isenmann <daniel @archlinux.org>

pkgbase=dhcp
pkgname=('dhcp' 'dhclient')

# separate patch levels with a period to maintain proper versioning.
pkgver=4.2.4.1
_pkgver=4.2.4-P1

pkgrel=2
arch=('i686' 'x86_64')
license=('custom:isc-dhcp')
url="https://www.isc.org/software/dhcp"
makedepends=('bash' 'iproute2' 'net-tools')
source=(ftp://ftp.isc.org/isc/${pkgbase}/${_pkgver}/${pkgbase}-${_pkgver}.tar.gz{,.asc}
        dhcp4 dhcp6 dhcp dhcpd4.service dhcpd6.service
        dhcp-4.1.1-missing-ipv6-not-fatal.patch
        dhclient-script-pathFixes.patch)
md5sums=('0ca7181024651f6323951d5498c8020b'
         '0dfe000dd88555ea06b282ae5e574d5f'
         'c49b1497837ba56c54e401a66e1bab9b'
         '12c2f3ae47ed23eb698eb7f1bfd80f20'
         '8f357e46e1efcbb746f38737a3f977a2'
         '1076444f22e13eb5f6bff7821fd0f446'
         '9310f2d8b1d7e97ace06d68cb41d9998'
         'fd64aeb4f399dcc41ea43089a3811094'
         '541b415a25a169eaf64b681405f79a80')

build() {
  cd "${srcdir}/${pkgbase}-${_pkgver}"

  # Define _GNU_SOURCE to fix IPV6.
  sed '/^CFLAGS="$CFLAGS/ s/INGS"/INGS -D_GNU_SOURCE"/' -i configure

  # Make not having ipv6 non-fatal.
  patch -Np0 -i "${srcdir}/dhcp-4.1.1-missing-ipv6-not-fatal.patch"

  ./configure --prefix=/usr --sysconfdir=/etc \
      --with-srv-lease-file=/var/state/dhcp/dhcpd.leases \
      --with-srv6-lease-file=/var/state/dhcp/dhcpd6.leases \
      --with-cli-lease-file=/var/state/dhclient/dhclient.leases \
      --with-cli6-lease-file=/var/state/dhclient/dhclient6.leases

  make

  patch -i "${srcdir}/dhclient-script-pathFixes.patch" client/scripts/linux
}

package_dhcp(){
  pkgdesc="A DHCP server, client, and relay agent"
  depends=('openssl>=0.9.8a')
  backup=('etc/dhcpd.conf' 'etc/conf.d/dhcp')
  install=dhcp.install
  
  cd "${srcdir}/${pkgbase}-${_pkgver}"
  make DESTDIR="${pkgdir}" install

  install -D -m755 "${srcdir}/dhcp4" "${pkgdir}/etc/rc.d/dhcp4"
  install -D -m755 "${srcdir}/dhcp6" "${pkgdir}/etc/rc.d/dhcp6"
  install -D -m644 "${srcdir}/dhcp" "${pkgdir}/etc/conf.d/${pkgbase}"
  install -d "${pkgdir}/var/state/dhcp"

  install -D -m644 "${srcdir}/dhcpd4.service" "${pkgdir}/usr/lib/systemd/system/dhcpd4.service"
  install -D -m644 "${srcdir}/dhcpd6.service" "${pkgdir}/usr/lib/systemd/system/dhcpd6.service"
  ln -s dhcpd4.service "${pkgdir}/usr/lib/systemd/system/dhcp4.service"
  ln -s dhcpd6.service "${pkgdir}/usr/lib/systemd/system/dhcp6.service"

  # Remove dhclient
  make -C client DESTDIR="${pkgdir}" uninstall
  
  # install license
  install -m644 -D LICENSE "${pkgdir}/usr/share/licenses/dhcp/LICENSE"
}

package_dhclient(){
  pkgdesc="A standalone DHCP client from the dhcp package"
  depends=('bash' 'iproute2' 'net-tools')

  cd "${srcdir}/${pkgbase}-${_pkgver}"
  make -C client DESTDIR="${pkgdir}" install

  # move dhclient.conf to dhclient.conf.example
  mv "${pkgdir}"/etc/dhclient.conf{,.example}
  
  install -d "${pkgdir}/var/state/dhclient"

  # install dhclient linux script
  install -m755 -D client/scripts/linux "${pkgdir}/sbin/dhclient-script"

  # install license
  install -m644 -D LICENSE "${pkgdir}/usr/share/licenses/dhclient/LICENSE"
}