Am 30.03.2011 15:26, schrieb Tom Gundersen:
Hi Kurt,

I was about to test and push your patches, but they do not apply (I
think your mailreader messed them up as there are at least some
linebreaks that should not have been there...), could you resend using
git send-email (as explained by Thomas in a recent mail), or give me a
public repository I can pull from (the latter would probably be
better)?

Cheers,

Tom

On Mon, Mar 28, 2011 at 7:14 PM, Kurt J. Bosch
<[email protected]>  wrote:
 From db75b4636156aea2a65b600c0d4e65e08de41138 Mon Sep 17 00:00:00 2001
From: Kurt J. Bosch<[email protected]>
Date: Mon, 28 Mar 2011 19:06:05 +0200
Subject: [PATCH 1/2] Make hwclock --adjust as well as --systohc optional
(FS#13684)

---
  adjtime.cron |    2 +-
  hwclock      |   39 +++++++++++++++++++++++++++++++++++++++
  install.sh   |    2 +-
  rc.conf      |    5 ++++-
  rc.shutdown  |   13 ++-----------
  rc.sysinit   |   27 +++------------------------
  6 files changed, 50 insertions(+), 38 deletions(-)
  create mode 100755 hwclock

diff --git a/adjtime.cron b/adjtime.cron
index a876506..dac8cea 100755
--- a/adjtime.cron
+++ b/adjtime.cron
@@ -10,6 +10,6 @@ case $HARDWARECLOCK in
     *) HWCLOCK_PARAMS="";;
  esac

-if [[ $HWCLOCK_PARAMS ]]; then
+if [[ $HWCLOCK_PARAMS&&  -f /var/run/daemons/hwclock ]]; then
     /sbin/hwclock $HWCLOCK_PARAMS
  fi
diff --git a/hwclock b/hwclock
new file mode 100755
index 0000000..d9de9e1
--- /dev/null
+++ b/hwclock
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case $HARDWARECLOCK in
+    UTC) HWCLOCK_PARAMS="--utc";;
+    localtime) HWCLOCK_PARAMS="--localtime";;
+    *) HWCLOCK_PARAMS="";;
+esac
+
+case "$1" in
+    start)
+        if [[ $HWCLOCK_PARAMS ]]; then
+            status "Adjusting Hardware Clock" \
+                /sbin/hwclock --adjust
+            stat_busy "Setting System Clock"
+            /sbin/hwclock --hctosys $HWCLOCK_PARAMS || stat_die
+            stat_done
+            # Note: This also enables /etc/cron.hourly/adjtime
+            add_daemon hwclock
+        fi
+        ;;
+    stop)
+        if [[ $HWCLOCK_PARAMS ]]; then
+            stat_busy "Saving System Clock"
+            /sbin/hwclock --systohc $HWCLOCK_PARAMS || stat_die
+            stat_done
+        fi
+        rm_daemon hwclock
+        ;;
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+    *)
+        echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/install.sh b/install.sh
index 2b2cbbc..8e6c3d7 100755
--- a/install.sh
+++ b/install.sh
@@ -15,7 +15,7 @@ done
  install -D -m755 adjtime.cron ${DESTDIR}/etc/cron.hourly/adjtime

  install -D -m644 functions ${DESTDIR}/etc/rc.d/functions || exit 1
-for i in network netfs; do
+for i in hwclock network netfs; do
   install -D -m755 $i ${DESTDIR}/etc/rc.d/$i || exit 1
  done

diff --git a/rc.conf b/rc.conf
index d2b0517..0b0a818 100644
--- a/rc.conf
+++ b/rc.conf
@@ -105,4 +105,7 @@ NETWORK_PERSIST="no"
  #   - prefix a daemon with a ! to disable it
  #   - prefix a daemon with a @ to start it up in the background
  #
-DAEMONS=(syslog-ng network netfs crond)
+# If something other takes care of your hardware clock (ntpd, dual-boot...)
+# you should disable 'hwclock' here.
+#
+DAEMONS=(hwclock syslog-ng network netfs crond)
diff --git a/rc.shutdown b/rc.shutdown
index 0acca49..fef1117 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -35,21 +35,12 @@ fi
  /bin/dd if=/dev/urandom of=$RANDOM_SEED count=1 bs=$POOL_SIZE&>  /dev/null
  stat_done

-stat_busy "Saving System Clock"
  if [[ $TIMEZONE&&  -e /usr/share/zoneinfo/$TIMEZONE ]]; then
     /bin/rm -f /etc/localtime
-    /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
+    status "Saving Time Zone" \
+        /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
  fi

-HWCLOCK_PARAMS="--systohc"
-case $HARDWARECLOCK in
-    UTC) HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc";;
-    localtime) HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime";;
-    *) HWCLOCK_PARAMS="";;
-esac
-[[ $HWCLOCK_PARAMS ]]&&  /sbin/hwclock $HWCLOCK_PARAMS
-stat_done
-
  # removing psmouse module to fix some reboot issues on newer laptops
  /sbin/modprobe -r psmouse>/dev/null 2>&1

diff --git a/rc.sysinit b/rc.sysinit
index 9797611..e949180 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -66,7 +66,7 @@ if [[ $HWCLOCK_PARAMS ]]; then
     #    configured timezone. Any new timezone put in rc.conf is copied over
at
     #    a later time.
     # This does *NOT* take into account a time adjustment file as /var may
not be
-    # mounted yet. A second set occurs later to match rc.conf.
+    # mounted yet. A second set may occur in rc.d/hwclock to match rc.conf.
     if [[ -f /etc/localtime ]]; then
         /sbin/hwclock $HWCLOCK_PARAMS --noadjfile
     fi
@@ -304,28 +304,12 @@ status "Retrying failed UDev events" /sbin/udevadm
trigger --action=add --type=f

  status "Activating Swap" /sbin/swapon -a

-stat_busy "Configuring System Clock"
  if [[ $TIMEZONE&&  -e /usr/share/zoneinfo/$TIMEZONE ]]; then
     /bin/rm -f /etc/localtime
-    /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
+    status "Configuring Time Zone" \
+        /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
  fi

-clock_pid=""
-if [[ $HWCLOCK_PARAMS ]]; then
-    # This time, we set the clock for real. Use the adjustment file now
that
-    # /var will definitely be available, and then set the system clock once
-    # the hardware clock has been adjusted accordingly. The backgrounding
magic
-    # is due to the fact that the second call to hwclock will almost always
-    # take ~1 second because of the clock granularity, and we might as well
-    # stay busy.
-    (
-    /sbin/hwclock --adjust
-    /sbin/hwclock $HWCLOCK_PARAMS
-    )&
-    clock_pid=$!
-fi
-stat_done
-
  RANDOM_SEED=/var/lib/misc/random-seed
  if [[ -f $RANDOM_SEED ]]; then
     stat_busy "Initializing Random Seed"
@@ -398,11 +382,6 @@ set_consolefont

  /bin/dmesg>| /var/log/dmesg.log

-# final hwclock setting needs to be done at this point
-if [[ $clock_pid ]]; then
-    wait $clock_pid
-fi
-
  run_hook sysinit_end

  # End of file
--
1.7.0.3


_______________________________________________
arch-projects mailing list
[email protected]
http://mailman.archlinux.org/mailman/listinfo/arch-projects

I'm sorry, please try these:

http://pastebin.com/pb3Kf7as
http://pastebin.com/adHNkLby

--
Kurt

Reply via email to