Hi Sebastian,

this would work only in case you're using squashfs, but there are others
like jffs, ubifs and ext4 without overlay.

best regards,
Stefan


2014/1/6 Sebastian Moeller <moell...@gmx.de>

> Hi Etienne,
>
>
> On Jan 6, 2014, at 13:01 , Etienne CHAMPETIER <etienne.champet...@free.fr>
> wrote:
>
> > Simply scan for the most recent file in /etc and set
> > system time to this file modification time if it's in the future
> > It allow some time dependent program to work immediatly
> > without waiting for ntpd to sync
> >
> > v1: v2: bad approach
> > v3: simply scan /etc, thanks to Bastian Bittorf for the idea
> > v4: use sort -n, thanks to Catalin Patulea
> > v5: use [] instead of [[]], thanks to Andreas Mohr
> > v6: use openwrt style, thanks to Bastian Bittorf
> >
> > Signed-off-by: Etienne CHAMPETIER <etienne.champet...@free.fr>
> > ---
> > package/base-files/files/etc/init.d/sysfixtime | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> > create mode 100755 package/base-files/files/etc/init.d/sysfixtime
> >
> > diff --git a/package/base-files/files/etc/init.d/sysfixtime
> b/package/base-files/files/etc/init.d/sysfixtime
> > new file mode 100755
> > index 0000000..525d765
> > --- /dev/null
> > +++ b/package/base-files/files/etc/init.d/sysfixtime
> > @@ -0,0 +1,13 @@
> > +#!/bin/sh /etc/rc.common
> > +# Copyright (C) 2013-2014 OpenWrt.org
> > +
> > +START=00
> > +
> > +boot() {
> > +     local curtime="$(date +%s)"
> > +     local maxtime="$(find /etc -type f -exec date +%s -r {} \; | sort
> -nr | head -n1)"
>
>         I am probably way off, but if you would use /overlay/etc you would
> avoid "stating" files not changed since install time?
>
> best regards
>         Sebastian
>
> > +     [ $curtime -lt $maxtime ] && \
> > +             date -s @$maxtime && \
> > +             logger -t sysfixtime -p daemon.notice "Time fixed"
> > +}
> > +
> > --
> > 1.8.4.2
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to