[pkg-wpa-devel] r1389 - in /crda/trunk/debian: control rules setregdomain

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Sun May 17 15:08:56 UTC 2009


Author: kelmo-guest
Date: Sun May 17 15:08:56 2009
New Revision: 1389

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1389
Log:
Install a pre-parsed mapping of location name -> zone code which can be sourced by sh. Verify it. Modify setregdomain to source it.

Modified:
    crda/trunk/debian/control
    crda/trunk/debian/rules
    crda/trunk/debian/setregdomain

Modified: crda/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-wpa/crda/trunk/debian/control?rev=1389&op=diff
==============================================================================
--- crda/trunk/debian/control (original)
+++ crda/trunk/debian/control Sun May 17 15:08:56 2009
@@ -8,7 +8,8 @@
  libnl-dev,
  pkg-config,
  libgcrypt-dev,
- wireless-regdb
+ wireless-regdb,
+ tzdata
 Standards-Version: 3.8.1
 Homepage: http://wireless.kernel.org/en/developers/Regulatory/
 

Modified: crda/trunk/debian/rules
URL: http://svn.debian.org/wsvn/pkg-wpa/crda/trunk/debian/rules?rev=1389&op=diff
==============================================================================
--- crda/trunk/debian/rules (original)
+++ crda/trunk/debian/rules Sun May 17 15:08:56 2009
@@ -7,6 +7,19 @@
 %:
 	dh --with quilt $@
 
+override_dh_install:
+	dh_install
+	@# Install a pre-parsed mapping of location name -> zone code
+	@# which can be sourced by sh
+	awk 'BEGIN{ printf("case $$TIME_ZONE in\n") } \
+	$$1 ~ /^[A-Z][A-Z]$$/{ \
+		printf("\t\"%s\")\n\t\tZONE_CODE=%s\n\t\t;;\n", $$3, $$1) \
+	} \
+	END{ printf("esac\n") }' /usr/share/zoneinfo/zone.tab > \
+		debian/crda/lib/crda/setregdomain_zone_codes
+	@# Verify it is valid sh
+	sh -n debian/crda/lib/crda/setregdomain_zone_codes
+
 override_dh_fixperms:
 	dh_fixperms
 	chmod 755 debian/crda/lib/crda/setregdomain

Modified: crda/trunk/debian/setregdomain
URL: http://svn.debian.org/wsvn/pkg-wpa/crda/trunk/debian/setregdomain?rev=1389&op=diff
==============================================================================
--- crda/trunk/debian/setregdomain (original)
+++ crda/trunk/debian/setregdomain Sun May 17 15:08:56 2009
@@ -2,7 +2,6 @@
 
 REGDOM_CONFIG=/etc/default/crda
 TZDATA_CONFIG=/etc/timezone
-TZDATA_MATRIX=/usr/share/zoneinfo/zone.tab
 
 REGDOMAIN=
 TIME_ZONE=
@@ -18,37 +17,36 @@
 
 setreg_ftw()
 {
-	local DOMAIN
-	DOMAIN="$1"
-	shift
-	
-	iw reg set "$DOMAIN"
+	iw reg set "$1"
 	IWRETV=$?
 
 	if [ "$IWRETV" -ne 0 ]; then
 		echo "setregdomain: Failed to set regulatory domain to:" \
-		     "$DOMAIN ($@)."
+		     "$1 ($2)."
 	else
-		echo "setregdomain: Regulatory domain set to: $DOMAIN ($@)."
+		echo "setregdomain: Regulatory domain set to: $1 ($2)."
 	fi
 
-	exit "$IWRETV"
+	return "$IWRETV"
 }
 
 if [ -s "$REGDOM_CONFIG" ]; then
 	. $REGDOM_CONFIG
 	if [ -n "$REGDOMAIN" ]; then
 		setreg_ftw "$REGDOMAIN" "$REGDOM_CONFIG"
+		exit
 	fi
 fi
 
-if [ -s "$TZDATA_CONFIG" ] && [ -s "$TZDATA_MATRIX" ]; then
-	TIME_ZONE="$(cat $TZDATA_CONFIG)"
-	_TIMEZONE="$(echo $TIME_ZONE | sed -e 's# #_#g' -e 's#/#\\\\/#g')"
-	ZONE_CODE="$(sed -r -n '/'$_TIMEZONE'/s/^([A-Z]{2})\s+.*/\1/p' \
-			$TZDATA_MATRIX)"
+if [ -s "$TZDATA_CONFIG" ]; then
+	TIME_ZONE="$(sed -e 's# #_#g' $TZDATA_CONFIG)"
+
+	# Source the zone code snippet generated at package build time from
+	# information in /usr/share/zoneinfo/zone.tab to set ZONE_CODE
+	. /lib/crda/setregdomain_zone_codes
 	if [ -n "$ZONE_CODE" ]; then
-		setreg_ftw "$ZONE_CODE" "$TZDATA_CONFIG - $TIME_ZONE"
+		setreg_ftw "$ZONE_CODE" "$TIME_ZONE"
+		exit
 	else
 		setreg_err "Domain could not be determined from timezone" \
 			   "information in $TZDATA_CONFIG."




More information about the Pkg-wpa-devel mailing list