From 4e35fd35e6eab00a4fcc99bbd84ffd7dda32e60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Thu, 5 Nov 2009 22:03:55 +0100 Subject: Only load rtc-cmos if rc.conf has proper clock settings --- rc.sysinit | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/rc.sysinit b/rc.sysinit index 2b0231b..405f8dd 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -35,15 +35,6 @@ else /bin/dmesg -n 3 fi -# enable rtc access -/sbin/modprobe rtc-cmos >/dev/null 2>&1 -RTC_MAJOR=$(/bin/grep -w rtc /proc/devices 2>/dev/null) -RTC_MAJOR="${RTC_MAJOR%% *}" -if [ -n "$RTC_MAJOR" ]; then - /bin/mknod /dev/rtc0 c $RTC_MAJOR 0 - /bin/ln -s /dev/rtc0 /dev/rtc -fi - HWCLOCK_PARAMS="--hctosys" if [ "$HARDWARECLOCK" = "UTC" ]; then HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc" @@ -53,10 +44,21 @@ else HWCLOCK_PARAMS="" fi -# Set clock early to fix some bugs with filesystem checks -# Clock is set again later to match rc.conf -if [ -n "$HWCLOCK_PARAMS" -a -f /etc/localtime ]; then - /sbin/hwclock $HWCLOCK_PARAMS --noadjfile +if [ -n "$HWCLOCK_PARAMS" ]; then + # enable rtc access + /sbin/modprobe rtc-cmos >/dev/null 2>&1 + RTC_MAJOR=$(/bin/grep -w rtc /proc/devices 2>/dev/null) + RTC_MAJOR="${RTC_MAJOR%% *}" + if [ -n "$RTC_MAJOR" ]; then + /bin/mknod /dev/rtc0 c $RTC_MAJOR 0 + /bin/ln -s /dev/rtc0 /dev/rtc + fi + + # Set clock early to fix some bugs with filesystem checks + # Clock is set again later to match rc.conf + if [ -f /etc/localtime ]; then + /sbin/hwclock $HWCLOCK_PARAMS --noadjfile + fi fi echo > /proc/sys/kernel/hotplug -- cgit v1.2.3