]> hackdaworld.org Git - hdw-linux/hdw-linux.git/commitdiff
forgotten cvs add (setclock stuff)
authorhackbard <hackbard>
Sat, 10 Sep 2005 10:01:58 +0000 (10:01 +0000)
committerhackbard <hackbard>
Sat, 10 Sep 2005 10:01:58 +0000 (10:01 +0000)
packages/base/util-linux/setclock_conf [new file with mode: 0644]
packages/base/util-linux/setclock_script [new file with mode: 0755]

diff --git a/packages/base/util-linux/setclock_conf b/packages/base/util-linux/setclock_conf
new file mode 100644 (file)
index 0000000..5a0fbc2
--- /dev/null
@@ -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 (executable)
index 0000000..abf919a
--- /dev/null
@@ -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