summaryrefslogtreecommitdiff
path: root/core/crda
diff options
context:
space:
mode:
Diffstat (limited to 'core/crda')
-rw-r--r--core/crda/PKGBUILD33
-rw-r--r--core/crda/crda.install18
-rwxr-xr-xcore/crda/crda.rc26
3 files changed, 77 insertions, 0 deletions
diff --git a/core/crda/PKGBUILD b/core/crda/PKGBUILD
new file mode 100644
index 000000000..4fbb20111
--- /dev/null
+++ b/core/crda/PKGBUILD
@@ -0,0 +1,33 @@
+# $Id: PKGBUILD 79865 2010-05-08 15:22:52Z thomas $
+# Maintainer: Thomas Bächler <thomas@archlinux.org>
+
+pkgname=crda
+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=('wireless-regdb' 'libnl' 'libgcrypt' 'udev' 'iw')
+makedepends=('python-m2crypto')
+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}
+ make crda regdbdump || 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
+
+ msg "Installing license ..."
+ install -D -m644 ${srcdir}/${pkgname}-${pkgver}/LICENSE ${pkgdir}/usr/share/licenses/crda/LICENSE || return 1
+
+ msg "Installing boot script ..."
+ install -D -m755 ${srcdir}/crda.rc ${pkgdir}/etc/rc.d/wireless-regdom || return 1
+}
diff --git a/core/crda/crda.install b/core/crda/crda.install
new file mode 100644
index 000000000..c18e15f71
--- /dev/null
+++ b/core/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
+}
diff --git a/core/crda/crda.rc b/core/crda/crda.rc
new file mode 100755
index 000000000..13dbd870e
--- /dev/null
+++ b/core/crda/crda.rc
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/wireless-regdom
+
+case "$1" in
+ start)
+ if [ -n "${WIRELESS_REGDOM}" ]; then
+ stat_busy "Setting wireless regulatory domain: ${WIRELESS_REGDOM}"
+ if iw reg set ${WIRELESS_REGDOM}; then
+ stat_done
+ else
+ stat_fail
+ fi
+ fi
+ ;;
+ stop)
+ ;;
+ restart)
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 start"
+esac
+exit 0