yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] dumfuq:
The only reason the tar command should give that result is if the command "ls -d *" yielded no results. If your sitting in the directory and the partition is mounted with data on it, this should not happen. I would try either checking the filesystem for errors with the recovery image or reformating the partition completely (mke2fs). Obviously if you go the reformat route you need to back it up first.

When installing roms always follow their directions. If they say wipe, you should probably wipe. This script does not help with installing roms, only backing them up and restoring them.
[G1 Android Development] V1R3Z:
thanks

thanks for the quick answers! love this place lol. im not that much of a noob at this iv been around for a long time i just never have to post cuz usually everything gets answerd one way or another...

the reason i asked was because i after i installed a rom without wiping the ext partition some of the apps would loose their icon in the app tray... and they dont work ither so i just wanted to make sure i wasnt doing anything wrong. there has to be a quick fix around ill look for it.

thanks anyways for the awsome script it works perfectly and all i did was adb push it to the /system/sd/ directory and i didnt get those errors that the previous pages were talking about.

awsome script!:D
[G1 Android Development] sagementor:
I use the RA-dream-v1.2.2 which have both switchrom and bart installed. The switchrom works fine, but the bart prompts a nandroid error, saying that the sd card is full..... :(
[G1 Android Development] overground:
I just used bart to store and restore with cyanogen's recovery. Never had a problem. Send a pm to dumfuq explaining your problem. He's very responsive. I don't even keep switchrom on my phone anymore.

EDIT: You created /sdcard/bart, right?
[G1 Android Development] bkmo:
I am the person that added the bart script to the recovery program. I tested it and it worked fine for me. Although I had used bart in the past and it created the /sdcard/bart directory. One other thing to note is that bart backs up more than switchrom. How much space is left on your fat32 partition?
[G1 Android Development] overground:
I didn't know that RA recovery included bart also. Damn, and I just pm'd Amon Ra about it. It's not listed in the OP. At any rate, I just did a restore using the copy of bart in my /system/sd (now using RA recovery) and it worked fine. Will try a backup later and report back. What are the commands to use the copy of bart built into the recovery? Just "bart" plus desired flags?
[G1 Android Development] bkmo:
I posted it in the thread. I did a re-pack of his recovery with bart 0.9 and a deldalvik command to remove the dalvik-cache directory from the sd . And yeah... just bart at the terminal prompt. Let me know if you can't find it.
[G1 Android Development] dumfuq:
Yeah bart should create the directory...its the same code as switchrom just a different variable. I just tried the ra recovery with bart. Worked great for me (no issues). I really like not having to mount the partition, or declare using full path, or the .sh at end. Makes life way easier. Thanks for doing that one.
[G1 Android Development] bkmo:
No problem. I just pulled your great script into a great new recovery program. I will post a link to a new hack I did to the Amon_RA recovery in a few. I removed the "Move apps and cache" menu item and replaced it with "Delete Dalvik from SD". Great for updating roms but leaving your apps intact.

Link to RA_Recovery 1.2.2 modded by BKMO: http://bit.ly/4ol6j7

MD5SUM 5d931f5ec408d54e0cbf5999dbe421d1 recovery-RA-dream-v1.2.2_BKMOd.img
[G1 Android Development] sagementor:
Someone told me that bart won't work well when battery goes low. I charged up my phone and ran the bart script again. It worked!!!!

Thanks all of you!!!
[G1 Android Development] BrooklynAvi:
I know that switchrom has issues when the battery is low (I assume bart does as well since it's the same base script) but I think it's related to Nandroid not doing a backup when there isn't enough battery. This can lead to an interesting problem since the script basically runs half way and stops at the Nandroid restore since Nandroid checks the battery before doing its thing. So if your battery is low you will get only half a switchrom/bart which, in at least one case in my experience, I had to reformat the ext3 partition. This wasn't a big deal since I used GParted in Ubuntu and just ran a switchrom with a new battery (after pushing switchrom.sh back to the now formatted ext3 partition) and everything was back to normal.

Anyway, I think that the solution is to have the script check the battery level just as Nandroid appears to do so that it's an all or none proposition, sort of like a transaction in SQL. While it's almost never a problem for me as I have an extended battery, when a new Cyan ROM or other juicy ROM comes out I spend a lot of time switchroming my way back and forth. LOL. Is there a way that switchrom/bart can be run as a transaction? Whatever the user chooses to do, it should either ALL run, or none of it should run. Or perhaps even a rollback added to the script where everything being affected is temporarily stored in a temp dir somewhere and if all is okay, the temp is removed.

Just my two cents regarding the best thing to happen to the G1 since root/custom ROMs.
[G1 Android Development] bkmo:
I just looked at the nandroid-mobile-sh that is included in the RA recovery and I don't see any reference of a battery check for the backup routine. I do see this for the restore portion though:

if [ "$RESTORE" == 1 ]; then
ENERGY=`cat /sys/class/power_supply/battery/capacity`
if [ "`cat /sys/class/power_supply/battery/status`" == "Charging" ]; then
ENERGY=100
fi
if [ ! $ENERGY -ge 30 ]; then
echo "Error: not enough battery power"
echo "Connect charger or USB power and try again"
exit 1
fi

I am sure this can be added though at the start of BART and Switchrom to exit before doing anything.
[G1 Android Development] My_Name_Is_Neo:
Really good work here. Kudos to you.
[G1 Android Development] overground:
Bart-0.9.2 10/07/09

Dumfuq to me:

Me to Dumfuq:

Rename attachment to bart.sh

place in /system/sd

adb remount
adb shell chmod 755 /system/sd/bart.sh

Enjoy!
[G1 Android Development] BrooklynAvi:
Sorry. I meant restore. I actually wrote both throughout the post but I experienced this during a restore. I looked at the Nandroid script as well and have actually been thinking about how to re-write the BART script to incorporate this but I have never actually written in this language (???) and the syntax is throwing me off. The if-fi and case-esac is just plain weird to me :) since I am a mostly a VB programmer. I was also having trouble understanding the case statement with the shift command as well as how functions are pulling in arguments but again, it's mostly the syntax that's throwing me off. I'd like to learn the language used for these files as I'm sure I can find something useful to write. Any good tutorials you can recommend (for intermediate coders)? I'm not a Linux guy but have been learning quickly since I got my G1.
[G1 Android Development] bkmo:
These are "bash" scripts. It is a Linux shell script. I am better at reverse engineering existing code, than writing clean code. When I am stuck I just google bash script whatever I want to do, and I usually get lots of examples. I used to be able to do some mean .bat files in the old "Bulletin Board(BBS)" days though. I am uploading a new mod of Amon_RA's 1.2.2 recovery. I have added the bart 0.9.2 (thanks Dumfuq) to it that includes your restore battery level check request. I did not mod the switchrom script as the bart script is much improved as far as I am concerned. I'll post the link in a few minutes.
[G1 Android Development] bkmo:
Updated RA_Recovery with bart 0.9.2 added

Thanks to Dumfuq for updating the bart script, and Overground for getting it to us, we have a BART that does a battery check before a restore. I have done a Re-Mod of the Amon_RA 1.2.2 recovery, and have added this new BART to it. Typing "u" at a terminal prompt will give you a menu with additional options (including a bart backup and restore).

MD5sum 8b4ecc7941536dc96622ac4c1e559bad recovery-RA-dream-v1.2.2_BKMOd_3.img

Link: http://www.4shared.com/file/138396239/81648ddd/recovery-RA-dream-v122_BKMOd_3.html

edit: I just noticed the last 3 characters of the MD5sum. Yes that is what they actually are. :)
[G1 Android Development] dumfuq:
Thanks a lot for posting 0.9.2 overground. Ill get it on the first post Monday or so.
[G1 Android Development] BrooklynAvi:
I too am an avid reverse "engineerer" since it is usually far easier and quicker than reinventing the wheel (for paid projects I am forced to code from scratch though). Anyway, thanks for the tip. I will get to Googling bash. I think it's time I finally converted from switchrom to bart. I have felt a certain allegiance to the original but bart has come so far I guess it's time already. Thanks for the addition. It's much appreciated.

