From: hackbard Date: Sat, 10 Sep 2005 10:01:58 +0000 (+0000) Subject: forgotten cvs add (setclock stuff) X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=b53a20631c1abe769d14cf40b433a113167057df;p=hdw-linux%2Fhdw-linux.git forgotten cvs add (setclock stuff) --- diff --git a/packages/base/util-linux/setclock_conf b/packages/base/util-linux/setclock_conf new file mode 100644 index 0000000..5a0fbc2 --- /dev/null +++ b/packages/base/util-linux/setclock_conf @@ -0,0 +1,31 @@ +# hdw - linux /etc/conf/setclock +# +# defining set{sys,hw}clock functions used by /etc/init.d/setclock +# (copied from ROCK Linux + some additions) +# + +UTC="off" + +# +# set functions (called by /etc/init.d/setclock) +# + +xx() { echo ">> $*" ; eval "$*" ; } + +setsysclock() { + echo "setting system time according to hardware clock ..." + if [ ".$UTC" = ".on" ] ; then + xx hwclock --hctosys --utc + else + xx hwclock --hctosys --localtime + fi +} + +sethwclock() { + echo "setting hardware clock according to system time ..." + if [ ".$UTC" = ".on" ] ; then + xx hwclock --systohc --utc + else + xx hwclock --systohc --localtime + fi +} diff --git a/packages/base/util-linux/setclock_script b/packages/base/util-linux/setclock_script new file mode 100755 index 0000000..abf919a --- /dev/null +++ b/packages/base/util-linux/setclock_script @@ -0,0 +1,24 @@ +#!/bin/sh +# +# hdw - linux /etc/init.d/setclock +# +# low level clock/time stuff +# + +. /etc/conf/setclock + +case "$1" +in + start) + setsysclock + ;; + stop) + sethwclock + ;; + restart) + $0 stop ; $0 start ;; + *) + echo "Usage: $0 { start | restart | stop }" ; exit 1 ;; +esac + +exit 0