From 5ce6c56afb89e52c5fa8fa515401cdf0e00f89a6 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 18 Mar 2016 15:09:17 +0100 Subject: [PATCH 12/15] system: only set time from RTC if there is an RTC Some embedded devices don't have any RTC, so let's avoid emitting an error at boot. --- sbin/init.d/system | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/init.d/system b/sbin/init.d/system index 2e9bb6e..22922a2 100755 --- a/sbin/init.d/system +++ b/sbin/init.d/system @@ -40,7 +40,9 @@ function do_date_from_hw { rtc_opt="$rtc_opt --directisa" fi - if [ "$opt_rtc" = "utc" ]; then + if [ ! -e /proc/driver/rtc -a ! -e /sys/class/rtc ]; then + echo "Setting system time from the image (no RTC)." + elif [ "$opt_rtc" = "utc" ]; then echo -n "Setting system time from hardware clock (UTC)... " hwclock --hctosys --noadjfile --utc $rtc_opt echo "Done." -- 1.7.12.1