summaryrefslogtreecommitdiff
path: root/data/check-timezones.sh
diff options
context:
space:
mode:
authorPerberos <[email protected]>2011-12-01 21:42:39 -0300
committerPerberos <[email protected]>2011-12-01 21:42:39 -0300
commitfe8aea1c3b5348347633da18a02b0bffd3b266a1 (patch)
tree9881bf77df7572844707cc7c50bd8ca6b5a97076 /data/check-timezones.sh
downloadlibmateweather-fe8aea1c3b5348347633da18a02b0bffd3b266a1.tar.bz2
libmateweather-fe8aea1c3b5348347633da18a02b0bffd3b266a1.tar.xz
moving from https://github.com/perberos/mate-desktop-environment
Diffstat (limited to 'data/check-timezones.sh')
-rwxr-xr-xdata/check-timezones.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/data/check-timezones.sh b/data/check-timezones.sh
new file mode 100755
index 0000000..ab3bf08
--- /dev/null
+++ b/data/check-timezones.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+if test -f /usr/share/zoneinfo/zone.tab; then
+ tzdb=/usr/share/zoneinfo/zone.tab
+else
+ if test -f /usr/share/lib/zoneinfo/tab/zone_sun.tab; then
+ tzdb=/usr/share/lib/zoneinfo/tab/zone_sun.tab
+ else
+ echo "No timezone database found"
+ exit 1
+ fi
+fi
+
+locations=${1:-Locations.xml.in}
+used=`mktemp`
+correct=`mktemp`
+
+sed -ne 's/.*<tz-hint>\(.*\)<.*/\1/p' $locations | sort -u > $used
+awk '{print $3;}' $tzdb | sort -u > $correct
+bad=`comm -13 $correct $used`
+rm $correct $used
+
+if [ -n "$bad" ]; then
+ echo "Invalid timezones in ${locations}: $bad" 1>&2
+ exit 1
+fi
+
+used=`mktemp`
+obsolete=`mktemp`
+
+sed -ne 's/.*<tz-hint>\(.*\)<.*/\1/p' $locations | sort -u > $used
+sed -ne 's/.*<obsoletes>\(.*\)<.*/\1/p' $locations | sort -u > $obsolete
+bad=`comm -12 $used $obsolete`
+rm $used $obsolete
+
+if [ -n "$bad" ]; then
+ echo "Obsolete <tz-hint> timezones in ${locations}: $bad" 1>&2
+ exit 1
+fi
+exit 0