Quick question. Is there something in the works for the myTouch recovery to include bart? I have no problem running it through adb but I have a few friends who are scared of command and cannot deal with adb. It would be nice if there was a menu similar to the "apply any sd" menu that ran the bart script and presented the user with the various bart options. That would be the greatest things since Nandroid backup/restore from the menu. Until then I am stuck backing up/restoring my friends phones. LOL.

Forgot to do a backup before restoring a ROM which sucks because I had a ton of data that I lost. :( It's better than my G1 breaking which has happened twice already. I'm rambling now. Later.
[G1 Android Development] dumfuq:
The shifts are just a way to walk through the arguments passed to the script. Pretty simple really. You can read more in the shift man page. Just type "man shift" in a linux terminal (not on your phone) or google. As far as case-esac or if-fi its kinda like how in html code there is always an end ([BOLD] some text you want bold [/BOLD]).
[G1 Android Development] dumfuq:
I have no plans myself at incorporating it into the mytouch recovery. I don't have a mytouch and personally I am scared of GUIs.
[G1 Android Development] BrooklynAvi:
Yeah, I'm just used to if...else...end if and if { } from VB and Java. Like I said, programming is all the same except for syntax. It'll take me a day at most to get that and then the rest of my life learning all the built in functions and other language specific crap. Oh how I wish there were one or two languages. :)

