[G1 Android Development] dumfuq:
This script is based off of devsk's switchrom.sh found here: http://xdaforums.com/showthread.php?t=541183. If you are unfamiliar with switchrom, you should probably read that thread first.

Requirements:

1) cyanogen's 1.4 recovery image, Amon_Ra's recovery image, or any other that is based off of the 1.4 recovery image.

2) an extended partition isn't required but makes it easier.

Installation:

rename bart-*.txt to bart.sh

copy bart.sh to /system/sd/

for example:

mv /sdcard/download/bart-0.9.8.txt /system/sd/bart.sh

note: if using Amon_Ra's 1.2.3 recovery, bart-0.9.2 is already included. Either type 'utility' into the console or invoke bart without sh, file extension, or path. For example: "bart -s myrom" instead of "sh /system/sd/bart.sh -s myrom".

Optional: Create config file named bart.config and place in /system/sd/

Features:

ability to store/restore ROMs based on name

store/restore all made default (nandroid and entire ext partition)

ability to customize the store/restore process

The main difference between the different restores is what data is deleted before the restoration process, not what is restored. The ext backup is kept in a single tar/tar.gz file and is extracted after deleting whatever the user chose to delete.

-r: deletes entire ext partition (rm -rf *)

-b -r: deletes apps folders and dalvik cache (rm -rf app* dalv*)

-a -r: deletes apps_s and dalvik cache (rm -rf app_* dalv*)

-n -r: deletes nothing from /system/sd

This version stores backups in /sdcard/bart. If you want your old switchrom backups available to you, just copy or move them there.

mkdir /sdcard/bart
mv /sdcard/switchROM/* /sdcard/bart/

Usage:

sh /system/sd/bart.sh [--noninteractive] [options] -s|--store [rom_name]

sh /system/sd/bart.sh [--noninteractive] [options] -r|--restore [rom_name]

sh /system/sd/bart.sh [--noninteractive] -d|--delete [rom_name]

sh /system/sd/bart.sh -l

Options:

-a|--apps_s

-b|--base, nandroid apps dalvik_cache

-c|--compress, only used with -s

-e|--ext_only

-h|--help

-n|--nandroid_only

-v|--version

--verbose

--nocache

--norecovery

--noboot

--nodata

--nosystem

--noninteractive

--reboot, only used with -r or -s

--shutdown, only used with -r or -s

Always specify options as separate words"

e.g. -c -r instead of -cr. It is required!

-r and -s need to be last or followed by rom_name.

--noninteractive needs to be first.

Don't use spaces or special characters in rom_name.

Compress will take longer but image will be smaller.

Examples:

store a complete backup, prompt for rom_name (nandroid and entire ext partition)

sh /system/sd/bart.sh -s

store nandroid, /system/sd/apps*, and /system/sd/dalv* (original switchrom behavior)

sh /system/sd/bart.sh -b -s

store nandroid only and name it mycy_nand

sh /system/sd/bart.sh -n -s mycy_nand

store complete ext partition only

sh /system/sd/bart.sh -e -s

store /system/sd/apps* and system/sd/dalv* only

sh /system/sd/bart.sh -b -e -s

store nandroid, /system/sd/apps_* and system/sd/dav* only

sh /system/sd/bart.sh -n -a -s

restore complete backup (nandroid and entire ext partition)

sh /system/sd/bart.sh -r

restore nandroid, apps folder, and dalvik-cache (original switchrom behavior)

sh /system/sd/bart.sh -b -r

restore entire ext partition only

sh /system/sd/bart.sh -e -r

restore /system/sd/app* and /system/sd/dalv* (not nandroid, only apps* dalv* folders cleared first,rest of ext partition left intact)

sh /system/sd/bart.sh -b -e -r

delete a backed up rom

sh /system/sd/bart.sh -d

list available roms

sh /system/sd/bart.sh -l

Changelog:

bart-0.9.1.sh: fixed bug where old nandroid backups were retained when same name was used.

bart-0.9.2.sh: added battery level check before restoring to avoid it crapping out midway during restore process.

bart-0.9.3.sh: added ability to send nandroid norecovery, noboot, nodata, and nosystem flags. Added verbose mode option for nandroid backup/restore.

bart-0.9.4.sh: added ability to delete ext-backup or nandroid separately. Added extra output for verbose mode.

bart-0.9.5.sh: added non-interactive mode

bart-0.9.6.sh: added option to backup/restore app_s, dalvik-cache, and nandroid

bart-0.9.7.sh: no longer tries to mount ext partition when -n option is given.

bart-0.9.8.sh: checks whether or not it is in recovery mode, increased verbosity for verbose mode, code cleanup.

bart-1.0.0.sh: ability to reboot/shutdown after store/restore, minor code cleanup

bart-1.0.1.sh: removed recovery mode check since its not always accurate

bart-1.1.0.sh: can now source a user config file.

bart-1.1.1.sh: fixed the shbang

bart-1.2.0.sh: added ability to backup/restore cache.

bart-1.3.0.sh: cache backup is now default (cache option is now --nocache). Now works with recovery's that mount ext at either /sd-ext or /system/sd.

bart-1.3.1.sh: fix to properly source bart.config on sd-ext as well (/sd-ext/bart.config or /system/sd/bart.config)

Much thanks to Devsk.

_______________________________

Of course I'll take your money.

Or you could donate to others that helped me. Such as:

cyanogen, Meltus, Amon_Ra, rgv151, Rogro82, Loccy, manup456, and many more.