]> git.pld-linux.org Git - packages/tzdata.git/blame - timezone.init
- updated to 2008a
[packages/tzdata.git] / timezone.init
CommitLineData
462b45ea
ER
1#!/bin/sh
2#
3# timezone Set time zone information.
315b0b3a 4# chkconfig: 2345 10 90
462b45ea
ER
5# description: This script is setting time zone information for your machine.
6# Author: Pawel Wilk <siefca@pld-linux.org>
7#
8# $Id$
9
b1e44da8
ER
10[ -f /etc/sysconfig/timezone ] || exit 0
11
462b45ea
ER
12# Source function library.
13. /etc/rc.d/init.d/functions
14
462b45ea
ER
15. /etc/sysconfig/timezone
16
17ZONE_FILE="$ZONE_INFO_DIR"
18
19if [ -n "$ZONE_INFO_SCHEME" -a "$ZONE_INFO_SCHEME" != "posix" ]; then
20 ZONE_FILE="$ZONE_FILE/$ZONE_INFO_SCHEME"
21fi
22
23if [ -n "$ZONE_INFO_AREA" ]; then
24 ZONE_FILE="$ZONE_FILE/$ZONE_INFO_AREA"
25fi
26
27ZONE_FILE="$ZONE_FILE/$TIME_ZONE"
28
b1e44da8 29[ -L /etc/localtime ] && [ "$(resolvesymlink /etc/localtime)" = "$ZONE_FILE" ] && exit 0
462b45ea
ER
30
31start() {
32 if [ ! -f /var/lock/subsys/timezone ]; then
462b45ea 33 if [ -f "$ZONE_FILE" ]; then
fe8f4f97
ER
34 rm -f /etc/localtime
35
462b45ea
ER
36 if [ -n "$ZONE_INFO_AREA" ]; then
37 MESSAGE="`nls 'Setting time zone information (%s, %s)' "$ZONE_INFO_AREA" "$TIME_ZONE"`"
38 else
39 MESSAGE="`nls 'Setting time zone information (%s)' "$TIME_ZONE"`"
40 fi
b6f0e16a 41 run_cmd "$MESSAGE" cp -af $ZONE_FILE /etc/localtime
462b45ea 42 RETVAL=$?
48d6bbb7 43 restorecon /etc/localtime >/dev/null 2>&1
462b45ea
ER
44 fi
45
46 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/timezone
47 fi
48}
49
50stop() {
51 if [ -f /var/lock/subsys/timezone ]; then
462b45ea
ER
52 rm -f /var/lock/subsys/timezone
53 fi
54}
55
a9d82c32
ER
56disable() {
57 run_cmd "Unsetting time zone information" rm -f /etc/localtime
58}
59
462b45ea
ER
60RETVAL=0
61# See how we were called.
62case "$1" in
63 start)
64 start
65 ;;
66 stop)
67 stop
68 ;;
c5e2e190 69 restart|try-restart|reload|force-reload)
462b45ea
ER
70 stop
71 start
72 ;;
a9d82c32
ER
73 disable)
74 disable
75 ;;
64534ab1
ER
76 status)
77 if [ -n "$ZONE_INFO_AREA" ]; then
78 nls 'Time zone configured to (%s, %s)' "$ZONE_INFO_AREA" "$TIME_ZONE"
79 else
80 nls 'Time zone configured to (%s)' "$TIME_ZONE"
81 fi
82 ;;
462b45ea 83 *)
c5e2e190 84 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|disable|status}"
462b45ea
ER
85 exit 3
86esac
87
462b45ea 88exit $RETVAL
This page took 0.035215 seconds and 4 git commands to generate.