Comment 1 for bug 42100

Revision history for this message
Joel Bryan Juliano (joelbryan) wrote :

I have made a better version, that test if the currently set interface in netstatus applet is really working or not.

#!/bin/sh
# Find the first working network connection and
# configures it.
#
# Joel Bryan T. Juliano <email address hidden>

link="`/sbin/ifconfig | sed -e '/./{H;$!d;}' -e 'x;/[a-zA-Z][a-zA-Z][a-zA-Z]/!d;/RUNNING/!d;' \
       | sed '/^[a-zA-Z][a-zA-Z][a-zA-Z]/!d' | sed -n '/^.\{15\}/p' | \
       sed -ne 's/\([a-zA-Z][a-zA-Z][a-zA-Z][[:digit:]]\).*/\1/p'`"

current_link="`/usr/bin/gconftool-2 -g /apps/panel/applets/applet_0/prefs/interface`"

if [ ! "$link" = "$current_link" ]
then

test_current_link="`/sbin/ifconfig | sed -e '/./{H;$!d;}' -e 'x;/'$current_link'/!d;/RUNNING/!d;' \
       | sed '/^[a-zA-Z][a-zA-Z][a-zA-Z]/!d' | sed -n '/^.\{15\}/p' | \
       sed -ne 's/\([a-zA-Z][a-zA-Z][a-zA-Z][[:digit:]]\).*/\1/p'`"

 if [ -s $test_current_link ]
 then
 /usr/bin/gconftool-2 -t string -s /apps/panel/applets/applet_0/prefs/interface "$link"
 fi
exit 0;
fi