McGill Wireless - if-up script

Posted March 22, 2006 in Code

Last blog entry I displayed an Epiphany plugin to solve one of my McGill wireless woes. Today I spent about 45 minutes playing with wget and bash, and I came up with a much better solution. It's quite McGill-specific, and unfortunately for many of my friends it won't work on Windows, but here it is:

Dump the following into /etc/network/if-up.d/00mcgill-wireless-login:

[ $? -eq 0 ] || exit 0

# Bizarre variables for the authentication page
NAS_IP=`host $NAS_HOST | sed -n -e '/^.*has address (.*)/{s//1/;p;q;}'`

# Pretend we're a web browser
wget "$LOGIN_PAGE" -o /dev/null -O /dev/null