Go Back   xda-developers > HTC Dream: G1 > G1 Android Development


Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 27th July 2009, 02:23 AM
devsk devsk is offline [OP]
Senior Member
 
Join Date: Dec 2008
Posts: 367
Default [UTIL] [NEW] switchrom.sh V1.1 - One step bookmark, store and restore your ROMs

Changelog:
  • 1.1 - Allow delete/restore without a name. Choose from the list.
  • 1.0 - Use nandroid to make it one step process.
Currently, nandroid backups do not contain the a2sd app folders. It has been painful to say the least to jump between ROMs.

This script does two things:

1. Store and tag a ROM's nandroid backup and its apps data. You can provide any name for tagging while storing.
2. Restore a tagged ROM's app data and its latest nandroid backup.

The nice side effect of this is that you have complete environments you have created nicely bookmarked with easy to understand names and version numbers, ready to be restored easily.

Requirements:

1. Two partitions in order: fat32, ext2/3
2. cyanogen's recovery image 1.4. 1.3.1 will not work with V1.0.
3. Attached script called switchrom.txt downloaded and stored in folder /system/sd/ and renamed as switchrom.sh

Usage:

1. Boot into recovery using Home + End buttons together.
2. To bookmark and tag current ROM,

Go into console with Alt+X (or do adb shell from PC)
mount /system/sd
sh /system/sd/switchrom.sh -s <name>

e.g.

I am backing up soulife-1.2.3 with

sh /system/sd/switchrom.sh -s soulife-1.2.3

3. To restore a ROM,

Go into console with Alt+X (or do 'adb shell' from PC)
mount /system/sd
sh /system/sd/switchrom.sh -r

It will give you a list of available ROMs to restore and you can choose the one you want to restore using the corresponding number.

e.g.

I am restoring soulife-roger-new-3.9.1-latest with

Code:
sh /system/sd/switchrom.sh -r
1. JACMyTouchSkiV2-mod                
2. JACxROM-1.3r3                      
3. cm-3.9.7-best-setup                
4. drizzy-hero-2.8-best               
5. soulife-ion-1.2.3-mod              
6. soulife-roger-new-3.9.1-latest     
Choose a ROM (type in the number and press enter)...6

Restoring ROM soulife-roger-new-3.9.1-latest, proceed? (y/n) y
Cleaning up /system/sd ...                                    
Restoring soulife-roger-new-3.9.1-latest app data in /system/sd ...
Restoring nandroid backup...                                       
Done restoring the ROM soulife-roger-new-3.9.1-latest.
Note that no extra steps are necessary. No wipe! No nandroid restore!

Note that options have changed since last version. Make sure to read the help with '-h' or '--help' option. Compression (-c option) is supported for both the apps partition and the nandroid but the way it is done in nandroid is dumb and takes like 17 minutes, so I would not recommend it at this time but you can definitely try it. I will post patches for nandroid script to fix that.

Code:
# sh /system/sd/switchrom.sh -h

Usage: /system/sd/switchrom.sh OPTIONS <rom_name>

Options are:
          -h --help
          -c --compress, only used with -s
          -d --delete
          -l --list
          -r --restore
          -s --store
          -v --version

Always specify options as separate words
  e.g. -c -r instead of -cr. Its required!
Don't use blanks or special characetrs in rom_name.
Compress will take longer but image will be smaller.
<rom_name> is optional with -r and -d. Choose from a list.
NOTES:

Note that this is not storing the whole backup of your EXT2/3 partition. This is just storing app* and dalv* folders needed to restore the ROM behavior, apps and settings only. If you wipe your EXT2/3 partition with a formatter or manually with 'rm -rf /system/sd/*', you will loose everything on that partition and won't get it back from this backup. This backup will only restore app* and dalv* folder.


It was reported that certain versions of 'adb' hangs in the sub-shell created and it doesn't pass through the commands that are typed. Make sure to upgrade the SDK to 1.5r3.
Attached Files
File Type: txt switchrom.txt (7.7 KB, 3432 views)

