[OE-core] [PATCH v2] initscripts: fix timestamp check at bootmisc.sh

Lauri Hintsala lauri.hintsala at bluegiga.com
Tue Dec 13 13:18:56 UTC 2011



On 12/13/2011 03:07 PM, Phil Blundell wrote:
> On Tue, 2011-12-13 at 14:58 +0200, Lauri Hintsala wrote:
>> SYSTEMDATE=`date -u +%4Y%2m%2d`
>> TIMESTAMP=`awk '{ print substr($0,9,4) substr($0,1,4); }'<  /etc/timestamp`
>> if [ $TIMESTAMP -gt $SYSTEMDATE ]; then
>> 	read TIMESTAMP<  /etc/timestamp
>> 	date -u $TIMESTAMP
>> 	/etc/init.d/hwclock.sh stop
>> fi
>>
>> How about this?
>
> You could lose the call to "awk" as well:
>
> read RAWTIMESTAMP<  /etc/timestamp
> TIMESTAMP=${RAWTIMESTAMP#????????}${RAWTIMESTAMP%????????}
>
> Or, er, something like that.  You might need to tweak the patterns a bit
> depending on what exactly the format of /etc/timestamp actually is, but
> I guess you get the idea.

Yes I got your idea and it seems to work. Thanks for your tips!

Second try:

SYSTEMDATE=`date -u +%4Y%2m%2d`
read TIMESTAMP < /etc/timestamp
if [ ${TIMESTAMP:8:4}${TIMESTAMP:0:4} -gt $SYSTEMDATE ]; then
     date -u $TIMESTAMP
     /etc/init.d/hwclock.sh stop
fi

Is this okay? Should I generate patch?

Lauri




More information about the Openembedded-core mailing list