af489f7
#!/bin/sh
af489f7
af489f7
REGDOMAIN=/etc/sysconfig/regdomain
af489f7
CLOCK=/etc/sysconfig/clock
af489f7
af489f7
if [ -f $REGDOMAIN ]
af489f7
then
af489f7
	# This should set COUNTRY
af489f7
	. $REGDOMAIN
af489f7
	iw reg set $COUNTRY
af489f7
	exit
af489f7
fi
af489f7
af489f7
if [ -f $CLOCK ]
af489f7
then
af489f7
	# This should set ZONE
af489f7
	. $CLOCK
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
af489f7
COOKED_ZONE=$(echo $ZONE | sed -e 's/ /_/')
af489f7
af489f7
COUNTRY=$(grep $COOKED_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
af489f7
iw reg set $COUNTRY