pkgname=dnsmasq
pkgver=2.42
pkgrel=15
pkgdesc="A lightweight DNS/DHCP server ideal for small/home networks using NAT"
arch=(i686 x86_64)
source=(http://www.thekelleys.org.uk/$pkgname/$pkgname-$pkgver.tar.gz \
    dnsmasq.rc.d $pkgname-capability-config.patch dnsmasq.conf pxelinux.0 pxelinux.default )
license=('GPL2')
url="http://www.thekelleys.org.uk/dnsmasq/doc.html"
depends=('glibc' 'bash')
backup=(etc/dnsmasq.conf)
install=$pkgname.install

build() {
  cd $startdir/src/$pkgname-$pkgver || return 1
  # patch to add a note about capability module in the config file
  patch -Np0 -i ../$pkgname-capability-config.patch || return 1

  # build
  cd $startdir/src/$pkgname-$pkgver || return 1
  make || return 1

  # install
  mkdir -p $startdir/pkg/etc/rc.d || return 1
  make PREFIX=/usr DESTDIR=$startdir/pkg install || return 1
  install -D -m 0755 \
    $startdir/src/dnsmasq.rc.d $startdir/pkg/etc/rc.d/dnsmasq || return 1
  install -D -m 0644 \
    dnsmasq.conf.example $startdir/pkg/etc/dnsmasq.conf.example || return 1
   install -D -m 0644 $startdir/src/dnsmasq.conf $startdir/pkg/etc/dnsmasq.conf

  mkdir -p $startdir/pkg/data/srv/tftp/pxelinux.cfg
  install -m 755 $startdir/src/pxelinux.default  $startdir/pkg/data/srv/tftp/pxelinux.cfg/default
  install -m 755 $startdir/src/pxelinux.0 $startdir/pkg/data/srv/tftp/pxelinux.0


  # make the required directories for DHCP server default directories
  mkdir -p $startdir/pkg/var/db || return 1
  mkdir -p $startdir/pkg/var/lib/misc || return 1
}
# vim: ts=2 sw=2 et ft=sh