Blame SOURCES/setregdomain

d81fc2
#!/bin/sh
d81fc2
#
d81fc2
# Copyright 2009-2010 Red Hat, Inc.  All rights reserved.
d81fc2
#
d81fc2
# Permission to use, copy, modify, and/or distribute this software for any
d81fc2
# purpose with or without fee is hereby granted, provided that the above
d81fc2
# copyright notice and this permission notice appear in all copies.
d81fc2
# 
d81fc2
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
d81fc2
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
d81fc2
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
d81fc2
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
d81fc2
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
d81fc2
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
d81fc2
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
d81fc2
#
d81fc2
d81fc2
REGDOMAIN=/etc/sysconfig/regdomain
d81fc2
LOCALTIME=/etc/localtime
d81fc2
d81fc2
if [ -f $REGDOMAIN ]
d81fc2
then
d81fc2
	# This should set COUNTRY
d81fc2
	. $REGDOMAIN
d81fc2
	if [ -n "$COUNTRY" ]
d81fc2
	then
d81fc2
		/sbin/iw reg set $COUNTRY
d81fc2
		exit
d81fc2
	fi
d81fc2
fi
d81fc2
d81fc2
if [ -f $TZ ]
d81fc2
then
d81fc2
	ZONE=$(readlink $LOCALTIME | sed -e 's/\/usr\/share\/zoneinfo\///')
d81fc2
else
d81fc2
	echo "Timezone information not found!  Unable to set regulatory domain."
d81fc2
	exit
d81fc2
fi
d81fc2
d81fc2
if [ -z "$ZONE" ]
d81fc2
then
d81fc2
	echo "Timezone information not set!  Unable to set regulatory domain."
d81fc2
	exit
d81fc2
fi
d81fc2
d81fc2
COUNTRY=$(grep $ZONE /usr/share/zoneinfo/zone.tab | awk '{ print $1 }')
d81fc2
d81fc2
if [ -z "$COUNTRY" ]
d81fc2
then
d81fc2
	echo "Could not determine country!  Unable to set regulatory domain."
d81fc2
	exit
d81fc2
fi
d81fc2
d81fc2
/sbin/iw reg set $COUNTRY