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.
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to