diff --git a/setregdomain b/setregdomain index 7664c59..2a0cee0 100755 --- a/setregdomain +++ b/setregdomain @@ -31,7 +31,8 @@ fi if [ -f $TZ ] then - ZONE=$(readlink $LOCALTIME | sed -e 's/\/usr\/share\/zoneinfo\///') + ZONE=$(readlink $LOCALTIME) + ZONE=${ZONE#/usr/share/zoneinfo/} else echo "Timezone information not found! Unable to set regulatory domain." exit @@ -43,7 +44,7 @@ then exit fi -COUNTRY=$(grep $ZONE /usr/share/zoneinfo/zone.tab | awk '{ print $1 }') +COUNTRY=$(while read c a z r; do if [ "$z" = "$ZONE" ]; then echo $c; break; fi ;done < /usr/share/zoneinfo/zone.tab) if [ -z "$COUNTRY" ] then