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