[G1 Android Development] beast.in.black:
*** v2.1 Updated 2009-Jul-29 : Integrated into CyanogenMod ROM v3.9.3 (experimental) ***

WHAT IT DOES:

Gets ROMs: Gets a particular version of the CyanogenMod series of ROMs, verifies the MD5sum of the downloaded ROM file and sticks it on your SD card as update.zip, ready for you to flash. You can even fetch experimental and test versions of CM ROMs with this script.

List ROMs: You can list available ROMs on cyanogen's server. You can choose to list the latest available, the latest 5, or all available ROMs in the STABLE, EXPERIMENTAL and TESTING branches on cyanogen's server.

Automatically Reboot into recovery: It has an option to automatically reboot into recovery mode after a successful ROM download, to ease the flashing process. If you use this option, it counts down 10 seconds to give you a chance to change your mind in case you decide you do not want to reboot. During this countdown, you can ctrl+c out of the script (If you're doing this on the phone, to type "ctrl+c" you press the trackball, then hit the "c" key). I recommend that you install cyanogen's Recovery image :)

Backward compatibility mode: For those who prefer the way the old 1.0 script behaved, and fetch a ROM with a minimum of fuss without messing with pesky command line parameters

PRE-REQUISITES:

Busybox (for all the script goodness)

Root access (makes life easier)

Apps2SD (not mandatory)(the script goes on your ext2 partition)

HOW TO INSTALL:

In case the script is not already present in your CM ROM (or if you want to upgrade), simply follow the steps below to install/upgrade it.

Unzip the attached zip file

Push the "getcyan" script to your SD card, onto the ext2 partition. This is usually at "/system/sd". You can use adb push as follows:

adb push <PATH_TO_EXTRACTED_SCRIPT>/getcyan /system/sd

If you want to create a softlink to the getcyan script so you don't have to keep typing the full path to the script, do the following on the phone (or after running "adb shell"):

su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
rm -f /system/bin/getcyan
ln -s /system/sd/getcyan /system/bin/getcyan
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system

OR

Note that from adb, instead of typing in the whole mount command as above, you could also do the following

adb remount
adb shell
rm -f /system/bin/getcyan
ln -s /system/sd/getcyan /system/bin/getcyan

(thanks to Karolis for this tip)

Change the permissions on the script:

su
chmod 755 /system/sd/getcyan

USAGE:

You really should open up terminal and get a root shell using "su" before running the script. It has the following options:

OPTIONS :
-g VER - get/fetch CM ROM with version VER.
VER can be (see NOTE below):
latest - The latest available
x.x[.x]* - A particular version number
like 3.4 or 3.6 or 3.6.8.1
-G - get latest version. Shorthand for "-g latest"
-x - Get/list ROM(s) from experimental branch
-t - Get/list ROM(s) from testing branch
-l NUM - list/show NUM number of ROM(s).
NUM can be (see NOTE below):
latest - Show latest available ROM
some - Show the 5 latest ROMs
all - Show all available ROMs
-L - list latest. Shorthand for "-l latest"
-r - reboot into recovery after fetch
-f - override filename
-h - Help/usage (This message)
-v - Show version number of this script

NOTE:
For both the -g and the -l options above:
The ROMs listed/fetched depend on whether -t or -x
were passed in or not.
If -t was specified, then ROMs from the testing
directory will be shown/fetched
If -x was specified, then experimental ROMs will
be shown or fetched
If neither -x or -t was specified, then stable ROMs
are fetched

SHORTCUTS :
-6 - Get latest stable ROM and reboot into recovery
shorthand for "-g latest -r"
-8 - Get latest experimental ROM and reboot into recovery
shorthand for "-g latest -x -r"

EXAMPLES:

To see what the latest stable ROM is

getcyan -l latest

OR

getcyan -L

To see the last 5 experimental ROMs

getcyan -l some -x

To see all testing ROMs

getcyan -l all -t

To see what the latest experimental ROM is

getcyan -l latest -x

OR

getcyan -L -x

To get the latest stable ROM

getcyan -g latest

OR

getcyan -G

To get the latest stable ROM and automatically reboot into recovery mode

getcyan -g latest -r

OR

getcyan -G -r

OR

getcyan -6

To get the latest experimental ROM and automatically reboot into recovery mode

getcyan -g latest -x -r

OR

getcyan -G -r -x

OR

getcyan -8

To get a particular version of a ROM - say 3.6

getcyan -g 3.6

To get a particular version of a ROM - say 3.9 from the experimental branch, then reboot into recovery

getcyan -g 3.9 -x -r

To get a ROM with a particular filename. In this example, we get the "donuthole-20090725.zip" ROM from the testing branch (Notice the use of the "-f" parameter to force the filename override)

getcyan -g donuthole-20090725.zip -f -t

Backward Compatibility Mode - For that old-timey feeling. In this example, we get CM ROM version 3.6

getcyan 3.6

ACKNOWLEDGEMENTS:

ttabbal - For the md5sum idea

spacezorro - For the "latest" idea

Cyanogen - For the ROMs, man, for the ROMs :D

CHANGELOG:

2.1

Added (actually fixed) backward compatibility mode

Added version number (with option to display it, for scripting)

Cleaned up help message to remove irrelevant faff

This script is present in CyanogenMod Experimental ROM 3.9.3

2.0

List available ROMs - latest, latest 5 or all

Listing/fetching ROMs from stable, experimental and testing branches

Get latest ROM or a particular version

Ability to fetch an unconventionally-named ROM by specifying the filename on the command line

Automatically reboot into recovery mode after a successful fetch

This script is present in CyanogenMod Experimental ROM 3.9.2