Strange because I have been using bash scripting for the GScript app (found on XDA) for awhile now and didn't even know what type of scripting it was.

LOL. I hope someone eventually gets this script into a GUI. It would make my life a whole lot simpler.

Thanks for the help guys.
[G1 Android Development] UnkzDomain:
Would it be possible to add an extra option to BART to do a NANDroid backup and then ONLY back up the /system/sd/app_s directory if it exists?

I want to be able to keep my /system/sd/app and /system/sd/app-private between builds like Hero, Blur, Pulse and donut, but the problem is that many of them symlink /system/app to /system/sd/app_s which then doesn't get backed up unless you do a full ext backup.

EDIT3: Nevermind about the errors. :D

I got it working by replacing all instances of app* with app_* instead of replacing them with app_s.
[G1 Android Development] dumfuq:
Cool, glad you got it. I will look into incorporating is into 0.9.3. Maybe 0.9.2 will never see the front page.
[G1 Android Development] intronauta:
I have problems with BART 0.9.2 script in Amon_Ra recovery 1.2.3

I have 3Gb free in my sd :(

Only makes a tar with app backups (seems ok, with wikitude error include ) , but nandroid folder is empty :confused:

*Amon_Ra_1.2.3 | Modaco 2.5.1e*
[G1 Android Development] dumfuq:
sounds like a corrupted file.

try:

boot to Amon_Ra's recovery

enter console (alt-x)

and type

e2fsck -f /dev/mmcblk0p2

Hopefully that will fix it. If not I would try uninstalling and reinstalling wikitude.

Its not actually making the backup, it is fails and exits there. It's the utility script that calls bart that is telling you it succeeded, not bart itself.
[G1 Android Development] overground:
Damn this has come a long way. While we're adding features, how about an advanced option for nandroid restore of only system and boot images, leaving the userdata alone? Also the ability to flash only the userdata.img from a backup. Let's see how bad we can screw these phones up....We've been blessed with this wonderful golden parachute called BART! :D

EDIT: While I'm thinking about it...an addition giving an option to delete only nandroid or ext data from a bookmark.

Example:

bart.sh -d
#storage list appears#
Option: 1 -e (removes ext portion)
You get the idea
[G1 Android Development] intronauta:
After clearing Wikitude (seems corrupt):

nandroid log is in ext3:
[G1 Android Development] dumfuq:
Nandroid fails if you are using /dev/block/mtdblock3 (/sdcard).

Sounds like maybe you put the script at /sdcard instead of your extended partition or you changed your working directory to /sdcard before running.
[G1 Android Development] intronauta:
mmmmmm.....

My Steps:

Init hero in Amon_RA 1.2.3 recovery mode -power+home-

adb shell

utillity

Run Bart backup

I've not downloaded the script of this post, use the recovery of amon_ra.

I don't mount sdcard in any moment.(I think...)
[G1 Android Development] dumfuq:
Please try this and post results:

boot to recovery

adb shell

bart -s myrom
[G1 Android Development] bkmo:
Why are you trying to run it from an ADB shell, and not from the console shell of the recovery program?
[G1 Android Development] intronauta:
http://xdaforums.com/showthread.php?t=561124

*

Scripts available via adb

:

o BART v0.9.2 (Backup and Restore Tool) : enter "utility" to start.

o switchrom.sh V1.1 : enter "switchrom" to start.

o sdparted v0.5.3 : enter "sdparted" to start.

I don't know how to enter to console in recovery mode.

which are the right steps from the amon_ra recovery?

Sorry if this is obvious :S
[G1 Android Development] dumfuq:
Serially? Wow. uh...its in the menu (Alt+x)
[G1 Android Development] intronauta:
mmmm In Hero? There isn't physical keyboard and no buttons gives me access :confused:
[G1 Android Development] dumfuq:
Did you ever try what I said in post #60
[G1 Android Development] dumfuq:
In regards to the whole bart backing up recovery partitions as well...

I'm thinking bart should have a option to pass nandroid its own options.
[G1 Android Development] bkmo:
That works for me. All you have to do is have a bart switch such as "-nr" pass the --norecovery switch to nandroid-mobile.sh .

These are all of them, but I really don't think we need tham all in bart.

--norecovery Will suppress restore/backup of the recovery partition If recovery.img was not part of the backup, no need to use this option as the nandroid will not attempt to restore it, same goes for all the options below"
--noboot Will suppress restore/backup of the boot partition"
--nodata Will suppress restore/backup of the data partition"
--nosystem Will suppress restore/backup of the system partition"
--nocache Will suppress restore/backup of the cache partition"
--nomisc Will suppress restore/backup of the misc partition"
--nosplash1 Will suppress restore/backup of the splash1 partition"
--nosplash2 Will suppress restore/backup of the splash2 partition"
--defaultinput Makes nandroid-mobile non-interactive, assumes default inputs from the user"
--autoreboot Automatically reboot the phone after a backup, especially useful when the compression options are on -c|--compress| --bzip2 -level since the compression op takes time and you may want to go to sleep or do something else, and when a backup is over you want the calls and mms coming through, right?"
[G1 Android Development] intronauta:
sorry!!! works perfectly! :rolleyes:
[G1 Android Development] MattKilla:
For some reason, the /sdcard directory is empty in recovery, and /system/sd is non-existent. I can access these when everything's up and running, just not in recovery. Can anyone help with this?

EDIT: Nevermind, I forgot to mount /system/sd
[G1 Android Development] overground:
These switches would pretty much make BART the first completely mobile backup/restore utility. No fastboot needed for an "in phone" restore of specific images from a nandroid.

In case my post on the previous page got missed, is it possible to add options to the -d switch to delete solely portion a of a backup such as:

bart.sh -d -e
1.cm.x.x.x.x09-27-09full
2.xrom1.4.x10-01-09nand

Please choose a rom nomber....1
Are you sure you want to delete the ext of cm.x.x.x.x09-27-09full?(y/n)y
Would you now like to rename cm.x.x.x.x09-27-09full?(y/n)y
Type in new rom name...cm.x.x.x.x09-27-09nand
cm.x.x.x.x09-27-09nand saved sucessfully

To take it further, in addition to backup and restore of specific .img's of a nandroid, an option to delete, for example, only the userdata.img of a backup may not turn out useless.

Yeah, yeah...my girlfriend says I'm needy, too. It's not just you guys.

I know these are not completely a necessity as I could go into my bart folder and do it there....Just an idea if you get bored.

Thanks!
[G1 Android Development] dumfuq:
I'm just slackin because I decided to rebuild my box. Pretty much got it back to were I need it, so I'll look at it soon.
[G1 Android Development] overground:
Cool...thanks. No rush at all. The script is golden in it's current form. Ideas for improvement is what this forum is about...oh and punking members for phones :p
[G1 Android Development] dumfuq:
bart-0.9.3

For anybody craving new ways to try and ruin there phone, I just uploaded a new script. You now have the ability to send nandroid the options to ignore recovery, boot, data, and system partitions. I also made an option to send nandroids output to the screen instead of redirecting it to the logfile. Enjoy breaking your toys.
[G1 Android Development] overground:
Hopefully this is no time soon, but the next time I get a prostitute pregnant, I'm naming the kid Dumfuq!

Could you please give us a sample string using one of the new options?

If I want to make norecovery default, would I put this in Global Settings?

nand_args=--norecovery

If I do this, then if for some strange reason I wanted to include recovery, I would have to edit the script first, right?

Oh yeah...thanks
[G1 Android Development] dumfuq:
Yeah at this point it would require edititing the script to make norecovery default. I just made nand_args a empty string that the four no's get concatenated to if chosen and then tossed it on as an option to nandroid.

So changing...

nand_args=

to

nand_args="--norecovery"

should work

As for the examples:

Watch it spin wheels

bart -n --verbose --norecovery --nosystem --nodata --noboot -s test

Restore everything except recovery while showing nandroid output.

bart --norecovery --verbose -r

Store everything but recovery

bart --norecovery -s mycy-4.9999999999999-xm

Of course If someone is not using Amon_RA's recovery all examples should be changed to:

sh /system/sd/bart.sh...

and of course add in the usually mounting stuff
[G1 Android Development] overground:
Cool, that's what I thought. In BKMO's RA-recovery mod, he has it disabled in nandroid, so it may do nothing if using that recovery anyway. Just for clarification, there shouldn't be quotation marks if we put it in the globals, or should there be? You rock!
[G1 Android Development] dumfuq:
Use the quotes.
[G1 Android Development] dumfuq:
As for deleting individual parts of backup. Not sure if it would be easy or even possible for that matter because...

1) nandroid makes an md5sum of the images to verify they are not corrupt.

