Well, I went and made it myself..  Since my laptop has a built-in 3Com
card, I set up an expect script to work with Donald Becker's mii-diag
program when it is running in `--watch' mode.  It's definitely not as sane
as it could be, but for taking a whole 20 minutes to do, I figure it's not
bad (though don't try to get me to do any more work on it.. :-p)

I put mii-diag into /usr/local/bin, along with a script named
expect-dhclient:


#!/usr/bin/expect -f
eval spawn /usr/local/bin/mii-diag --watch eth0
while {1} {
  expect {
    "Good link"         { system /sbin/ifup eth0 }
    "have link beat"    { system /sbin/ifup eth0 }
    "no link"           { system /sbin/ifdown eth0 }
    "not established"   { system /sbin/ifdown eth0 }
  } 
}


To have it start on boot, I made a file /etc/init.d/fake-dhclient, and
made appropriate startup/kill symlinks for it:


#!/bin/sh -e

case "$1" in
        start)
                touch /var/log/fake-dhclient
                /usr/local/bin/expect-dhclient 2>&1 > /var/log/fake-dhclient &
                ;;
        stop)
                killall expect-dhclient
                ;;
        restart|reload|force-reload)
                ;;
esac


Finally, I noticed that the mii-diag program would die whenever I did a
suspend/resume, so I made another script for the APM daemon in
/etc/apm/event.d/:


#!/bin/sh

if [ "$1" = "resume" ]; then
  /etc/init.d/fake-dhclient start
fi

-- 
 _  _  _  _ _  ___    _ _  _  ___ _ _  __   If speed scares you, try
/ \/ \(_)| ' // ._\  / - \(_)/ ./| ' /(__   Windows.
\_||_/|_||_|_\\___/  \_-_/|_|\__\|_|_\ __)  
[ Mike Hicks | http://umn.edu/~hick0088/ | mailto:hick0088 at tc.umn.edu ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20020111/0274e234/attachment.pgp