On 5/31/11 10:48 AM, Peter Wagner wrote: > Am Dienstag, 31. Mai 2011, 17:52:58 schrieb Philip Prindeville: >> On 5/30/11 4:00 PM, Peter Wagner wrote: >>> Hi, >>> >>> while i was reading some init files i stumbled upon this: >>> >>> /sbin/wifi detect >> /etc/config/wireless >>> >>> grep -qs config /etc/config/wireless && { >>> >>> /sbin/wifi up >>> >>> } || { >>> >>> rm -f /etc/config/wireless >>> >>> } >>> >>> this means: >>>> /sbin/wifi detect >> /etc/config/wireless >>> >>> /sbin/wifi only outputs something if /etc/config/wireless doesnt exist >>> but even if the files exist /etc/config/wireless modification time gets >>> updated. this means even when the wifi is allready configured the modtime >>> of the file gets updated everytime the system boots. >>> >>> i created this patch - maybe there is a better way to fix this. >> >> I would test for the file changing with respect to the existing copy, >> rather than non-zero length. >> >> If you change out hardware, or if you had a wireless interface but now have >> removed it, you don't want to retain invalid information. >> >> I'd use "cmp -s" to compare the two files. > > this wont work - because if the file wireless exists the script output > nothing > ... so if you attach a new wifi card - you would have to remove the file and > restart the router or do a wifi detect > /etc/config/wireless ... > > and if the file is empty (the one wifi detect created) cmp will also return > something != 0...
That's a glitch. Why should "wifi detect" care if there's a file already present or not? It should ignore it. _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel