]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/busybox/files/hwclock.sh
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / busybox / files / hwclock.sh
1 #!/bin/sh
2 # hwclock.sh Set system clock to hardware clock, according to the UTC
3 #               setting in /etc/default/rcS (see also rcS(5)).
4 #
5 # WARNING:      If your hardware clock is not in UTC/GMT, this script
6 #               must know the local time zone. This information is
7 #               stored in /etc/localtime. This might be a problem if
8 #               your /etc/localtime is a symlink to something in
9 #               /usr/share/zoneinfo AND /usr isn't in the root
10 #               partition! The workaround is to define TZ either
11 #               in /etc/default/rcS, or in the proper place below.
12
13 [ ! -x /sbin/hwclock ] && exit 0
14
15 . /etc/default/rcS
16
17 case "$1" in
18         start)
19                 if [ "$VERBOSE" != no ]
20                 then
21                         echo "System time was `date`."
22                         echo "Setting the System Clock using the Hardware Clock as reference..."
23                 fi
24
25                 if [ "$HWCLOCKACCESS" != no ]
26                 then
27                         if [ -z "$TZ" ]
28                         then
29                            hwclock --hctosys
30                         else
31                            TZ="$TZ" hwclock --hctosys
32                         fi
33                 fi
34
35                 if [ "$VERBOSE" != no ]
36                 then
37                         echo "System Clock set. System local time is now `date`."
38                 fi
39                 ;;
40         stop|restart|reload|force-reload)
41                 #
42                 # Updates the Hardware Clock with the System Clock time.
43                 # This will *override* any changes made to the Hardware Clock.
44                 #
45                 # WARNING: If you disable this, any changes to the system
46                 #          clock will not be carried across reboots.
47                 #
48                 if [ "$VERBOSE" != no ]
49                 then
50                         echo "Saving the System Clock time to the Hardware Clock..."
51                 fi
52                 if [ "$HWCLOCKACCESS" != no ]
53                 then
54                         hwclock --systohc
55                 fi
56                 if [ "$VERBOSE" != no ]
57                 then
58                         echo "Hardware Clock updated to `date`."
59                 fi
60                 exit 0
61                 ;;
62         show)
63                 if [ "$HWCLOCKACCESS" != no ]
64                 then
65                         hwclock --show
66                 fi
67                 ;;
68         *)
69                 echo "Usage: hwclock.sh {start|stop|show|reload|restart}" >&2
70                 echo "       start sets kernel (system) clock from hardware (RTC) clock" >&2
71                 echo "       stop and reload set hardware (RTC) clock from kernel (system) clock" >&2
72                 exit 1
73                 ;;
74 esac