[pkg-wpa-devel] r1411 - in /crda/trunk/debian: crda.postinst setregdomain

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Sun Aug 16 10:11:40 UTC 2009


Author: kelmo-guest
Date: Sun Aug 16 10:11:40 2009
New Revision: 1411

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1411
Log:
Use a temporary file when updating iso 3166 country codes and do a sh dry run syntax check before overwriting existing config. Update code comments.

Modified:
    crda/trunk/debian/crda.postinst
    crda/trunk/debian/setregdomain

Modified: crda/trunk/debian/crda.postinst
URL: http://svn.debian.org/wsvn/pkg-wpa/crda/trunk/debian/crda.postinst?rev=1411&op=diff
==============================================================================
--- crda/trunk/debian/crda.postinst (original)
+++ crda/trunk/debian/crda.postinst Sun Aug 16 10:11:40 2009
@@ -20,17 +20,21 @@
 
 create_regdomain_matrix()
 {
+	# The conffile has been removed, do nothing.
 	[ -w /etc/default/crda ] || return 0
 
-	# Path to timezone configuration file
+	# Path to timezone configuration file, managed by tzdata maintainer
+	# scripts.
 	TZCONF=/etc/timezone
 
-	# Markers used to flag autogenerated section of /etc/default/crda
+	# Markers used to flag autogenerated section of /etc/default/crda.
+	# All configuration data outside of these markers are never touched.
 	START='### START AUTOGENERATED REGDOMAIN MATRIX'
 	END='### END AUTOGENERATED REGDOMAIN MATRIX'
 
-	# Remove old autogenerated section
-	sed -i "/^$START/,/^$END/d" /etc/default/crda
+	# Remove old autogenerated section.
+	sed "/^$START/,/^$END/d" /etc/default/crda > \
+		/etc/default/crda.postinst.tmp
 
 	# Append new autogenerated section. Parse tzdata's zone.tab and
 	# output something which can be sourced by a shell script. This is
@@ -58,7 +62,17 @@
 		printf("%s\n", end)
 
 	}
-	' "$1" >> /etc/default/crda
+	' "$1" >> /etc/default/crda.postinst.tmp
+
+	# Check syntax of autogenerated data. Do not overwrite the current
+	# /etc/default/crda conffile if a problem is detected by a sh dry run.
+	if sh -n /etc/default/crda.postinst.tmp; then
+		mv -f /etc/default/crda.postinst.tmp /etc/default/crda
+	else
+		echo "$0: syntax check failed, /etc/default/crda not" 1>&2
+		echo "$0: in sync with tzdata ISO 3166 country codes" 1>&2
+		rm -f /etc/default/crda.postinst.tmp
+	fi
 }
 
 case "$1" in

Modified: crda/trunk/debian/setregdomain
URL: http://svn.debian.org/wsvn/pkg-wpa/crda/trunk/debian/setregdomain?rev=1411&op=diff
==============================================================================
--- crda/trunk/debian/setregdomain (original)
+++ crda/trunk/debian/setregdomain Sun Aug 16 10:11:40 2009
@@ -1,17 +1,17 @@
 #!/bin/sh
+#
+# This script is executed by /lib/udev/rules.d/85-regulatory.rules in order
+# to set a sensible IEEE 802.11 regulatory domain setting based on the systems
+# timezone setting. See also /etc/default/crda.
+#
 
 set -e
 
 REGDOMAIN=
-REGDOMAIN_CONF=/etc/default/crda
+CRDA_CONF=/etc/default/crda
 
-if [ -s "$REGDOMAIN_CONF" ]; then
-	. "$REGDOMAIN_CONF"
-fi
-
-if [ -z "$REGDOMAIN" ]; then
-	exit 0
-fi
+[ -s "$CRDA_CONF" ] && . "$CRDA_CONF"
+[ -z "$REGDOMAIN" ] && exit 0
 
 # In the future, iw may be moved to / filesystem
 [ -x /bin/iw ] && exec /bin/iw reg set "$REGDOMAIN"




More information about the Pkg-wpa-devel mailing list