2) ext partition is just dumped into one tar file. The main thing about the recovery part is what is being deleted, not what is being restored. If you store 'all' and restore 'base' only, it is still going to extract the entire tar file to the partition. The only difference is it will only delete the 'base' before restoring.

But you can overwrite backups with same name.

for example:

bart -e -s mystablerom

will update the extended partition's backup of 'mystablerom' (if it already exists) to the apps and such that are currently on your phone while leaving the nandroid part untouched.
[G1 Android Development] BrooklynAvi:
Manual Backup/Restore for myTouch

Here's a thought. I wanted to work out a scenario in which I can use bart.sh on my myTouch while on the go. I think that this could technically done if it's done manually. While it may be a little bit of a process, I think it's doable. Here's what I was thinking.

Make a script that backs up and tars the ext2/3/4 and that restores it. Of course, this can use the code already present in the bart.sh script. So there will be a br.sh script script (backup/restore) that can be used in terminal since Terminal Emulator is installed into the system folder rather than the ext partition. It can be called as follows:

sh br.sh -s #store

or

sh br.sh -r #restore

Go into recovery and create or restore a nandroid.

This is how the backup/restore could work.

For Backing Up

Step 1: Boot into recovery and make a nandroid backup.

Step 2: Reboot. Using Terminal Emulator or a file explorer, create a directory on the SD card with the name of the ROM you are backing up (basically, the same as the <rom_name> option from bart.sh). Copy the new nandroid backup to that directory.

