Tiny Core Base > TCB Bugs

TC9.0 /etc/init.d/settime.sh broken

<< < (2/4) > >>

y_satou70:
not really as the patch, but simply nuke year check should be sufficient.


--- Code: ---box:/etc/init.d$ diff settime.sh.orig settime.sh
--- settime.sh.orig
+++ settime.sh
@@ -16,14 +16,6 @@
     NRT=0
     while sleep 0
     do
-        XXX=$(/bin/date -I)
-        XXX=${XXX:0:4}
-
-        if [ "$XXX" -ge "2015" ];
-        then
-            break
-        fi
-
         if [ $CNT -gt 10 ];
         then
             /usr/bin/getTime.sh
box:/etc/init.d$

--- End code ---


curaga:
I believe that would cause issues on rpi with separate rtc. Those boot somewhat slow, and their users don't want the additional time taken by this if they already have a rtc set up. So conflicting requirements somewhat.

y_satou70:
I think that is the reason why we now have "nortc" in boot option, so those devices just need to set it.

in current 9.x code /etc/init.d/tc-config:

--- Code: ---echo -n "${BLUE}Checking boot options...${NORMAL}"
for i in `cat /proc/cmdline`; do
case $i in
*)
case $i in
nortc) NORTC=1 ;;
esac
;;
esac
done

    ....

if [ -n "$NORTC" ]; then
echo "${BLUE}Skipping rtc as requested from the boot command line.${NORMAL}"
fi

if [ -n "$NODHCP" ]; then
echo "${GREEN}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
else
[ -z "$DHCP_RAN" ] && /etc/init.d/dhcp.sh &
[ -z "$NORTC" ] || /etc/init.d/settime.sh &
fi

--- End code ---

so the correct approach for this issue is,

* if using no RTC hardware, simply need to set "nortc" in option - then it skips clock sync (regardless "ntpserver" is set in option or not.)
* if "ntpserver" is set then let OS/Kernel sync with specified NTP server - regardless RTC's year info.

curaga:
They do want the correct time, booting with nortc leaves the time as the epoch...

y_satou70:
Hm, I think even in current code, the case

> ... cause issues on rpi with separate rtc. Those boot somewhat slow, and their users don't want the additional time taken by this if they already have a rtc set up.

does not handle like

> They do want the correct time, booting with nortc leaves the time as the epoch...

Because, even using RPi with separate slow RTC, if they do not set "nortc", it just wait until RTC device becomes available anyway.

As in current code, if "nortc" is *not* set then, we have eternal loop until /dev/rtc0 becomes available:


--- Code: ---if [ -n "$NORTC" ]; then
echo "${BLUE}Skipping rtc as requested from the boot command line.${NORMAL}"
else
while [ ! -e /dev/rtc0 ]; do usleep 50000; done
if [ -n "$NOUTC" ]; then
/sbin/hwclock -l -s &
else
/sbin/hwclock -u -s &
fi
fi

--- End code ---

so if they want to speed up the boot then they have to set "nortc" anyway.
Then in latter of this script,


--- Code: --- [ -z "$NORTC" ] || /etc/init.d/settime.sh &

--- End code ---

so if "nortc" is set, it won't refer ntpserver to set the time from ntpserver....

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version