]> code.citadel.org Git - citadel.git/blob - citadel/guesstimezone.sh
* During server startup, if config.c_default_cal_zone is an empty string, run a shell...
[citadel.git] / citadel / guesstimezone.sh
1 #!/bin/sh
2
3 # guesstimezone.sh - an ugly hack of a script to try to guess the time
4 # zone currently in use on the host system, and output its name.
5
6 # Copyright (c) by Art Cancro
7
8 # This program is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by the Free
10 # Software Foundation; either version 3 of the License, or (at your option)
11 # any later version.
12
13 # This program is distributed in the hope that it will be useful, but WITHOUT
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 # more details.
17
18 # You should have received a copy of the GNU General Public License along
19 # with this program; if not, write to the Free Software Foundation, Inc.,
20 # 675 Mass Ave, Cambridge, MA 02139, USA. 
21
22 md5sum </dev/null >/dev/null 2>/dev/null || exit 1
23         
24 LOCALTIMESUM=`md5sum /etc/localtime | awk ' { print $1 } ' 2>/dev/null`
25 find /usr/share/zoneinfo -type f -print | while read filename
26 do
27         THISTIMESUM=`md5sum $filename | awk ' { print $1 } '`
28         if [ $LOCALTIMESUM = $THISTIMESUM ] ; then
29                 echo $filename | cut -c21-
30                 exit 0
31         fi
32 done 2>/dev/null
33 exit 2