aboutsummaryrefslogtreecommitdiffstats
path: root/bootscripts/contrib/lsb-v3/init.d/setclock
blob: 5d47b8dc83c661b6d2f8a3f13f4a87b8f1b7c1c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# Begin /etc/init.d/setclock

### BEGIN INIT INFO
# Provides:            hwclock
# Required-Start:
# Should-Start:        modules
# Required-Stop:
# Should-Stop:         $syslog
# Default-Start: 
# Default-Stop: 
# Short-Description:   Stores and restores time from the hardware clock
# Description:         On boot, system time is obtained from hwclock.  The
#                      hardware clock can also be set on shutdown.
# X-LFS-Provided-By:   LFS BLFS
### END INIT INFO

. /lib/lsb/init-functions

BIN_FILE="/sbin/hwclock"

chk_stat

case "${UTC}" in
    yes|true|1)
        CLOCKPARAMS="${CLOCKPARAMS} --utc"
        ;;

    no|false|0)
        CLOCKPARAMS="${CLOCKPARAMS} --localtime"
        ;;

esac

case ${1} in
    start)
        message="Setting system clock..."
        ${BIN_FILE} --hctosys ${CLOCKPARAMS} >/dev/null
        evaluate_retval standard
        ;;

    stop)
        message="Setting hardware clock..."
        ${BIN_FILE} --systohc ${CLOCKPARAMS} >/dev/null
        evaluate_retval standard
        ;;

    *)
        echo "Usage: ${0} {start|stop}"
        ;;

esac

# End /etc/init.d/setclock