Dear lazyweb: there must be a simple answer to this. I'm trying to write a shell script that a cron job can run every week to update our Sugar on a Stick (SoaS) test image repository. The ticket in question is Sugar Labs #2058. Longer explanation than usual given so those new to the dev/test/release cycle can follow along.

Basically, so we get nightly composes made here (as in, "Fedora automagically builds our .isos for us so we don't have to"). In order to (we assume) save on disk space, the Fedora servers only store the latest nightly compose - once a new .iso is made, the old one is gone forever, bwahaha!

This is fantastic for developing, but not so much for testing. Expecting testers to keep up with daily builds is a bit much, and it's putting a burden on people who are downloading them every day (possibly even getting into trouble with their ISP), so we decided to go with a weekly test cycle - each Thursday evening we'd designate the most recent image as the "image under test" and point everyone there. That way, developers would also know exactly what image people were finding bugs in each week.

Problem: in order to (we assume) save on disk space, the Fedora servers only store the latest nightly compose -  once a new .iso is made, the old  one is gone forever, bwahaha! So we need to grab the most recent image - which has a special naming - at that time and pull it down to the Sugar Labs servers so we have the files at http://download.sugarlabs.org/soas/test/ (We're also storing the old test images so we can go back and forth between them Since the builds do contain their build date in their name, and we can't predict ahead of time what the build date and time are, we don't know the exact filename to pull.

So we're basically looking for a shell script that will:

  1. Pull the latest iso and checksum from the SL servers
  2. Rename the checksum so it matches the datetime stamp of the iso (the checksum is currently called - rather unhelpfully - "CHECKSUM-i386").
  3. Update the symlinks so that http://download.sugarlabs.org/soas/test/soas-i386-test-latest.iso and http://download.sugarlabs.org/soas/test/soas-i386-test-latest-checksum.sha point to the latest iso and checksum that were just downloaded.

This probably requires some sort of weird wildcard bash-fu that would take me multiple hours to inelegantly figure out, and someone else 5 minutes to write a one-liner to solve.

Can haz halp?