Getting RPMs using wget

I have a machine at my desk that's mainly for administrative tasks (GUI, browsing, e-mail, etc.) and a different machine that's purely dedicated to development. I generally ssh from my main box to my dev box, and don't like to keep a GUI or a browser on that box at all.

It works pretty well, except when I need to download RPMs from our Repository. I have to download from my browser and scp to my dev box - a pain. Normally I would wget the packages all into ~/rpm/cache, the place I like to keep my RPMs, but since LinuxLink is a paid subscription I must login with a browser before I can download. Or so I thought.

Here's a script I wrote to download RPMs from LinuxLink using wget. I don't need a browser, I just need a command line with wget. I call it wgeth and place it in /opt/timesys/bin. You give it as many URLs as you want to download from LinuxLink, and it changes to ~/rpm/cache, removes any old RPMs of the same name (they do change over time, even if the RPM filename hasn't changed), and downloads what you request.

#!/bin/bash
# wgeth - wget and supply http credentials
# copyright (c) 2008 by TimeSys Corp.
# Released into public domain.

cd ~/rpm/cache

# remove old RPMs we are going to wget
for a; do
  rm -f "`basename $a`"
done

wget --http-user=username --http-password=password \
  --no-check-certificate "$@"

Don't forget, of course, to replace username and password with your actual LinuxLink username and password.