Step 3: Using Terminal Emulator, run the br.sh script which will make a backup of your ext partition and save it somewhere on the SD card (this is a temp folder anyway).

Step 4: Copy the .tar file to the directory where you placed the nandroid backup.

The last two steps can be combined into one step if there was an option in the script for the directory name, but either way, the concept is the same.

Now you have what is essentially created by bart.sh (or rather, the original switchrom.sh) -- a backup of your ext and a nandroid to match it.

For Restoring

Step 1: Copy the nandroid backup from the <rom_name> directory of the ROM you wish to restore and place it in the nandroid directory on your SD card.

Step 2: Go to Terminal Emulator and run the br.sh script which will wipe the current ext partition and untar the backup and place it on the ext partition. The script will automatically reboot into recovery when it has completed the untar and copy processes.

Step 3: In recovery, restore the nandroid backup.

Step 4: Reboot and enjoy your ROM.

Does this sound plausible? If so, I will begin a test run of things. While this method may sound a little round about, there is currently no way for a myTouch to restore a ROM while on the train to work or waiting at the doctor's office. :) It sounds more complicated than it is but if it works, it's better than not having the ability.

EDIT: After reading through the script, it occurred to me that the current bart.sh script might work for this if the switches to just backup/restore are used to just backup/restore the ext partition. The "reboot recovery" command can simply be entered manually after the script restores the ext partition. I will run some tests on my spare G1 when I have the time (hopefully tonight).