Improving Network Wizard
July 27, 2008 —
BarryK
I have just started to look at Dougal's improvements to the Network Wizard. I have come to a stop for now as there are a few issues.
1. /etc/network/interfaces
This one is easily fixable.
Dougal would not have know about this problem, as it is so recent. I recently modified the Pppoeconf package to give it some infrastructure so that hopefully it will work. This infrastructure is directories and files out of Ubuntu. One of those is a file /etc/network/interfaces, which clashes with what Dougal has created.
An extra note, the Pppoeconf package also has directory /etc/wpa_supplicant, with a couple of files in it that the pppoeconf script uses.
2. sleep 10
The boot scripts in 4.1alpha4 avoid the need for big sleeps. In the case of rc.network, it has this code in the same place where the 'sleep 10' is located in Dougal's rc.network:
#v403 wait for interfaces...
echo -n "Waiting for interfaces... "
sleep 2
YAFPID="";RETYAF=1
WAITCNT=2
INTERFACES="";WANTINTS=""
CHECKINTS="`ls -1 /etc/*[0-9]mode 2>/dev/null`" #ex: eth0mode, wlan0mode.
[ "$CHECKINTS" != "" ] && WANTINTS="`echo "$CHECKINTS" | sed -e 's%/etc/%%' | sed -e 's%mode%%'`"
for WANTONE in $WANTINTS
do
while [ $WAITCNT -lt 12 ];do
if [ $RETYAF -ne 0 ];then # -a $WAITCNT -gt 4
/usr/X11R7/bin/yaf-splash -display :0 -font "8x16" -outline 0 -margin 4 -bg orange -placement top -text "Negotiating network connection. Blinky will appear in tray if successful" &
RETYAF=$?
YAFPID=$!
fi
INTERFACES=" `ifconfig -a | grep 'Link encap:Ethernet' | cut -f 1 -d ' '`"
[ "`echo $INTERFACES | grep "$WANTONE"`" != "" ] && break
echo -n "$WAITCNT "
WAITCNT=`expr $WAITCNT + 2`
sleep 2
done
done
3. lsusb, lspci
Pup 4.1 does not have lsusb, that Dougal uses in net-setup.sh. 4.1 does have lspci but does not have /usr/share/pci-usb-pcmcia.ids.
Comments
.Username: Dougal
/etc/network is, obviously, arbitrary and can easily be changed where it is defined (at the top of net-setup.sh and rc.network). Alternately, pppoeconf can probably be just as easily changed to use a different file (the reason it uses /etc/network/interfaces is that Debian uses that for networking). The use of lspci to find pcmcia was quite a relic... I changed it with something simpler. The other place lspci is used is just a fallback for when scanpci fails to find any info about a device (which it shouldn't), just to try and give the user some idea what the device is. lsusb is also used as a fallback, for cases when usb devices don't contain any info about themselves (i.e. there's nothing in /proc/bus/usb/devices). I've actually just replaced all the code for finding such info with something simpler, but I think it is worth adding lsusb again, since I have encountered cases where devices had no info about themselves -- so it would be good to give the user some info about the device (it's only about 100k extra to the sfs and there's a chance some applications might actually use it internally -- like they do with lspci). That new sleep code is wrong in exactly what I've tried to overcome with the change of configuration -- it depends on specific interface names. Say you boot off a usb drive and configure a wireless device, then boot on a machine with no wireless (or the same machine, but with the external NIC not connected this time) -- it will keep waiting for wlan0, which will not arrive, so it'll sleep 12 seconds. So unless we can find a proper way to find out if firmware has finished loading, I figure we might as well always sleep -- it's running in the background, anyway. As for the yaf-splash message, I really don't see the point in disturbing the user with it (not to mention that on slow machines X might not be up yet).
Re: Network Wizard
Username: BarryK
"Ok. Perhaps /etc/network/interfaces should be kept clear of in case we want to get more "Debianised" in the future. Yeah, that yaf-splash is probably too intrusive. That max 12 second wait is no big deal. It could be made 10 seconds, then it's worst case is the same as your every-time case. A 10 second wait means that the desktop will be fully loaded and the user will be staring at the tray wondering why there is no Blinky. Actually, that's why I put in the yaf-splash, in case there is some unusual delay, then the user would know that Puppy is trying to make the network connection.
Tags: puppy