yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] ESKIMOn00b:
So ive found in using devsk's 1.1 version if you store a backup with the name of an exisiting backup, you wind up with a single backup of the SD but both of the NAND backups, i BELIEVE that the latest one is the one that gets restored, but for space saving reasons ive been having to delete the backup and then store it to avoid multiple NAND images for each rom on the sd, any way to integrate this behavior into the script

Such as in the code for storing the bkup if it didnt have to mkdir the folder for the rom, then rm -r everything in it, say im storing CM-4.0.4 i already have a bkup labled this on my sd, before it actually pulls the app and NAND bkup do a simple rm -rf romdir/*. I guess if someone pointed me to the correct line of code i could do this my self, not so much the conditioning, but i dont mind if when i store a new bkup it throws an error romdir/* doesnt exist or somesuch, more often than not im updating an image ie already backed up once
[G1 Android Development] palosjr:
agreed... this would be a good feature, i usually tag my backups with name_date.

so mine would read something like

then i just go back and delete the other older ones, unless of course i was saving them for dev reasons
[G1 Android Development] BrooklynAvi:
Not Able to Select ROM Using ADB

A friend of mine was moving from an 8GB class 4 to an 8GB class 6 on his myTouch. I ran the switchrom.sh script to backup his current environment, which was indeed created (the files were all present on the SD card). I copied over his fat32 from his class 4 to the new class 6 which I partitioned with the exact same specs as his class 4 (500MB ext2, 54MB linux-swap, the rest fat32). I then booted to recovery and ran the following commands:

adb shell mount /system/sd
adb shell sh /system/sd/switchrom.sh -r

It listed the ROMs available and since there was only one, I entered "1" to run the restore. It did not allow me to type anything into the console. After trying repeatedly, I ran everything again with the following code:

adb shell mount /system/sd
adb shell sh /system/sd/switchrom.sh -r cyan-4.0.4

This time, it asked me to confirm (y/n) if I wanted it to restore the ROM. I again attempted to type the letter "y" at the prompt. Again, nothing.

I am not sure if I am missing something. The one thing I can think of is that his myTouch is using Amon_RA's RAv1.2.0 recovery and not Cyan's 1.4. Any thoughts?
[G1 Android Development] Chahk:
Try the latest version of ADB from the 1.6 r1 SDK.
[G1 Android Development] BrooklynAvi:
This sounds like it could be the problem (I knew something wasn't "plugged in," so-to-speak). I suspect that 1.6r1 is rather new since I just updated 1.5r3 pretty recently. Anyway, I hope I get the chance to try it with the updated SDK because he has already reinstalled all his apps manually. I will see if he wants me to attempt it for research purposes.

For the record, the script works really well on my G1. I finally got to try Hero since I wasn't willing to wipe my phone/partitions just to try something I didn't plan on keeping. Well, I backed up my current Cyan with switchrom, wiped and flashed Hero, tried it, liked it and successfully moved back to my original Cyan setup. So sick. This may very well be the single greatest script since nandroid. Scrap that, it IS the greatest scripts since nandroid.
[G1 Android Development] overground:
Agreed there. If you don't feel like downloading the whole 1.6 SDK, I've uploaded the essentials in case I'm somewhere where I need them. You can get it HERE. Windows version, BTW.
[G1 Android Development] palosjr:
one thing to make sure of is that the backups are within the switchrom folder on the SDcard
[G1 Android Development] cjesse:
it doesn't work at all for cm-recovery-1.4.img , xRom v1.5r4 store.

Script /sbin/nandroid-mobile.sh not found, but i'm use cm-recovery-1.4.
[G1 Android Development] palosjr:
its case sensitive and space sensitive... use all lower case and instead of a space use underscore _
[G1 Android Development] BrooklynAvi:
Thanks. I still haven't gotten around to trying it with the 1.6 SDK, which I will download anyway because I like to have the latest version (I like to attempt to write apps but nothing about which to write home yet). I will post back here when I eventually get around to it.
[G1 Android Development] BrooklynAvi:
A Thought: How About SD Card?

So after finding this absolutely genius script I have been going ROM-crazy installing and testing every ROM I can find. I have noticed an "issue" with doing this though. If I install an app that uses the SD card to store files, the app will use the same folder on the SD card regardless of ROM. In actuality, this is more often than not a good thing since the updates get reflected in all ROMs. But sometimes, it isn't all that good. Here are two possible examples off the top of my head. Using the app backup feature in Astro (my favorite thing to do, LOL), it stores apps, by default, in /sdcard/backup/apps. But let's say I want Astro to store each ROMs' backup in a different folder? One way would be to set the default backup folder to point to a different place for each ROM. But that can get messy. A second example, is My Backup Pro (another favorite of mine). It stores backups in (I use it for settings, particularly the home screen) in /sdcard/rerware/MyBackup/AllBackups. I have it set to auto-backup certain settings every day at 2am. But if I am constantly switching back and forth between ROMs I will not know which .zip files belong to which ROM. Again, I can always set the backup folder to a different location for different ROMs.

But I am only listing two examples here. I would have to do this with any app that accesses/stores data on my SD card. While I don't know that it would be practical to do this particularly considering the size of some SD cards both in terms how much people would need to back up and storing all those backups--but would it be reasonable to want the SD card zipped up and stored along with the ext partition so truly complete environments can be restored? Note that it may not always be good as is the case with Music, Listen, Greed, etc. There are many cases where it might make sense and many others where it wouldn't.

EDIT: I do understand that this is not that realistic and it's probably easier to set Astro to backup apps in different places, i.e. /backup/apps/hero, backup/apps/cyan, etc., as well as for other apps. I have a 16GB card and it's still probably not enough space to realistically do this, especially since it would not have to be for all apps which is when we move into folder selection/exclusion territory. I am merely presenting a concept here. Remember, card will eventually be much bigger and complete environments would definitely be a nice thing.

Just food for thought.
[G1 Android Development] masarliev:
Great work, but ...

This is what I did and the result is not good

1. I was with Micro Hero ROM while creating first backup.

2. I installed CM 4.0.4 (stable) and switchrom.sh file was deleted.

3. I put it again and created second backup with name "CyanogenModStable"

4. I switched to Micro Hero with no problems

5. And when I tried to restore Cyanogen I get this message

Now I can restore only Micro hero Rom
[G1 Android Development] palosjr:
go into the switchrom folder on your sd and rename it to cyanogenmodstable

its case sensitive, try to use all lowercase letters when backing up
[G1 Android Development] rainabba:
Use switchrom on Magic 32B W/O adb

I'm trying to think of a way that I could essentially switch roms on the go (without connecting to a pc).

There aren't any recovery roms that support a SIP are there? That would be the most direct way I'm sure.

Alternately, could a script be setup while booted (manually now, but perhaps using a GUI after some development) that can be made to autorun, or presented as a somewhat dynamic option in a recovery rom (I prefer RAv1.2.1 so far) that would run a backup of the current ROM (preferably with a name I'd provide), then restore a backup that exists on the SD?

Hope I'm providing enough info here to make sense. I'm sure this idea isn't too far fetched, I'm just not yet familiar enough with the tools to know for sure how it could be done.
[G1 Android Development] Faudyen:
I just wanted to throw a quick thank you out there for such an awesome script...really it is just awesome.
[G1 Android Development] traspler:
Hello

Before I try this out, I wanted to make sure I understood everything correctly and do it correctly:

I'm Currently running CM (see signature) but want to try out MicroHero on my ADP. So will switchrom backup EVERYTHING? And when I restore my current CM setup will everything be back to how it was before I flashed MicroHero?

To use it I'll just go into the Recovery console and do:

mount /system/sd
sh /system/sd/switchrom.sh -s cm-4.1.11.1

And then I flash the MicroHero ROM normally. After I had my fun I can also backup my MicroHero config with the same command and when I then want to go back to my previous CM setup I'll just go into recovery again and do:

mount /system/sd
sh /system/sd/switchrom.sh -r

And then select my cm-4.1.11.1 and everything will be as before? 100%? Because I'd hate to lose my installed apps and tweaks...
[G1 Android Development] Amon_RA:
First of all : Nice script ^^

Just one question : Why don't you just integrate it as part of the existing nandroid backup/restore script? This would make things much easier... less code, less checks, etc...
[G1 Android Development] sillyshyme:
could not get this to work

ttached script called switchrom.txt downloaded and stored in folder /system/sd/ and renamed as switchrom.sh

I tried to move and copy from a file browser on market then on computer it shows no system folder.
[G1 Android Development] sacredsoul:
I've just got 2 very noobish questions. This is my first time trying switchrom. Just made a backup of cm 4.1.11.1.

1. Does this backup SMSes/Texts too?

2. Say I moved on the Hero and I want to come back to 4.1.11.1. So I just wipe,flash 4.1.11.1, boot to recovery, and run swtichrom?

I'm sorry. I've never use nandriod before too. Mainly because I always had an error when I try to restore from backup.
[G1 Android Development] Detour1103:
I'm stuck!

I'm a noob, I know. I've followed the dev forums for awhile now, flashed and flashed and flashed, and, shamefully, haven't had the graciousness to give thanks to whom it's due. I'm hoping somebody out there can help me with this issue that I probably should be able to manage on my own. So to start, thanks to cyanogen, haykuro, JAC, Drizzy, and every other developer out there doing amazing work! Lastly, thanks to devsk for offering my next challenge...

I've finally managed to get adb working, but I'm having trouble with the code. I can't seem to push the switchrom.txt to \system\sd. Once it's there, I'm not sure how to rename it!

Can anybody throw a neophyte a bone?
[G1 Android Development] palosjr:
1. yes it backs them up but only for that rom, im sure you could pull the data and use it in another ROM but i havent messed with things enough yet.

2. bookmark CM 4.1.11.1 first, now wipe phone and then drop to recovery console and type these commands

mount /system/sd/
rm -rf /system/sd/app*
rm -rf /system/sd/dalv*

now repair ext filesystems and flash new rom. boot it up and see if you like it if not just go back and follow the instructions on how to restore a rom... instructions are in the OP.

shoot me a PM if you have questions or hit me up on gtalk - palosjr@gmail.com
[G1 Android Development] palosjr:
before you push it, rename it. make sure you have file extensions visible in windows. once it is renamed to switchrom.sh do this command

adb remount
adb push directoryoffile\switchrom.sh /system/sd/

it is very important that the slash marks are going the correct way.
[G1 Android Development] rainabba:
OR, just rename when you're pushing:

cd c:\DirectoryWithSwitchRomScript
adb push switchrom.txt /system/sd/switchrom.sh
[G1 Android Development] Detour1103:
Wow! You're my Hero (hee hee)!
[G1 Android Development] palosjr:
that works too, just didnt wanna make him think he was pushing/needing two different files.
[G1 Android Development] vigan8:
how do i do this in ADB

how do i do this in ADB
[G1 Android Development] williams2917:
hello everyone...

i am new to this scripting stuff and i cant seem to get my script working, could someone please help me??

i have changed the actual file type after downloading to .sh by opening the file and resaving it as an SH file. I put it in the system/sd/ directory, followed all the instructions and this is what keeps comin up...(this is all through cyanogen 1.4 recovery)

/ # mount /system/sd

/ # sh /system/sd/switchrom.sh -s xrom_1.5r3

sh: can't open ' /system/sd/switchrom.sh'
[G1 Android Development] palosjr:
make sure SH isnt capitalized in the file name. you arent typing the / # are you? you shouldnt.
[G1 Android Development] vigan8:
i put it on the root of my sd, and did w.e it says but it just doesnt work!! i dont know why it says cant open, i renamed and everything. i did this on my g1
[G1 Android Development] francoghini:
iv never been able to get this working! always got the error during nandroid backup cant umount bla bla bla check log. i checked it once before but i forgot how to anyone help me out?
[G1 Android Development] drjones18:
I'm having the same problem as williams2917...everything is where it should be and named what it should be but i get the "can't open" error message.

help?
[G1 Android Development] The_Chrome_Coyote:
same here :(
[G1 Android Development] mrnote8:
Delete post
[G1 Android Development] mrnote8:
May sound silly but.. idk, the only prob i get is the nandroid.log thing. . Frustrating. I've read throught the entire thread multiple times. . Maybe I missed something. .
[G1 Android Development] wcdisciple:
How do I "ENABLE SHOW EXTENSIONS"?

I downloaded the file.

I already used OI File Manager to rename it switchrom.sh

Can i go back, rename it switchrom.txt, enable "show extensions" then rename it switchrom.sh?

Once I've corrected my errors what should I see? Or will it be self-explanatory once I follow the correct procedures.

I've already followed a few examples in this thread and nothing is working for me so far.

Thanks for the assist.
[G1 Android Development] wcdisciple:
I'm also doing this from Amon-Ra's recovery. Could that be the problem?
[G1 Android Development] wcdisciple:
This worked for me. Thanks Overground. For others that are having problems with this script, give this a shot. You never know. Also, thanks to the OP for this script. It's much appreciated.

:cool: :cool: :cool: :cool: :cool: :cool: :cool: :cool: :cool:
[G1 Android Development] cx92001:
Amon-RA already included this in his recovery image. If you have his recovery, just go to console and type switchrom -[option].
[G1 Android Development] Argusi:
switchrom automagic save script?

Awesome work on this. I use it constantly. I originally posted this in Q&A, but david1171 suggested I post here and I think that was a good idea! Here is basically what I posted. Would this be possible? :)

I notice that some apps, such as the Cyanogen updater can reboot the phone and flash an update (because of a script during startup?). I started thinking and was wondering if there was a way to run a script (while the phone is booted and up) that could do this:

1. Asks for a name, (or autopopulates based on build)

2. Reboot recovery

3. Runs switchrom -s {name from step 1}

4. Reboot recovery or just recovery

5. End so I can wipe and flash or whatever.

I'm using Aman-RA's recovery (RA-dream-v1.2.2) which has switchrom built in, so mounting and all that won't be an issue.

There are a lot of possibilities for expanding on this in my head, but I'm just looking for this in particular for now. I'm not sure of the limitations, but I see a lot of use coming out of this. If it could even backup and completely reboot as an option, that would be the best backup image I could ask for! Any help would be appreciated. TIA
[G1 Android Development] freaktractor:
i would love to try this out but the instructions in the op seem very vague to me as a noob...

im using amon-ra 1.2.2 recovery image

i can get into switchrom no problem

i can even make a nandroid back up

but i have no switchrom folder on my sdcard

nor does it explain exactly how to tag or bookmark clearly imho...

what do i do?

rename the nandroid backup folder?

create a switchrom folder on my sd?

please forgive my ignorance but would love to be able to switch between multiple ROMs but im just not clear on exactly how with the info i have
[G1 Android Development] speoples20:
I love switchrom but one quick question. If I wipe my ext3 partion will restoring a rom put everything back on the ext3 partion?
[G1 Android Development] keemyb:
speoples20, Im guessing it only puts on app* and dalv* folders back on, cant remember where i got that fact from. I would use ubuntu to back up the whole of your ext3 if you really want to. Thats what I do from time to time.

Switchrom is absoluetly amazing!!!

Been using it in biology today, got kinda scared when it was telling me that it couldnt restore and to look at a log, but as soon as I plugged it into one of my schools PC's to charge it, it worked fine.

Would it be possible to auto name it like this in future versions?

DDMMYYHHMM-[ROM NAME]-[VERSION NO]

Small suggestion that could save people alot of time, but saying this know it would need some developer input so that it knows what it should call what

Keep it up!!!
[G1 Android Development] cx92001:
Yes, but only files that are present when you stored the ROM. Any modifications or apps installed after that are not coming back.
[G1 Android Development] dumfuq:
No. It will only backup restore app* and dalv* folders. If you wabt the entire ext backed up, look for bart. Backup and restore tool.
[G1 Android Development] palosjr:
just a quick note/question, this will not work for unrooted roms such as pulse and cliq. not yet at least, i tried doing a backup and it wouldnt work for the life of me. kept getting .tar error im guessing because there wasnt access to the ext partition.
[G1 Android Development] UnkzDomain:
Would it be possible to use this tool, but only to select which NANDroid backup to restore and choose not to restore the a2sd stuff?

I like to have my apps remain constant, but I experiment a lot with different ROMs and I would like to be able to switch between those, but the problem is that currently, all the recoveries that I know of only allow restoring the LATEST nandroid backup; not any of them like this does.
[G1 Android Development] funnycool:
I have a problem when I restore my backup:

/ # switchrom -r

switchrom -r

1. donut16

Choose a ROM (type in the number and press enter)...1

1

Restoring ROM donut16, proceed? (y/n) y

y

Cleaning up /system/sd ...

Restoring donut16 app data in /system/sd ...

tar: invalid tar magic

Error occurred during restoration of app data...

tar operation failed.

Do you have enough space on the /sdcard?

How Can I do???

Thanks!
[G1 Android Development] palosjr:
make sure you have enough space on the sd card for one. you need at least 1 and a half times the amount of the switchrom save. so if your save if 150 megs you need at least 225. at least thats what i have come to find out. hope this helps.
[G1 Android Development] AndroidHAX:
1.5 to 1.6?

so technically...could i go from a Hero Rom running 1.5 to Cyanogen's 4.1.999 which is based off of donut?

Just dont wanna screw myself over
[G1 Android Development] palosjr:
yes as long as you bookmark/save your hero rom first. then wipe NAND, ext, and flash away.
[G1 Android Development] AndroidHAX:
Thank you, and when i restore back to Hero the ext3 data will come back?
[G1 Android Development] palosjr:
yes, this script will restore your data and ext exactly the way it was when you saved it.
[G1 Android Development] AndroidHAX:
aweomse, thank you very much, gonna flash now
[G1 Android Development] Inches:
Syntax error

Ok.. I had storing a rom when i had switchrom.sh on my sd card, but of course the restore doesn't work from there. So I pushed it to /system/sd, but now when i input sh /system/sd/switchrom.sh -s "rom_name" enter I get

/system/sd/switchrom.sh: line 1: Usage:: not found

/system/sd/switchrom.sh: line 3: 1.: not found

/system/sd/switchrom.sh: line 4: 2.: not found

/system/sd/switchrom.sh: line 6: syntax erro: unexpect "("

I'm not really experienced with all the scripting, but I have a little understanding of whats going on internally. If someone could give me some insight it'd be greatly appreciated.

Thanks in advance
[G1 Android Development] AndroidHAX:
OK, so heres what ive done so far:

started at Cyanogen 4.1.999

nandroid back up

tagged using switchrom.sh

wipe

flash Maxisma 1.7.1 and set it up

tagged

then tried to go back to CM without wipe bc i was under the impression the script did that.

didnt work so used switchrom to go back to Maxisma and now im fine there, but id like to fuigure this out

what do i do to successfully go back to Cyan's Mod?

EDIT: Fixed, didnt move to /system/sd, this script is BEAST!!!!
[G1 Android Development] isikh:
I always hear about switchrom...I don't completely get it though..I know you can have multiple roms and switch between them okay, but say I wanted to update my hero rom which currently is MLIGN to the next version, I wipe and all, is it possible to just restore app data, so I don't have to reinstall all apps and whatnot? Or, is this restoring/switching between full ROMs only?
[G1 Android Development] mmayhew:
Huge thanks for writing this script. I've always wanted to easily try new roms and switch back and forth. This is exactly what I needed.
[G1 Android Development] palosjr:
use BART, its another useful script! just search for it. or check out amon-ra new recovery, its implemented into that.
[G1 Android Development] 00damedash:
???? soo noob

how r u supposed to move tha swichrom.sh when i try thru astro it says i cant n i dnt feel like searching thru tha 20+ pages of postes maby a 2 min utube vid yould help thank u ;)
[G1 Android Development] palosjr:
actually spelling words out may help... but in any case, just adb push it to /system/sd/ if you dont have adb, download root explorer and move it using that. OR actually read the previous pages and learn some stuff!
[G1 Android Development] Shatterv2:
Does he mean place the switchrom.sh in the root of your sd card not in any folders?

I typed in what he said and it didnt do anything.
[G1 Android Development] Chahk:
No, it doesn't.

This means the script needs to be placed on the Ext partition, not on the Fat32 one.

Do this in Console (while booted into Recovery):

mount /sdcard
mount /system/sd
mv /sdcard/switchrom.txt /system/sd/switchrom.sh
umount /sdcard

You should then be able to continue.
[G1 Android Development] Shatterv2:
trying now
[G1 Android Development] Shatterv2:
thanks for the help!
[G1 Android Development] Shatterv2:
After i save the ROM in switchrom and restore it will my sms/mms's update or is it going to go to the messages that i had when i stored the ROM?
[G1 Android Development] Chahk:
I don't use SMS myself, but unless the messaging app stores SMS on the SD card, I can only assume that restoring will bring back only the ones you had at the time you saved the ROM. I would back them (MyBackup, Backup for Root Users, etc.) up before installing another ROM, just in case.
[G1 Android Development] palosjr:
if you save a ROM and then restore it, it only restores the messages that were there when you saved. any messages since the point of save will be lost.
[G1 Android Development] Shatterv2:
Cannot open sh /system/sd/switchrom.sh

its says something near the lines of that.

i cant open or restore.

Help!!
[G1 Android Development] palosjr:
you have to mount system/sd/

when you are ready to restore do this

mount/system/sd/

sh /system/sd/switchrom.sh -r

choose the rom from the list.

you must be in recovery console.

also, if you are using amon-ra's latest custom recovery, just drop to recovery and type

switchrom -r and then choose from the list