2011-04-26 12:26:24 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# setclock - setting Linux clock
|
|
|
|
|
|
|
|
# Based on setclock script from LFS-3.1 and earlier.
|
|
|
|
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
|
|
|
|
|
2012-08-15 18:58:59 +02:00
|
|
|
[ -e /proc/driver/rtc ] || exit 0
|
|
|
|
|
2011-04-26 12:26:24 +02:00
|
|
|
. /etc/sysconfig/rc
|
|
|
|
. $rc_functions
|
|
|
|
|
|
|
|
[ -r /etc/sysconfig/clock ] && . /etc/sysconfig/clock
|
|
|
|
|
|
|
|
CLOCKPARAMS="--directisa"
|
|
|
|
|
|
|
|
case "$UTC" in
|
|
|
|
yes|true|1)
|
|
|
|
CLOCKPARAMS="$CLOCKPARAMS --utc"
|
|
|
|
;;
|
|
|
|
no|false|0)
|
|
|
|
CLOCKPARAMS="$CLOCKPARAMS --localtime"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo -n "Setting clock: "
|
|
|
|
hwclock --hctosys $CLOCKPARAMS
|
|
|
|
evaluate_retval
|
|
|
|
echo
|
2011-10-17 16:32:50 +02:00
|
|
|
Y=`date +%Y`
|
|
|
|
[ $Y -gt 2010 ] || {
|
|
|
|
echo -n "Fixing broken hardware clock: "
|
|
|
|
date -s 2010/01/01
|
|
|
|
evaluate_retval
|
|
|
|
echo
|
|
|
|
}
|
2011-04-26 12:26:24 +02:00
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
echo -n "Setting clock: "
|
|
|
|
hwclock --systohc $CLOCKPARAMS
|
|
|
|
evaluate_retval
|
|
|
|
echo
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
hwclock $CLOCKPARAMS
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop|status}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|