Table of Contents
Having migrated from a Smoothwall box to DD-WRT, one thing I had grown accustomed to having was a robust wget. Due to circumstances of the network which I connect to, I needed a way to automatically authenticate with a username and password which was normally done by filling out a web page form. Since I wanted the router to do this automatically, I needed a way to automate it and GNU wget handles POST data, redirects, cookies, etc. very well.
While busybox wget is ample for basic file downloading tasks, it lacks the advanced features of GNU wget. To my surprise, while I saw plenty of audio and video encoders ported to OpenWRT/DD-WRT, I was unable to find an ipkg of GNU wget anywhere[1]. Compiling for DD-WRT was not entirely smooth, but it works.
GNU wget for DD-WRT was built using the OpenWRT SDK for Linux. When the wget binary was linked, there was an unresolved symbol for clock_getres. I did a cursory check and it appears that in some versions of ucLibc it is missing. I made a quick and dirty fix by commenting out calls to clock_getres and it now relies on recovery code for systems that don't support clock_getres. From what I can tell, this has no effect on functionality.
Due to size restrictions, this version of wget was not compiled with SSL support.
GNU wget can be installed with ipkg.
Example 1. Installing wget
root@ddwrt:/tmp# wget http://www.timpinkawa.net/ddwrt/ipkg/wget_1.11-4_mipsel.ipk Connecting to www.timpinkawa.net (24.15.223.201:80) root@ddwrt:/tmp# ipkg install wget_1.11-4_mipsel.ipk Unpacking wget...Done. Configuring wget...Done.
This package only supports Broadcom MIPS based routers. It has been tested on an ASUS WL-500g Premium V2 with the BCM5354 chipset.
Make sure you call the right wget in scripts. By default, busybox wget will
take priority over GNU wget. You can either prepend the location of GNU wget
on your PATH
or use an absolute path to invoke it. For example:
#!/bin/sh WGET=/jffs/usr/bin/wget $WGET http://www.example.com
root@ddwrt:/tmp/usr/bin# ./wget -V GNU Wget 1.11.4 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Originally written by Hrvoje Niksic . Currently maintained by Micah Cowan .
[1] Recently, I found that the NSLU2-Linux project has a port of wget for DD-WRT which is available through Optware. Optware's wget port is most convenient if you have external storage (USB, MMC, network, etc.) and the Optware libraries installed, however the ipkg I have provided is useful for people who would otherwise not need Optware or those without external storage since it will fit on routers with approximately 240 KB of free space.