]> git.pld-linux.org Git - projects/rc-scripts.git/blame - rc.d/init.d/timezone
- more vim setting removed (don't convert tabs to spaces)
[projects/rc-scripts.git] / rc.d / init.d / timezone
CommitLineData
2fa99108 1#!/bin/sh
f955035f 2#
2fa99108 3# timezone Set time zone information.
4# chkconfig: 2345 10 70
5# description: This script is setting time zone information for your machine.
ec8b15cb 6# Author: Pawel Wilk <siefca@pld-linux.org>
2fa99108 7#
ec8b15cb 8# $Id$
2fa99108 9
10# NLS
11NLS_DOMAIN="rc-scripts"
12
13# Source function library.
14. /etc/rc.d/init.d/functions
15
16[ ! -f /etc/sysconfig/timezone ] && exit 0
2fa99108 17. /etc/sysconfig/timezone
18
d3cf69ad 19ZONE_FILE="$ZONE_INFO_DIR"
2fa99108 20
347c5e5f 21if [ -n "$ZONE_INFO_SCHEME" -a "$ZONE_INFO_SCHEME" != "posix" ]; then
5e6dfc29 22 ZONE_FILE="$ZONE_FILE/$ZONE_INFO_SCHEME"
d3cf69ad 23fi
2fa99108 24
457d138b 25if [ -n "$ZONE_INFO_AREA" ]; then
5e6dfc29 26 ZONE_FILE="$ZONE_FILE/$ZONE_INFO_AREA"
d3cf69ad 27fi
28
29ZONE_FILE="$ZONE_FILE/$TIME_ZONE"
f955035f 30
c289c4fc 31[ -L /etc/localtime -a "`resolvesymlink /etc/localtime`" = "$ZONE_FILE" ] && exit 0
f955035f 32
d3cf69ad 33# See how we were called.
34case "$1" in
35 start)
5e6dfc29 36 rm -f /etc/localtime
2fa99108 37 if [ -f "$ZONE_FILE" ]; then
457d138b 38 if [ -n "$ZONE_INFO_AREA" ]; then
5e6dfc29 39 MESSAGE="`nls 'Setting time zone information (%s, %s)' "$ZONE_INFO_AREA" "$TIME_ZONE"`"
2fa99108 40 else
5e6dfc29 41 MESSAGE="`nls 'Setting time zone information (%s)' "$TIME_ZONE"`"
2fa99108 42 fi
204176b6 43 run_cmd "$MESSAGE" cp -af $ZONE_FILE /etc/localtime
457d138b 44 RETVAL=$?
2fa99108 45 fi
5e6dfc29 46 ;;
2fa99108 47 stop)
5e6dfc29
JR
48 run_cmd "Unsetting time zone information" rm -f /etc/localtime
49 RETVAL=$?
50 ;;
2fa99108 51 restart)
5e6dfc29
JR
52 $0 stop
53 $0 start
54 ;;
2fa99108 55 reload)
5e6dfc29
JR
56 $0 restart
57 ;;
2fa99108 58 *)
5e6dfc29
JR
59 echo "Usage: $0 {start|stop|restart|reload}"
60 exit 1
2fa99108 61esac
f955035f 62
5c378e78 63unset ZONE_FILE ZONE_INFO_DIR ZONE_INFO_SCHEME ZONE_INFO_AREA TIME_ZONE MESSAGE
f955035f 64
457d138b
JR
65exit $RETVAL
66
67# This must be last line !
5e6dfc29 68# vi:syntax=sh
This page took 0.056872 seconds and 4 git commands to generate.