]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/initscripts/init.d/setclock
core76: Sort exclude file alphabetically.
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / setclock
index 6083108dd7568040d9e3e6157741378f0f7b077d..661e944a424db37999c5884f6fcadf250553434a 100644 (file)
@@ -24,10 +24,21 @@ case ${1} in
 
                # udev not create the rtc symlink if rtc is in the kernel
                if [ ! -e /dev/rtc ]; then
-                       ln -s rtc0 /dev/rtc
+                       if [ -e /dev/rtc0 ]; then
+                               ln -s rtc0 /dev/rtc
+                       fi
                fi
 
                hwclock --hctosys ${CLOCKPARAMS} &>/dev/null
+               if [ ! ${?} == 0 ]; then
+                       if [ -s /var/log/messages ]; then
+                               boot_mesg -n "No RTC found, set time to last log accesstime ... "
+                               DATE=`stat --format "%y" /var/log/messages | cut -d" " -f1`
+                               TIME=`stat --format "%y" /var/log/messages | sed -e "s|\..*||g" | cut -d" " -f2`
+                               date -s $DATE > /dev/null
+                               date -s $TIME
+                       fi
+               fi
                evaluate_retval
                ;;