aboutsummaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-08-15 23:55:25 -0500
committerThomas Bächler <thomas@archlinux.org>2009-08-22 11:25:27 +0200
commit2008846efe204b79d1c0f281d609a1f4b23431c8 (patch)
tree4b9404966d4593af87e609d9ad5b66129a16c9e5 /rc.sysinit
parentd1f86dbf7819a782df812dde8282a03ab1f82faf (diff)
downloadinitscripts-2008846efe204b79d1c0f281d609a1f4b23431c8.tar.xz
Allow skipping of all hardware clock adjustments
For virtualized machines, the hardware clock doesn't actually exist, so all hwclock calls fail and print error messages during system startup, shutdown, and the hourly adjtime cronjob. By explicitly looking for HARDWARECLOCK to be set to 'UTC' or 'localtime', all other values will result in hwclock calls being skipped (e.g. set the variable to 'none'). Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit15
1 files changed, 10 insertions, 5 deletions
diff --git a/rc.sysinit b/rc.sysinit
index 322b512..0e67721 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -35,7 +35,8 @@ 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%% *}"
+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
@@ -44,13 +45,15 @@ fi
HWCLOCK_PARAMS="--hctosys"
if [ "$HARDWARECLOCK" = "UTC" ]; then
HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
-else
+elif [ "$HARDWARECLOCK" = "localtime" ]; then
HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
+else
+ HWCLOCK_PARAMS=""
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
+if [ -n "$HWCLOCK_PARAMS" -a -f /etc/localtime ]; then
/sbin/hwclock $HWCLOCK_PARAMS --noadjfile
fi
@@ -302,8 +305,10 @@ if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
fi
-/sbin/hwclock --adjust #Adjust for system drift
-/sbin/hwclock $HWCLOCK_PARAMS
+if [ -n "$HWCLOCK_PARAMS" ]; then
+ /sbin/hwclock --adjust #Adjust for system drift
+ /sbin/hwclock $HWCLOCK_PARAMS
+fi
stat_done
RANDOM_SEED=/var/lib/misc/random-seed