Last edited by devsk; 8th August 2009 at 06:59 AM..
Reply With Quote
Sponsored Links

  #2  
Old 27th July 2009, 02:34 AM
prash's Avatar
prash prash is offline
Senior Member
 
Join Date: Feb 2009
Posts: 544
Default

Awesome work, I'll try this out on my next rom switch. Can't ever have too many scripts I say.
__________________
Professional Graphic/Web Designer
My Themes: Mau5, AlienAqua, SystemForce3, and more.
If you like my contributions..Donate?
Reply With Quote

  #3  
Old 27th July 2009, 02:45 AM
haitiankid4lyf haitiankid4lyf is offline
Senior Member
 
Join Date: May 2008
Posts: 255
Default

added to my collection of scripts
Reply With Quote

  #4  
Old 27th July 2009, 03:39 AM
Binary100100's Avatar
Binary100100 Binary100100 is offline
Senior Member
 
Join Date: Apr 2008
Location: Newark, Ca
Posts: 1,337
Default

This may sound like a silly question but please forgive me as I have not yet flashed the haykuro spl.

Once you've flashed the new spl, instead of flashing the update.zip of the cyanogen rom, can't you use nandroid restore? Or will that restore the previous spl as well (in my case HARD SPL)?

I ask because I would like to try the spl, but I'm so comfortable with my rom and settings that I would hate to wipe just to try Hero which is still in development. Call me crazy, but I like stable and finished builds. But I am curious and with a lot of time on my hands but not so much that I'm willing to lose everything just to try something that I'm not going to keep.

With this script, it would make it so much easier and would allow us to switch roms on the fly... but would it work from Hero builds and non-Hero builds?
__________________
{Carrier}T-Mobile
{Phone}MyTouch 1.2 (rooted)
{ROM}port_Stokes_Eclair
{SPL}1.33.0013
{RECOVERY}RA-sapphire-v1.6.2G
{Theme}CHM-Binary100100 Version

{Phone}HTC G1
{ROM}Cyanogen 4.2.15.1 swappiness=32
or
{ROM}xRom 1.1 with CHM-Binary100100 theme
{RECOVERY}RA-dream-v1.6.2
{SPL}1.33.2005 (aka DANGER) with 2.22.23.02 Radio
{Theme}CHM-Binary100100 Version
{Storage}16gb Class 6 card (14gb/1gb ext4/96mb swap)

Twitter = Binary100100
Reply With Quote

  #5  
Old 27th July 2009, 04:05 AM
devsk devsk is offline [OP]
Senior Member
 
Join Date: Dec 2008
Posts: 367
Default

I don't think I know enough about the SPL image contents to comment on this. But as far as I know SPL is not touched by nandroid restore. I upgraded the radio and SPL (haykuro) first, and then went with updating my ROM. I will never flash radio and SPL unless and until I really need to.

This script is just taking the pain out of switching between ROMs (whether Hero or Cyano or official) and nicely organizes your ROM backups. So, to answer your question:
Quote:
would it work from Hero builds and non-Hero builds?
Yes. It would! I have switched between drizzy's Hero ROM and JACMyTouchSki (my favorite) many times using this. The restore is perfect!
Reply With Quote

  #6  
Old 27th July 2009, 04:14 AM
rondey- rondey- is offline
Senior Member
 
Join Date: Mar 2009
Location: Fort Worth
Posts: 107
Default

Quote:
Originally Posted by Binary100100 View Post
Once you've flashed the new spl, instead of flashing the update.zip of the cyanogen rom, can't you use nandroid restore? Or will that restore the previous spl as well (in my case HARD SPL)?
Considering the most amount of bricks come from radio/spl updates, I dont think this script would integrate backing up and restoring them. Same reason why rom's themselves dont include the latest radio/spl in the update.zip when it is required by the rom.
__________________
Phone: Black HTC Dream
ROM: Cyanogen 4.2.5
Recovery: Ra-dream-1.3.2
SD: A-DATA 8GB Class 6 miniSDHC
Partitions: 500MB EXT3 7500MB Fat32 64MB linux-swap
SPL: 1.33.2005
Radio: 2.22.19.26I
Reply With Quote

  #7  
