summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1cb5d0f2476caf5477983a725cc8ea3f10131652 (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
# $Id$
# Maintainer: Thomas Bächler <thomas@archlinux.org>

pkgname=wireless-regdb
pkgver=2009.11.10
pkgrel=1
pkgdesc="Central Regulatory Domain Database"
arch=(any)
url="http://wireless.kernel.org/en/developers/Regulatory/CRDA"
license=('custom')
depends=()
install=wireless-regdb.install
source=(http://wireless.kernel.org/download/${pkgname}/${pkgname}-${pkgver}.tar.bz2
        crda.conf.d)
sha256sums=('50b47f49e6b499c752a32c0ba0b0dd948abd17dde737467ef9c0c8663556902c'
            '192428fd959806705356107bffc97b8b379854e79bd013c4ee140e5202326e2b')
backup=(etc/conf.d/wireless-regdom)

build() {
  # Install and verify regulatory.bin file
  msg "Installing and verifying the regulatory.bin file ..."
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install || return 1
  # If crda is installed, the wireless regdb can be verified using regdbdump
  # Keep this step optional so no depend/makedepend loop is created
  if [ -x /sbin/regdbdump ]; then
    if /sbin/regdbdump ${pkgdir}/usr/lib/crda/regulatory.bin > /dev/null; then
      msg "Regulatory database verification was succesful."
    else
      error "Regulatory database verification failed."
      return 1
    fi
  else
    warning "Crda is not installed, regulatory database could not be verified."
  fi
  
  msg "Installing /etc/conf.d/wireless-regdom ..."
  install -D -m644 ${srcdir}/crda.conf.d ${pkgdir}/etc/conf.d/wireless-regdom || return 1
  for dom in $(grep ^country ${srcdir}/${pkgname}-${pkgver}/db.txt | cut -d' ' -f2 | sed 's|:||g'); do
    echo "#WIRELESS_REGDOM=\"${dom}\"" >> ${pkgdir}/etc/conf.d/wireless-regdom.tmp || return 1
  done
  sort -u ${pkgdir}/etc/conf.d/wireless-regdom.tmp >> ${pkgdir}/etc/conf.d/wireless-regdom || return 1
  rm -f ${pkgdir}/etc/conf.d/wireless-regdom.tmp || return 1
  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" || return 1
}