source: npl/system/glibc/timezone-scripts/parts/00 @ c5c522c

gcc484ntopperl-5.22
Last change on this file since c5c522c was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 4.4 KB
Line 
1#!/bin/sh
2#
3# timeconfig         Slackware Linux timezone configuration utility.
4#
5# Author:            Patrick Volkerding <volkerdi@slackware.com>
6# Modified by:  David Cantrell <david@slackware.com>, 06-Oct-2000
7#
8# ChangeLog:
9# 2014-10-22:   Updated timezones from tzdata2014i. <pjv>
10# 2012-12-12:   Updated timezones from tzdata2012j. <pjv>
11# 2008-03-10:   Updated timezones from tzdata2008a. <pjv>
12# 2007-12-21:   Updated timezones from tzdata2007j. <pjv>
13# 2006-12-03:   Updated timezones from tzdata2006p. <pjv>
14# 2006-09-14:   Updated timezones from tzdata2006k. <pjv>
15# 2006-08-22:   Updated timezones from tzdata2006j.
16# 2006-08-13:   Updated timezones from tzdata2006g.
17# 2006-03-13:   Updated timezones from tzdata2006c.
18# 19-Feb-2001   Add new timezones from glibc-2.2.2.
19# 06-Oct-2000   Fixed a problem with selecting UTC time.  It was writing
20#               the hardwareclock file to the root disk and not your dest
21#               partition.  Changed the HWCLOCK_CONF variable to be
22#               $T_PX/etc/hardwareclock to fix this.  Thanks to David L.
23#               Dickman <softbear@optonline.net> for finding this and
24#               submitting a patch.
25#
26# 15-Mar-2000   Added the writeconf function to write out the
27#               /etc/hardwareclock file which tells what the hardware clock
28#               is set to (UTC or localtime).
29#
30# 03-Mar-2000   Reorganized script.  Made one timezone set block, added
31#               stage that asks the user if the hardware clock is set to
32#               UTC.
33
34# setup our temp locations and variables
35TMP=/var/log/setup/tmp
36if [ -r $TMP/SeTT_PX ]; then
37   T_PX="`cat $TMP/SeTT_PX`"
38elif [ ! "$!" = "" ]; then
39   T_PX=$1
40else
41   T_PX=/
42fi
43
44# the hardware clock configuration file
45HWCLOCK_CONF=$T_PX/etc/hardwareclock
46
47# setzone( $TIMEZONE )
48#
49# This function accepts a time zone as the only parameter and sets it as
50# the default system time zone.
51setzone()
52{
53   TZ=$1
54
55   cd $T_PX/etc
56   if [ -r $T_PX/usr/share/zoneinfo/$TZ -o \
57        -r /var/log/mount/usr/share/zoneinfo/$TZ -o \
58        -L $T_PX/usr/share/zoneinfo/$TZ -o \
59        -L /var/log/mount/usr/share/zoneinfo/$TZ ]; then
60      ln -sf /usr/share/zoneinfo/$TZ localtime-copied-from
61      rm -f localtime
62      cd ..
63      chroot . cp etc/localtime-copied-from etc/localtime
64   fi
65}
66
67# writeconf( $CLOCK_SET_TO )
68#
69# Writes out $HWCLOCK_CONF that tells rc.S how the hardware clock
70# value is stored.
71writeconf()
72{
73   echo "# /etc/hardwareclock" > $HWCLOCK_CONF
74   echo "#" >> $HWCLOCK_CONF
75   echo "# Tells how the hardware clock time is stored." >> $HWCLOCK_CONF
76   echo "# You should run timeconfig to edit this file." >> $HWCLOCK_CONF
77   echo >> $HWCLOCK_CONF
78   echo $1 >> $HWCLOCK_CONF
79}
80
81# ask the user if the hardware clock is set for UTC/GMT
82if [ "$COLOR" = "on" -o -r $TMP/SeTcolor -o "$T_PX" = "/" ]; then
83   ###
84   ### use color menus here
85   ###
86   dialog --title "HARDWARE CLOCK SET TO UTC?" --menu "Is the hardware clock set \
87to Coordinated Universal Time (UTC/GMT)?  If it is, select YES here.  If the \
88hardware clock is set to the current local time (this is how most PCs are set \
89up), then say NO here.  If you are not sure what this is, you should answer NO \
90here." 13 60 2 \
91   "NO" "Hardware clock is set to local time" \
92   "YES" "Hardware clock is set to UTC" \
93   2> $TMP/utc
94   if [ $? = 1 -o $? = 255 ]; then
95     rm -f $TMP/utc
96     exit
97   fi
98   if [ "`cat $TMP/utc`" = "YES" ]; then
99     # yes, the hardware clock is UTC
100     writeconf "UTC"
101   else # must be NO
102     writeconf "localtime"
103   fi
104   rm -f $TMP/utc
105else
106   ###
107   ### use text prompts
108   ###
109   echo "Is the hardware clock set to Coordinated Universal Time (UTC/GMT)?"
110   echo "If it is, select 'y' here.  If the hardware clock is set to the"
111   echo "current local time (this is how most PCs are set up), then say 'n'"
112   echo "here.  If you are not sure what this is, you should answer 'n' here."
113   echo
114   echo -n "Is your hardware clock set to UTC ([y]es, [n]o)? "
115   read HEJAZ
116
117   if [ "$HEJAZ" = "y" -o "$HEJAZ" = "Y" -o "$HEJAZ" = "YES" -o "$HEJAZ" = "yes" ]; then
118      # yes, the hardware clock is UTC
119      writeconf "UTC"
120   else
121      # default to localtime
122      writeconf "localtime"
123   fi
124fi
125
126# Now set the correct timezone link:
127if [ "$COLOR" = "on" -o -r $TMP/SeTcolor -o "$T_PX" = "/" ]; then
128   ###
129   ### use color menus here
130   ###
131   dialog --title "TIMEZONE CONFIGURATION" --menu "Please select one of the following timezones for your machine:" 21 50 13 \
Note: See TracBrowser for help on using the repository browser.