Old 27th July 2009, 04:21 AM
Binary100100's Avatar
Binary100100 Binary100100 is offline
Senior Member
 
Join Date: Apr 2008
Location: Newark, Ca
Posts: 1,337
Default

Quote:
Originally Posted by rondey- View Post
Considering the most amount of bricks come from radio/spl updates, I dont think this script would integrate backing up and restoring them. Same reason why rom's themselves dont include the latest radio/spl in the update.zip when it is required by the rom.
Okay... so I'm running cyanogen's rom now with hardspl.

I back it up and lable it "Cyan 3.9"
I install the Haykuro spl (I already have the radio)
I install a Hero rom.
I try the Hero rom.
I backup the Hero rom and lable it "Hero"
I can then restore "Cyan 3.9" and still have the Haykuro spl.

Correct?
__________________
{Carrier}T-Mobile
{Phone}MyTouch 1.2 (rooted)
{ROM}port_Stokes_Eclair
{SPL}1.33.0013
{RECOVERY}RA-sapphire-v1.6.2G
{Theme}CHM-Binary100100 Version

{Phone}HTC G1
{ROM}Cyanogen 4.2.15.1 swappiness=32
or
{ROM}xRom 1.1 with CHM-Binary100100 theme
{RECOVERY}RA-dream-v1.6.2
{SPL}1.33.2005 (aka DANGER) with 2.22.23.02 Radio
{Theme}CHM-Binary100100 Version
{Storage}16gb Class 6 card (14gb/1gb ext4/96mb swap)

Twitter = Binary100100
Reply With Quote

  #8  
Old 27th July 2009, 04:41 AM
devsk devsk is offline [OP]
Senior Member
 
Join Date: Dec 2008
Posts: 367
Default

Quote:
Originally Posted by Binary100100 View Post
Okay... so I'm running cyanogen's rom now with hardspl.

I back it up and lable it "Cyan 3.9"
I install the Haykuro spl (I already have the radio)
I install a Hero rom.
I try the Hero rom.
I backup the Hero rom and lable it "Hero"
I can then restore "Cyan 3.9" and still have the Haykuro spl.

Correct?
Make sure you use labels which don't have whitespace or other special characters in the name like use Cyan-3.9 instead of "Cyan 3.9". I don't think script likes it much at this time. I need to fix that.
Reply With Quote

  #9  
Old 27th July 2009, 04:42 AM
rondey- rondey- is offline
Senior Member
 
Join Date: Mar 2009
Location: Fort Worth
Posts: 107
Default

Quote:
Originally Posted by Binary100100 View Post
Okay... so I'm running cyanogen's rom now with hardspl.

I back it up and lable it "Cyan 3.9"
I install the Haykuro spl (I already have the radio)
I install a Hero rom.
I try the Hero rom.
I backup the Hero rom and lable it "Hero"
I can then restore "Cyan 3.9" and still have the Haykuro spl.

Correct?
The only difference between this and a "typical" nandroid restore should just be that it copies your ext2/3/4 partition for the app data. It wasnt listed anywhere that it would backup/restore your spl/radio.

Prior to flashing the haykuro spl I made a nandroid backup of the cyanogen rom I was using. I tested a hero rom and restored a nandroid backup of the cyanogen rom I was running and the new radio/spl were in place.
__________________
Phone: Black HTC Dream
ROM: Cyanogen 4.2.5
Recovery: Ra-dream-1.3.2
SD: A-DATA 8GB Class 6 miniSDHC
Partitions: 500MB EXT3 7500MB Fat32 64MB linux-swap
SPL: 1.33.2005
Radio: 2.22.19.26I
Reply With Quote

  #10  
Old 27th July 2009, 04:50 AM
cyanogen's Avatar
cyanogen cyanogen is online now
Senior Member
 
Join Date: Jan 2009
Location: Pittsburgh
Posts: 1,763
Default

I think you need to dump all of mtd6ro and extract radio/spl by hand if you need to. Nandroid doesn't touch either of them.
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:32 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.