From 15ab16433eb5abfe24d588f02b07c4f9158265ec Mon Sep 17 00:00:00 2001
From: Cecil <knoppmyth@gmail.com>
Date: Sat, 9 Jul 2011 03:03:45 -0700
Subject: crda:Bumped to latest.

---
 abs/extra/crda/PKGBUILD     | 49 +++++++++++++++------------------------------
 abs/extra/crda/crda.install | 18 +++++++++++++++++
 2 files changed, 34 insertions(+), 33 deletions(-)
 create mode 100644 abs/extra/crda/crda.install

diff --git a/abs/extra/crda/PKGBUILD b/abs/extra/crda/PKGBUILD
index 5a23fbd..4fbb201 100644
--- a/abs/extra/crda/PKGBUILD
+++ b/abs/extra/crda/PKGBUILD
@@ -1,50 +1,33 @@
-# $Id: PKGBUILD 24388 2009-01-15 23:18:18Z thomas $
+# $Id: PKGBUILD 79865 2010-05-08 15:22:52Z thomas $
 # Maintainer: Thomas Bächler <thomas@archlinux.org>
 
 pkgname=crda
-pkgver=0.9.5
-_regdbver=2009-01-15
-pkgrel=2
+pkgver=1.1.1
+pkgrel=1
 pkgdesc="Central Regulatory Domain Agent"
 arch=(i686 x86_64)
 url="http://wireless.kernel.org/en/developers/Regulatory/CRDA"
 license=('custom')
-depends=('libnl' 'libgcrypt' 'udev' 'iw')
+depends=('wireless-regdb' 'libnl' 'libgcrypt' 'udev' 'iw')
 makedepends=('python-m2crypto')
-source=(http://wireless.kernel.org/download/crda/$pkgname-$pkgver.tar.bz2
-        http://wireless.kernel.org/download/wireless-regdb/regulatory.bins/${_regdbver}-regulatory.bin
-        crda.rc
-        crda.conf.d)
-backup=(etc/conf.d/wireless-regdom)
-md5sums=('cee459e588441f713a96ae2fb0472d7f'
-         'a0db99e5385c876b6da7e2869546f6e2'
-         '014eef3f8655e9a130064ec6891317fc'
-         '2374dcf1c6530332f375e5362b80169b')
+install=crda.install
+source=(http://wireless.kernel.org/download/crda/${pkgname}-${pkgver}.tar.bz2
+        crda.rc)
+md5sums=('5fc77af68b3e21736b8ef2f8b061c810'
+         '014eef3f8655e9a130064ec6891317fc')
                   
 build() {
   # Install crda, regdbdump and udev rules
   msg "Compiling and installing crda ..."
-  cd $srcdir/$pkgname-$pkgver
+  cd ${srcdir}/${pkgname}-${pkgver}
   make crda regdbdump || return 1
-  make DESTDIR=$pkgdir install || return 1
+  make DESTDIR=${pkgdir} install || return 1
+  # This rule automatically sets the regulatory domain when cfg80211 is loaded
+  echo 'ACTION=="add" SUBSYSTEM=="module", DEVPATH=="/module/cfg80211", RUN+="/etc/rc.d/wireless-regdom start >/dev/null"' >> ${pkgdir}/lib/udev/rules.d/85-regulatory.rules || return 1
 
-  # Install and verify regulatory.bin file
-  msg "Installing and verifying the regulatory.bin file ..."
-  install -D -m444 $srcdir/${_regdbver}-regulatory.bin $pkgdir/usr/lib/crda/regulatory.bin || return 1
-  if $pkgdir/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
-  
   msg "Installing license ..."
-  install -D -m644 $srcdir/$pkgname-$pkgver/LICENSE $pkgdir/usr/share/licenses/crda/LICENSE || return 1
+  install -D -m644 ${srcdir}/${pkgname}-${pkgver}/LICENSE ${pkgdir}/usr/share/licenses/crda/LICENSE || return 1
   
-  msg "Installing boot scripts ..."
-  install -D -m755 $srcdir/crda.rc $pkgdir/etc/rc.d/wireless-regdom || return 1
-  install -D -m644 $srcdir/crda.conf.d $pkgdir/etc/conf.d/wireless-regdom || return 1
-  for dom in $($pkgdir/sbin/regdbdump $pkgdir/usr/lib/crda/regulatory.bin | grep ^country | cut -d' ' -f2 | sed 's|:||g'); do
-    echo "#WIRELESS_REGDOM=\"${dom}\"" >> $pkgdir/etc/conf.d/wireless-regdom || return 1
-  done
+  msg "Installing boot script ..."
+  install -D -m755 ${srcdir}/crda.rc ${pkgdir}/etc/rc.d/wireless-regdom || return 1
 }
diff --git a/abs/extra/crda/crda.install b/abs/extra/crda/crda.install
new file mode 100644
index 0000000..c18e15f
--- /dev/null
+++ b/abs/extra/crda/crda.install
@@ -0,0 +1,18 @@
+## arg 1:  the new package version
+post_install() {
+  echo "Uncomment the right regulatory domain in /etc/conf.d/wireless-regdom."
+  echo "It will automatically be set when necessary."
+}
+
+## arg 1:  the new package version
+## arg 2:  the old package version
+post_upgrade() {
+  # In an upgrade from 1.0.1-1 or older, the wireless-regdom file moves from the crda package
+  # to the new wireless-regdb package. If the user changed the file, it is save to overwrite the one
+  # from wireless-regdb by the user-defined one
+  if [ $(vercmp $2 1.0.1-2) -lt 0 ]; then
+    if [ -f /etc/conf.d/wireless-regdom.pacorig -a -n "$(grep -v ^# /etc/conf.d/wireless-regdom.pacorig 2>/dev/null | grep -v ^$)" ]; then
+      mv /etc/conf.d/wireless-regdom.pacorig /etc/conf.d/wireless-regdom
+    fi
+  fi
+}
-- 
cgit v0.12

