[UTIL] a2sd Updated script w/ error checking! 10/12/09 - G1 Android Development

**New version in the works. See last page for my post**
**Updated 5:51pm CST**
-Made sweeping changes to the script. Thanks Farmatito for the suggestions. Output from script also goes to adb logcat
-See script for additional changelog
**Updated 11:00am CST**
-Changed a couple "cp" commands to "ln" as this is a smarter way of doing it. Script has been updated and re-uploaded
After having issues with the current a2sd script floating around (under certain environments the script would erase all user & system apps) I decided to update it so that there is proper error checking, logging, and back-out procedures on failure. The log is stored in /data/a2sd.log so if you get stuck at a black screen or it won't boot, now you can check the log and find out where its failing! By the way, if your phone won't boot or you have a black screen obviously the only way you can read the log is by connecting the phone to a pc and using adb shell cat /data/a2sd.log .
Anyways here it is, enjoy.
Procedure
Code:
adb remount
adb shell cp /system/bin/a2sd /system/bin/a2sd.bak
adb shell push a2sd.txt /system/bin/a2sd
adb shell chmod 777 /system/bin/a2sd
adb shell reboot
Everything should work like before. But you can rest at night knowing if your phone won't boot you now have a way to know if it was related to a2sd and what the cause was
**NOTE: If you get stuck at the boot screen it's probably b/c your /system/sd partition is failing the fsck. You should probably fsck it on your own to fix any corruption. If you don't want the fsck then comment it out of the script.

Very cool, lets hope a developer picks this up and uses it.

bubonik said:
Very cool, lets hope a developer picks this up and uses it.
Click to expand...
Click to collapse
I could toss this in my next build if the masses like it (sure they will)

I was going to read through this and give a full opinion but it is too long for me to do it this late. My eyes are crossing trying to read it. But at first glance it looks good (logs are always good right ). And I've never seen shafty not do good work. I'll try to look it over in full tomorrow. Plus you've inspired me to try to think of same way to contribute to this file. So now I have to put that on my todo list.

miketaylor00 said:
I was going to read through this and give a full opinion but it is too long for me to do it this late. My eyes are crossing trying to read it. But at first glance it looks good (logs are always good right ). And I've never seen shafty not do good work. I'll try to look it over in full tomorrow. Plus you've inspired me to try to think of same way to contribute to this file. So now I have to put that on my todo list.
Click to expand...
Click to collapse
O hell yea, mike the masters on it!

miketaylor00 said:
I was going to read through this and give a full opinion but it is too long for me to do it this late. My eyes are crossing trying to read it. But at first glance it looks good (logs are always good right ). And I've never seen shafty not do good work. I'll try to look it over in full tomorrow. Plus you've inspired me to try to think of same way to contribute to this file. So now I have to put that on my todo list.
Click to expand...
Click to collapse
The more the merrier. It's too bad everyone doesn't have bash installed or we'd be able to take advantage of all the features bash includes (functions, advanced iteration loops, arithmetic).
That would be on all the ROM devs to include it though. Oh and I'm a UNIX Admin so writing shell scripts is like 60% of my job. We try and make our lives easier by writing scripts to do the work for us

shafty023 said:
The more the merrier. It's too bad everyone doesn't have bash installed or we'd be able to take advantage of all the features bash includes (functions, advanced iteration loops, arithmetic).
That would be on all the ROM devs to include it though. Oh and I'm a UNIX Admin so writing shell scripts is like 60% of my job. We try and make our lives easier by writing scripts to do the work for us
Click to expand...
Click to collapse
I figured you did something like that. Your scripts are always good. I've learned a lot from reading through stuff that you have posted. I wish I had your experience with it. I always have to fumble through to find the right syntax to do what I want to do.

miketaylor00 said:
I figured you did something like that. Your scripts are always good. I've learned a lot from reading through stuff that you have posted. I wish I had your experience with it. I always have to fumble through to find the right syntax to do what I want to do.
Click to expand...
Click to collapse
Ya I started out fumbling around just as well. Keep at it and if you ever have any questions about how to do something feel free to PM me. Shell scripting, among the other 10 programming languages I code in fluently, come second nature after years of coding in them. Java/C/C++/Sh/Bash/Lisp/Javascript/Html/Php/Jquery.

shafty023 said:
Ya I started out fumbling around just as well. Keep at it and if you ever have any questions about how to do something feel free to PM me. Shell scripting, among the other 10 programming languages I code in fluently, come second nature after years of coding in them. Java/C/C++/Sh/Bash/Lisp/Javascript/Html/Php/Jquery.
Click to expand...
Click to collapse
Sweet, i will probably take you up on that offer sometime. I have a question about running e2fsck. I always run it with the -f option because it seems like it never finds problems unless they are really bad if I don't. Would there be a problem running it in your a2sd with -fy? I've always wondered why no one uses the -f option.

miketaylor00 said:
Sweet, i will probably take you up on that offer sometime. I have a question about running e2fsck. I always run it with the -f option because it seems like it never finds problems unless they are really bad if I don't. Would there be a problem running it in your a2sd with -fy? I've always wondered why no one uses the -f option.
Click to expand...
Click to collapse
Well there's two sides to this. One could argue we should force a fsck at every boot, and then the other side is to let Android mark the partition as dirty so fsck will run only when needed. Normally the filesystem is supposed to be marked dirty if in fact it is dirty.
So if we force a fsck at every boot then that would add to the boot time of the OS but then again would ensure the filesystem isn't corrupted. It's really personal preference. It breaks down to "Speed of boot" vs "filesystem integrity"

I can't even find a2sd in cm4.1.999. Seems to have gone missing. Anyone know if it exists, and if so, where it's at?

overground said:
I can't even find a2sd in cm4.1.999. Seems to have gone missing. Anyone know if it exists, and if so, where it's at?
Click to expand...
Click to collapse
The default location is /system/bin/a2sd . If it's not there not sure where else it could be hidden at

shafty023 said:
The default location is /system/bin/a2sd . If it's not there not sure where else it could be hidden at
Click to expand...
Click to collapse
That's where it should be and used to be. I looked in the original zip and it's not there either. Checked sbin and xbin and other places where it also shouldn't be, and can't find it...weird.

overground said:
That's where it should be and used to be. I looked in the original zip and it's not there either. Checked sbin and xbin and other places where it also shouldn't be, and can't find it...weird.
Click to expand...
Click to collapse
Perhaps it was integrated into the swap file. And I don't mean swap file as in the literal swap file. I mean /system/bin/swap which is a conf file & shell script in one. I would check there to see if it was incorporated in there.

Hi,
just some comments about the "monster" a2sd script. ;-)
Hope they will help you to imprrove it further.
I would suggest to change the logging so that
it could be seen during a adb logcat of the boot process, from:
echo "Beginning a2sd `date`" >$LOG;
to e.g:
echo "Beginning a2sd `date`" | busybox tee -a $LOG;
(LOG must be initialized if it not exists)
Line 40:
e2fsck -y /dev/block/mmcblk0p2;
if [ $? -ne 0 ];
then
echo "Fail" >>$LOG;
exit 1;
fi;
else
echo "Ok" >>$LOG;
fi;
# set property with exit code in case an error occurs
setprop cm.e2fsck.errors $?;
Setprop is not executed in case of errors as we do exit. Is this intended?
Line 144:
# don't allow /data/data on sd because of upgrade issues - move it if possible
if [ -d /system/sd/data ];
then
echo -n "Found /system/sd/data which is a no-no, removing: " >>$LOG;
busybox cp -a /system/sd/data/* /data/data/;
busybox rm -rf /system/sd/data;
echo "Ok" >>$LOG;
fi;
I suggest cp -ap to preserve permissions and ownership of the copied files
I suggest to mv /system/sd/data to /system/sd/data.bak if cp fails
rather than rm all the data
Line 195:
if [ `ls -l /data/$i/ | wc -l` -ne 0 ];
then
echo -n "Moving /data/$i: " >>$LOG;
busybox cp -a /data/$i/* /system/sd/$i/;
if [ $? -ne 0 ];
then
echo "Fail" >>$LOG;
busybox umount /system/sd;
exit 1;
else
echo "Ok" >>$LOG;
fi;
fi;
I suggest to use cp -ap to preserve permissions and ownership
Line 206:
echo -n "Deleting contents in /data/$i: " >>$LOG;
busybox rm -f /data/$i/*;
I suggest rm -fR /data/$i;
Line 329:
if [ -f /system/lib/hw/lights.msm7k.so ] && [ ! -e /system/lib/hw/lights.trout.so ];
then
busybox cp /system/lib/hw/lights.msm7k.so /system/lib/hw/lights.trout.so;
fi;
if [ -f /system/lib/hw/copybit.msm7k.so ] && [ ! -e /system/lib/hw/copybit.trout.so ];
then
busybox cp /system/lib/hw/copybit.msm7k.so /system/lib/hw/copybit.trout.so;
fi;
if [ -f /system/lib/hw/sensors.msm7k.so ] && [ ! -e /system/lib/hw/sensors.trout.so ];
then
busybox ln -s /system/lib/hw/sensors.msm7k.so /system/lib/hw/sensors.trout.so;
fi;
I suggest to use ln for all.
Line 353:
/system/bin/sh /system/bin/swap;
Cannot find /system/bin/swap on my rom, maybe
if [ -e /system/bin/swap ] ; then.

shafty023 said:
The default location is /system/bin/a2sd . If it's not there not sure where else it could be hidden at
Click to expand...
Click to collapse
update-cm-4.1.99-signed/system/etc/init.d/04apps2sd

farmatito said:
update-cm-4.1.99-signed/system/etc/init.d/04apps2sd
Click to expand...
Click to collapse
Thank you...knew it had to be in there. Love your work, BTW.

echo "Beginning a2sd `date`" >$LOG;
to e.g:
echo "Beginning a2sd `date`" | busybox tee -a $LOG;
Click to expand...
Click to collapse
Unfortunately during boot anything thrown to console is not caught by adb logcat, BUT! You gave me a good idea, it will now look like this
Code:
/system/bin/logwrapper echo "Beginning a2sd `date`";
# set property with exit code in case an error occurs
setprop cm.e2fsck.errors $?;
Click to expand...
Click to collapse
Removed
Line 144:
# don't allow /data/data on sd because of upgrade issues - move it if possible
if [ -d /system/sd/data ];
then
echo -n "Found /system/sd/data which is a no-no, removing: " >>$LOG;
busybox cp -a /system/sd/data/* /data/data/;
busybox rm -rf /system/sd/data;
echo "Ok" >>$LOG;
fi;
I suggest cp -ap to preserve permissions and ownership of the copied files
I suggest to mv /system/sd/data to /system/sd/data.bak if cp fails
rather than rm all the data
Click to expand...
Click to collapse
Great catch, this has been changed
Line 195:
if [ `ls -l /data/$i/ | wc -l` -ne 0 ];
then
echo -n "Moving /data/$i: " >>$LOG;
busybox cp -a /data/$i/* /system/sd/$i/;
if [ $? -ne 0 ];
then
echo "Fail" >>$LOG;
busybox umount /system/sd;
exit 1;
else
echo "Ok" >>$LOG;
fi;
fi;
I suggest to use cp -ap to preserve permissions and ownership
Click to expand...
Click to collapse
Changed
Line 206:
echo -n "Deleting contents in /data/$i: " >>$LOG;
busybox rm -f /data/$i/*;
I suggest rm -fR /data/$i;
Click to expand...
Click to collapse
This was already being done in the following FOR loop but after inspecting further I merged the app symlinks FOR loop with this IF statement.
Line 329:
if [ -f /system/lib/hw/lights.msm7k.so ] && [ ! -e /system/lib/hw/lights.trout.so ];
then
busybox cp /system/lib/hw/lights.msm7k.so /system/lib/hw/lights.trout.so;
fi;
if [ -f /system/lib/hw/copybit.msm7k.so ] && [ ! -e /system/lib/hw/copybit.trout.so ];
then
busybox cp /system/lib/hw/copybit.msm7k.so /system/lib/hw/copybit.trout.so;
fi;
if [ -f /system/lib/hw/sensors.msm7k.so ] && [ ! -e /system/lib/hw/sensors.trout.so ];
then
busybox ln -s /system/lib/hw/sensors.msm7k.so /system/lib/hw/sensors.trout.so;
fi;
I suggest to use ln for all.
Click to expand...
Click to collapse
This change has already been made and I uploaded a new script earlier today.
Line 353:
/system/bin/sh /system/bin/swap;
Cannot find /system/bin/swap on my rom, maybe
if [ -e /system/bin/swap ] ; then.
Click to expand...
Click to collapse
Added.
Thanks for all your suggestions, I will re-upload a new version in an hour or so soon as I get a chance to change the echo commands to use logwrapper. Well I'm keeping the existing echo commands which spit output to my log but will also add another which will spit output to logcat.

miketaylor00 said:
Sweet, i will probably take you up on that offer sometime. I have a question about running e2fsck. I always run it with the -f option because it seems like it never finds problems unless they are really bad if I don't. Would there be a problem running it in your a2sd with -fy? I've always wondered why no one uses the -f option.
Click to expand...
Click to collapse
I take it back, after having suffered yet another file system corruption on my /system/sd partition I'm putting that darn "-f" in there. I'll re-upload a new copy with other changes shortly

Posted a new copy of the a2sd script with lots of changes. Check it out everyone. As always suggestions & questions are welcome

Related

REQUEST/IDEA for a safety script for tweaking/OC

I had an Idea for a script that would run at bootup, and if a certain variable had a "value" of NOT 1.
then the script would change the CHMOD of a userinit.sh located in the sd-ext from 050 or 777 to 750 then it would change the variable "value" to 0 were it would stay untill another script that runs at shut down or reboot setts the variable to 1 and changes CHMOD back to 050 or 777 so that the userinit.sh is not run.
That way if a change is made during operating the phone that causes the phone to crash with out shutting down properly the script runs which causes the userinit.sh to run and "resets" userinit.sh values to a "default". Otherwise if shut down properly nothing happens.
This could be expanded on to include repairing the EXT or clearing some special cache or other stuff I am unfamiliar with but that you might want to run after a crash.(like logcat?)
any way what do you think? any promise?
I think, for overclocking purposes anyway, making the userinit.sh unrunnable would make the phone break immediately, as I think it would go to the highest available frequency. However, I like the idea, though I'm not sure how to run scripts on shutdown. I think for overclocking, it would check if the shutdown was clean on startup, and if not change the applicable line to the next lowest number, which it would get either from a seperate file or maybe it could be stuffed in the script itself. (Just my somewhat uneducated thoughts)
TheNewGuy said:
I had an Idea for a script that would run at bootup, and if a certain variable had a "value" of NOT 1.
then the script would change the CHMOD of a userinit.sh located in the sd-ext from 050 or 777 to 750 then it would change the variable "value" to 0 were it would stay untill another script that runs at shut down or reboot setts the variable to 1 and changes CHMOD back to 050 or 777 so that the userinit.sh is not run.
That way if a change is made during operating the phone that causes the phone to crash with out shutting down properly the script runs which causes the userinit.sh to run and "resets" userinit.sh values to a "default". Otherwise if shut down properly nothing happens.
This could be expanded on to include repairing the EXT or clearing some special cache or other stuff I am unfamiliar with but that you might want to run after a crash.(like logcat?)
any way what do you think? any promise?
Click to expand...
Click to collapse
Keep it simple. If a change in userinit.sh breaks your system, reboot to recovery and edit it and reboot again.
TheNewGuy said:
I had an Idea for a script that would run at bootup, and if a certain variable had a "value" of NOT 1.
then the script would change the CHMOD of a userinit.sh located in the sd-ext from 050 or 777 to 750 then it would change the variable "value" to 0 were it would stay untill another script that runs at shut down or reboot setts the variable to 1 and changes CHMOD back to 050 or 777 so that the userinit.sh is not run.
That way if a change is made during operating the phone that causes the phone to crash with out shutting down properly the script runs which causes the userinit.sh to run and "resets" userinit.sh values to a "default". Otherwise if shut down properly nothing happens.
This could be expanded on to include repairing the EXT or clearing some special cache or other stuff I am unfamiliar with but that you might want to run after a crash.(like logcat?)
any way what do you think? any promise?
Click to expand...
Click to collapse
most rom devs/tweakers launch userinit.sh by calling it with a sh
e.g.
/system/bin/sh /system/sd/userinit.sh
so it will still run !! ( as init doesn't care about permissions, it is god )
don't believe me?
Code:
echo "echo I ran" > /data/test.sh
chmod 000 /data/test.sh
sh /data/test.sh
Keep it simple. If a change in userinit.sh breaks your system, reboot to recovery and edit it and reboot again.
Click to expand...
Click to collapse
Yea thats the easy way!...
(Seriously I'm not that good at Linux Command Line code,wording,but i'm getting there.)
I think, for overclocking purposes anyway, making the userinit.sh unrunnable would make the phone break immediately, as I think it would go to the highest available frequency. However, I like the idea, though I'm not sure how to run scripts on shutdown. I think for overclocking, it would check if the shutdown was clean on startup, and if not change the applicable line to the next lowest number, which it would get either from a seperate file or maybe it could be stuffed in the script itself. (Just my somewhat uneducated thoughts)
Reply With Quote
Click to expand...
Click to collapse
And I know that most roms now have a script called something like in /system/etc/init.d/20userinit that runs at startup and checks to see if a userinit.sh is present in sd-ext,if so it runs it.Also I noticed that the script can be there but if it is CHMOD to 777 it wont run. This is the "Reset script" Set to restet to something you like and run other tasks to help Fix/Diagnose probs.
The OC changes would be made from a different script such as 86supersettings
Or a userinit located in system/sd maybe ?
The thing is making sure one is read before the other.
Any way I probably will just learn the language better and do it from recovery console.
Thanks again
TheNewGuy said:
Yea thats the easy way!...
(Seriously I'm not that good at Linux Command Line code,wording,but i'm getting there.)
And I know that most roms now have a script called something like in /system/etc/init.d/20userinit that runs at startup and checks to see if a userinit.sh is present in sd-ext,if so it runs it.Also I noticed that the script can be there but if it is CHMOD to 777 it wont run. This is the "Reset script" Set to restet to something you like and run other tasks to help Fix/Diagnose probs.
The OC changes would be made from a different script such as 86supersettings
Or a userinit located in system/sd maybe ?
The thing is making sure one is read before the other.
Any way I probably will just learn the language better and do it from recovery console.
Thanks again
Click to expand...
Click to collapse
chmod 777 makes it rw and executable by everyone!!!!!!!!
have a look here
http://www.comptechdoc.org/os/linux/usersguide/linux_ugfilesp.html
but as I mentioned above, init ( the initial progam runs as root and doesn't care about permissions, ( it wouldn't be very good at doing initialising the system if it had to seek permission )
Yea your right. Well I said I wasn't that good at this linux stuff! Now I Proved it.
Any way as you can see this is more of a request..... I still think it's a good Idea.
Thanks for your help FireRat.
Keep it simple. If a change in userinit.sh breaks your system, reboot to recovery and edit it and reboot again.
Click to expand...
Click to collapse
I understand how I could manualy Replace the modified script with a default one that was on my sdcard from within recovery after a faild OC change...but..
Are you saying I could actualy modify the original script from recover? Do you have any info on how? A link?
TheNewGuy said:
I understand how I could manualy Replace the modified script with a default one that was on my sdcard from within recovery after a faild OC change...but..
Are you saying I could actualy modify the original script from recover? Do you have any info on how? A link?
Click to expand...
Click to collapse
If you have RA-Recovery, adb works, so you can pull/push the userinit.sh script. You can also enter the terminal and use vi to edit it from recovery. You may have to mount the ext partition first, but that's pretty easy. "mount /system/sd" will do it, if /system/sd doesn't exist, "mkdir /system/sd".
Ok, Thanks that makes sense. I'm still learning adb though. And I tried vi once before with no luck. But now I know what to learn about.
Thanks a lot I appreciate it.
TheNewGuy said:
Ok, Thanks that makes sense. I'm still learning adb though. And I tried vi once before with no luck. But now I know what to learn about.
Thanks a lot I appreciate it.
Click to expand...
Click to collapse
ok, this would do what you want
/system/bin/shutdown
bold is new
Code:
#!/system/bin/sh
stop;
stop dhcpcd;
sleep 1;
[B]echo "1" > /data/cleanshutdown[/B]
for i in `cat /proc/mounts | cut -f 2 -d " "`;
do
busybox mount -o remount,ro $i 2>&1 > /dev/null;
done
sync;
if [ "$1" = "-r" ];
then
toolbox reboot -f;
else
toolbox reboot -fp;
fi
your script
Code:
#!/system/bin/sh
if [ "`cat /data/cleanshutdown`" != "1" ];
then
echo "shutdown was not clean"
[B]your tweaks[/B]
else
echo "shutdown was clean"
[B]your tweaks[/B]
fi
echo "0" > /data/cleanshutdown
I'm not sure you need it,
this is for education value, if you want to play ^^^ is where to start
Thank You!
That is perfect
I need to add all of this to the startup script right?
if [ "`cat /data/cleanshutdown`" != "1" ];
then
echo "shutdown was not clean"
your tweaks
else
echo "shutdown was clean"
your tweaks
fi
echo "0" > /data/cleanshutdown
Click to expand...
Click to collapse
I am going to use the beta boot up script from ZKX called 86Supersettings, but I could use a userinit/user.conf like most do. Correct?
TheNewGuy said:
Thank You!
That is perfect
I need to add all of this to the startup script right?
I am going to use the beta boot up script from ZKX called 86Supersettings, but I could use a userinit/user.conf like most do. Correct?
Click to expand...
Click to collapse
well, a .conf file should be just that
a file with configurations , not an executable script
well, a .conf file should be just that
a file with configurations , not an executable script
Click to expand...
Click to collapse
OK. I guess I meant both together. I would use the user.conf to make tweaks. Then have to modify the userinit.sh with the part you made. Something like.
#!/system/bin/sh--LEAVE THIS OUT. ITS ALL READY AT THE BEGINNING
if [ "`cat /data/cleanshutdown`" != "1" ];
then
echo "shutdown was not clean"
Dont run user.conf
and set cpu or other stuff to "default"
else
echo "shutdown was clean"
Run user.conf for tweaked settings
fi
echo "0" > /data/cleanshutdown
Click to expand...
Click to collapse
If I'm way off then I guess I need to re-read the Userinit thread.
TheNewGuy said:
OK. I guess I meant both together. I would use the user.conf to make tweaks. Then have to modify the userinit.sh with the part you made. Something like.
If I'm way off then I guess I need to re-read the Userinit thread.
Click to expand...
Click to collapse
well, in practise it doesn't matter
the file extension is only for use humans, if I'm looking in a directory and I see .conf I expect it to be a configuration file, I see .sh, its a shell script, .py python, pl perl .......
I see. Well Thanks again for your help. Your script does work. I tried it. crash on purpose.
I still have a lot to learn.
Folks;
1) If you're OC'ing via SetCPU, remember that this doesn't change the recovery kernel, and you can uninstall SetCPU from Recovery. From there, all you need is a "safe" userinit.sh.
3) If you're OC'ing via userinit.sh -- same deal. Your phone crashes on you and you just edit it to a safe config from recovery.
Tweak away.
This is what I ended up with
Thanks to
XxKolohexX
FireRat
Licknuts
Code:
#!/system/bin/sh
#
echo 255 >/sys/class/leds/blue/brightness;
echo "+++ Now entering the speedy madness of Z.X.D.!"
echo "----- let's clear that Cache first."
echo "----- Too much DBs make System go sloow..."
echo "----- Also be shure to check out CacheMate"
echo "----- It's in the Market. (Made by Android AppCritic)."
echo "----- It's way more powerfull than this script!"
echo "----- (Times 10 or 100... Clears everything :P)"
echo "----- And this script already took hours to build..."
echo "----- domenukk - 2010."
find /data/data -name app_admob_cache | while read line; do du -s $line/* | cut -f1; rm -Rf $line/*; done;
find /data/data -name cache | while read line; do du -s $line/* | cut -f1; rm -Rf $line/*; done;
find /data/data -name google_analytics.db | while read line; do du -s $line | cut -f1; rm -Rf $line; done;
find /data/data -name webviewCache.db | while read line; do du -s $line | cut -f1; rm -Rf $line; done;
rm -rf /data/data/com.facebook.katana/files
rm -rf /data/data/com.google.android.apps.genie.geniewidget/app_news_image_cache
rm -rf /data/data/com.code.i.music/app_admob_cache
rm -rf /data/data/fm.last.android/databases/google_analytics.db
echo "--- All the Cache has been cleared."
sleep 10
echo 0 >/sys/class/leds/blue/brightness;
####determin if shutdown was clean####
if [ "`cat /data/cleanshutdown`" != "1" ];
then
####RUN CLEAN SHUTDOWN SCRIPT####
echo 255 >/sys/class/leds/green/brightness;
####Turbo Script by [email protected]####
####Prioritize everyting ####
echo "----- Enabling Turbo."
dirty_writeback_centisecs=500
/system/bin/prior &
#
# Linux-SWAP
#
if [ -e /dev/block/mmcblk0p3 ];
then
if [ -n /dev/block/mmcblk0p3 ];
then
echo "+++ Set Linux Swap"
busybox mkswap /dev/block/mmcblk0p3;
fi;
if [ -e /dev/block/mmcblk0p3 ];
then
echo "+++ Set Swapiness"
echo 100 > /proc/sys/vm/swappiness;
echo "+++ Activate Swap"
busybox swapon /dev/block/mmcblk0p3;
fi;
fi;
####Better CPU Settings...####
echo "----- Speed up the CPU"
echo 633600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo 122800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 95 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold;
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load;
echo 100000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate;
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias;
echo 0 >/sys/class/leds/green/brightness;
echo 255 >/sys/class/leds/blue/brightness;
else
####RUN DIRTY SHUTDOWN SCRIPT####
echo 255 >/sys/class/leds/red/brightness;
####Turbo Script by [email protected]####
####Prioritize everyting ####
echo "----- Enabling Turbo."
dirty_writeback_centisecs=500
/system/bin/prior &
#
# Linux-SWAP
#
if [ -e /dev/block/mmcblk0p3 ];
then
if [ -n /dev/block/mmcblk0p3 ];
then
echo "+++ Set Linux Swap"
busybox mkswap /dev/block/mmcblk0p3;
fi;
if [ -e /dev/block/mmcblk0p3 ];
then
echo "+++ Set Swapiness"
echo 83 > /proc/sys/vm/swappiness;
echo "+++ Activate Swap"
busybox swapon /dev/block/mmcblk0p3;
fi;
fi;
####Better CPU Settings...####
echo "----- Speed up the CPU"
echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo 122800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 45 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold;
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load;
echo 2000000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate;
echo 200 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias;
fi;
echo "0" > /data/cleanshutdown
echo "+++ continue on lame stock SuperD boot "
##Clearing Davlik-Cache##
for dc in dalvik-cache;
do
umount /cache/$dc;
rm -fr /cache/$dc;
mkdir /cache/$dc;
chown 1000:1000 /cache/$dc;
chmod 771 /cache/$dc;
mount -o bind /data/$dc /cache/$dc;
done;
Named 86supersettings so it runs after userinit.sh if one exists.
I put some Led indicators in so you can tell if it ran right at boot up. (about all I did besides copy and paste) Thinking about adding some other stuff like repair ext, or some kind of log to help me see what happed... any suggestions.
OK, here's another Idea for another safety feature...
I would like to "hard code" a temp fail-safe in to the code. I would like to get rid of SetCPU and when OC-ing it's nice to have a temp failsafe.SHUTDOWN!LOL
Any way I guess I would just add a few lines to some existing script in my phone?.... Any suggestions.
Thanks for your time.

[SCRIPT] 32A - 32B detection script

Hi,
I don't know how-to detect if a device is 32B or 32A automatically.... Logically, if we do a free command during recovery install, we can AUTOMATICALLY check if it's a 32B/A, then, we create a gile on sdcard called 32B/A, or a prop, and when it flash kernel, or wifi module or sound things, we include this prop in the script
Can anyone create this script?
[EDIT]
Many Thanks to Firerat who mades the script, and a little to me, who has the idea!
So the script is here:
Code:
#!/sbin/sh
# Idea : Artifex14
# script : Firerat => THE BEST!
# 28.06.10
ram=`free|awk '/Mem/ { print $2 }'`
if [ "ram" -gt "97884" ];
then
model=32a
echo "32a"
else
model=32b
echo "This device is a 32b"
fi
if [ "model" = "32a" ];
then
ln -s /tmp/boot.img /tmp/boot32a.img
ln -s /dev/null /tmp/boot32b.img
else
ln -s /tmp/boot.img /tmp/boot32b.img
ln -s /dev/null /tmp/boot32a.img
fi
I thought about this too. It could be done at the time the rom is flashed, but up to now I only know how to make update-script, not updater-script or update-binary. You could pack all sorts of boot images, and then, say, a system-dream, system-sapphire, and system-magic folder and depending on the board version property, flash the appropriate versions of files, at least in theory that should work, plus it prevents you from having to flash extra files just for cross-device compatibility.
jubeh said:
I thought about this too. It could be done at the time the rom is flashed, but up to now I only know how to make update-script, not updater-script or update-binary. You could pack all sorts of boot images, and then, say, a system-dream, system-sapphire, and system-magic folder and depending on the board version property, flash the appropriate versions of files, at least in theory that should work, plus it prevents you from having to flash extra files just for cross-device compatibility.
Click to expand...
Click to collapse
Can you do the script? For the updaterscript, it's OK!
et a script to run
Code:
free|awk '/Mem/ { print $2 }'
and test that, e.g.
Code:
#!/sbin/sh
# KernelPrep.sh
ram=`free|awk '/Mem/ { print $2 }'`
if [ "ram" -gt "97884" ];
then
model=32a
else
model=32b
fi
if [ "model" = "32a" ];
then
ln -s /tmp/boot.img /tmp/boot32a.img
ln -s /dev/null /tmp/boot32b.img
else
ln -s /tmp/boot.img /tmp/boot32b.img
ln -s /dev/null /tmp/boot32a.img
fi
get your updater script to run that, then copy your kernels to /tmp/
Code:
package_extract_dir("kernels", "/tmp");
or
Code:
copy_dir PACKAGE:kernels TMP:
next you can
Code:
write_raw_image("/tmp/boot.img", "boot"),
or
Code:
write_raw_image TMP:boot.img BOOT:
edit:
ps, you don't really need the second if statement, but its easier to read like that
oops , nearly forgot about the kernel modules
Code:
mount /system
install -d /system/lib/modules
ln -s /system/lib/modules /tmp/modules32a
ln -s /dev/null /tmp/modules32b
Firerat said:
et a script to run
Code:
free|awk '/Mem/ { print $2 }'
and test that, e.g.
Code:
#!/sbin/sh
# KernelPrep.sh
ram=`free|awk '/Mem/ { print $2 }'`
if [ "ram" -gt "97884" ];
then
model=32a
else
model=32b
fi
if [ "model" = "32a" ];
then
ln -s /tmp/boot.img /tmp/boot32a.img
ln -s /dev/null /tmp/boot32b.img
else
ln -s /tmp/boot.img /tmp/boot32b.img
ln -s /dev/null /tmp/boot32a.img
fi
get your updater script to run that, then copy your kernels to /tmp/
Code:
package_extract_dir("kernels", "/tmp");
or
Code:
copy_dir PACKAGE:kernels TMP:
next you can
Code:
write_raw_image("/tmp/boot.img", "boot"),
or
Code:
write_raw_image TMP:boot.img BOOT:
edit:
ps, you don't really need the second if statement, but its easier to read like that
oops , nearly forgot about the kernel modules
Code:
mount /system
install -d /system/lib/modules
ln -s /system/lib/modules /tmp/modules32a
ln -s /dev/null /tmp/modules32b
Click to expand...
Click to collapse
I'll try that, THANK!
oops typo
if [ "ram" -gt "97884" ];
should be
if [ "$ram" -gt "97884" ];

Elementary sh scripting doubt

I'm trying to run scripts in recovery and running into some trouble.
Example1:
Code:
#!/sbin/sh
if [ -s /system/etc/data2sd.on ]; then echo Presemt; else echo No; fi;
Output:
Code:
sh /tmp/test.sh
Presemt
Example2:
Code:
#!/sbin/sh
if [ -s /system/etc/data2sd.on ];
then
echo Presemt;
else
echo No;
fi;
Output
Code:
sh /tmp/test.sh
: not foundh: line 7:
: not foundh: line 7:
No
: not foundh: line 7:
/tmp #
I've been trying out different spacing, and punctuation; still cannot work this out. I'm running it on a Desire. If anyone could offer some suggestions on a fix, I'd be thankful. I've got a very complex script if/else script which runs fine when run in init.d as busybox runparts. However this simple script doesnt run in recovery without errors!
droidzone said:
Example2:
Code:
#!/sbin/sh
if [ -s /system/etc/data2sd.on ] [B]# remove the ;[/B]
then
echo Presemt;
else
echo No;
fi [B]# remove the ;[/B]
Click to expand...
Click to collapse
This should work
Benee said:
This should work
Click to expand...
Click to collapse
Thanks for the reply!
But..now it gives:
Code:
cat test.sh
#!/sbin/sh
if [ -s /system/etc/data2sd.on ];
then
echo Presemt;
else
echo No;
fi
#test/tmp # sh /tmp/test.sh
sh /tmp/test.sh
[B]/tmp/test.sh: line 8: syntax error: unexpected end of file (expecting "fi")[/B]
/tmp #
Another one:
Code:
#!/sbin/sh
#Restore backed up Settings
if [ -s /tmp/data2sd/data2sd.on ]; then cp /tmp/data2sd/*.* /system/etc/ ; echo "All backed up"; else echo "Not backing up"; fi;
The above script works perfectly.
The one below gives an error:
Code:
#!/sbin/sh
#Restore backed up Settings
if [ -s /tmp/data2sd/data2sd.on ];
then
cp /tmp/data2sd/*.* /system/etc/ ;
echo "All backed up" ;
else
echo "Not backing up" ;
fi ;
I'm wondering whether recovery sh does not support multiline if/else statements.
/tmp/data2sd # sh /tmp/test.sh
sh /tmp/test.sh
: not foundh: line 9:
: not foundh: line 9:
Not backing up
: not foundh: line 9:
/tmp/data2sd #
Click to expand...
Click to collapse
droidzone said:
Code:
if [ -s /system/etc/data2sd.on ] [B]No ; here[/B]
then
echo Presemt;
else
echo No;
fi
Click to expand...
Click to collapse
droidzone said:
Another one:
Code:
#!/sbin/sh
#Restore backed up Settings
if [ -s /tmp/data2sd/data2sd.on ] [B]No ; here[/B]
then
cp /tmp/data2sd/*.* /system/etc/ ;
echo "All backed up" ;
else
echo "Not backing up" ;
fi [B]No ; here[/B]
Click to expand...
Click to collapse
If, then, else fi lines don't end with a ; .
Benee said:
If, then, else fi lines don't end with a ; .
Click to expand...
Click to collapse
Thanks again..I've modified it as:
Code:
#!/sbin/sh
#Restore backed up Settings
if [ -s /tmp/data2sd/data2sd.on ]
then
cp /tmp/data2sd/*.* /system/etc/ ;
echo "All backed up" ;
else
echo "Not backing up" ;
fi
This gives this error:
/tmp/data2sd # sh /tmp/test.sh
sh /tmp/test.sh
sh: missing ]
: not foundh: line 9:
Not backing up
: not foundh: line 9:
/tmp/data2sd #
Click to expand...
Click to collapse
This is weird. I cant understand why it wont run smoothly. If I put it all on one line, it runs correctly.
droidzone said:
Code:
#!/sbin/sh
#Restore backed up Settings
if [ -s /tmp/data2sd/data2sd.on ]
then
cp /tmp/data2sd/*.* /system/etc/
echo "All backed up"
else
echo "Not backing up"
fi
Click to expand...
Click to collapse
Man I'm stupid Too early in the morning for me. No need for ; at all ...
Benee said:
Man I'm stupid Too early in the morning for me. No need for ; at all ...
Click to expand...
Click to collapse
Code:
#!/sbin/sh
#Restore backed up Settings
if [ -s /tmp/data2sd/data2sd.on ]
then
cp /tmp/data2sd/*.* /system/etc/
echo "All backed up"
else
echo "Not backing up"
fi
Now the error code has changed. It's still giving me the wrong output.
sh /tmp/test.sh
sh: missing ]
: not foundh: line 9:
Not backing up
~ # sh /tmp/test.sh
sh /tmp/test.sh
sh: missing ]
: not foundh: line 9:
Not backing up
~ #
Click to expand...
Click to collapse
I then put a ; after the ]
Code:
#!/sbin/sh
#Restore backed up Settings
if [ -s /tmp/data2sd/data2sd.on ];
then
cp /tmp/data2sd/*.* /system/etc/
echo "All backed up"
else
echo "Not backing up"
fi
This gives:
sh /tmp/test.sh
: not foundh: line 9:
: not foundh: line 9:
Not backing up
Click to expand...
Click to collapse
droidzone said:
Code:
#!/sbin/sh
#Restore backed up Settings
if [ -s /tmp/data2sd/data2sd.on ]
then
cp /tmp/data2sd/*.* /system/etc/
echo "All backed up"
else
echo "Not backing up"
fi
...
Click to expand...
Click to collapse
hrmm maybe some debugging trys.
Code:
if [ -s /tmp/data2sd/data2sd.on ]
then
echo "All backed up"
else
echo "Not backing up"
fi
Try this
Benee said:
hrmm maybe some debugging trys.
Code:
if [ -s /tmp/data2sd/data2sd.on ]
then
echo "All backed up"
else
echo "Not backing up"
fi
Try this
Click to expand...
Click to collapse
That gives this:
sh /tmp/test.sh
/tmp/test.sh: line 8: syntax error: unexpected "fi" (expecting "then")
Click to expand...
Click to collapse
droidzone said:
Thanks again..I've modified it as:
Code:
#!/sbin/sh
#Restore backed up Settings
if [ -s /tmp/data2sd/data2sd.on ]
then
cp /tmp/data2sd/*.* /system/etc/ ;
echo "All backed up" ;
else
echo "Not backing up" ;
fi
Click to expand...
Click to collapse
Tangent: unless I'm mistaken, *.* will not backup everything but only files with a "." in their name. You should use 'cp /tmp/data2sd/* /system/etc/' instead.
Also, isn't it 'cp SOURCE DESTINATION' ? Do you really want to back up from /tmp/data2sd to /system/etc ?
fake edit: ah, just saw the comment . Then it should be "All restored"/"Not restoring" right ?
Code:
if [ -s /tmp/data2sd/data2sd.on ]; then
echo "All backed up"
else
echo "Not backing up"
fi
again
10 Chars
SebHTCHero said:
Tangent: unless I'm mistaken, *.* will not backup everything but only files with a "." in their name. You should use 'cp /tmp/data2sd/* /system/etc/' instead.
Also, isn't it 'cp SOURCE DESTINATION' ? Do you really want to back up from /tmp/data2sd to /system/etc ?
fake edit: ah, just saw the comment . Then it should be "All restored"/"Not restoring" right ?
Click to expand...
Click to collapse
You're right. I was kind of going along with the msdos style wildcards. But my files (data2sd.ver, data2sd.log) do have a . in between.
Yup, I'm indeed restoring from tmp. Since it was a debug, I wasnt paying attention to the echo commands. It's the second part of a script, the first part of which backs up these files to tmp before system format, and then restores them after. Unfortunately, as soon as I make it multiline, it fails with some error.
Benee said:
Code:
#!/sbin/sh
#Restore backed up Settings
if [ -s /tmp/data2sd/data2sd.on ]; then
echo "All backed up"
else
echo "Not backing up"
fi
again
10 Chars
Click to expand...
Click to collapse
Again
Code:
sh test.sh
test.sh: line 7: syntax error: unexpected "fi" (expecting "then")
droidzone said:
Again
Code:
sh test.sh
test.sh: line 7: syntax error: unexpected "fi" (expecting "then")
Click to expand...
Click to collapse
In my kernel compile script on line 63 there is a similar if. It should work. I don't know what is wrong anymore. Really strange
Compile script
Benee said:
In my kernel compile script on line 63 there is a similar if. It should work. I don't know what is wrong anymore. Really strange
Compile script
Click to expand...
Click to collapse
Thanks anyway.
I noticed that your script uses bash as the script debugger
#!/bin/bash
Could there be a difference in these two? I dont think this is it either. I saw similiar if/else script in Firerat's MTD patcher script too, and that seems to work.
Thanks a lot anyway..I'll just put the script on one big line.
droidzone said:
Thanks anyway.
I noticed that your script uses bash as the script debugger
#!/bin/bash
Could there be a difference in these two? I dont think this is it either. I saw similiar if/else script in Firerat's MTD patcher script too, and that seems to work.
Thanks a lot anyway..I'll just put the script on one big line.
Click to expand...
Click to collapse
hehe yeah... the sbin and bin shouldn't fix the problem. I can't find the error. Everything is looking good. But yeah this is a solution
What editor are you using for the multi-line script? Are you saving it in DOS format? bash won't read the \r\n from a Windows/DOS text editor at the end of lines if you're using Notepad, etc.
romracer said:
What editor are you using for the multi-line script? Are you saving it in DOS format? bash won't read the \r\n from a Windows/DOS text editor at the end of lines if you're using Notepad, etc.
Click to expand...
Click to collapse
Used Notepad++. It seems to be good enough for update-scripts.
droidzone said:
Used Notepad++. It seems to be good enough for update-scripts.
Click to expand...
Click to collapse
Maybe, but update-scripts aren't BASH scripts. BASH does care about line endings; I don't know whether Amend/Edify do or not.
Anyway, Notepad++ can save with UNIX line endings. I don't use it, but this forum post suggests you look in the options:
http://www.phpbb.com/community/viewtopic.php?f=71&t=2083365
Notepad++ > Settings > Preferences > New Document/Default Directory > Format > Unix.
Other Google searches indicate there may be a conversion option under the Edit or Format menus.

[Mod][Flash] Universal Bootanimation Flash Update.zip - Sense|AOSP|Sprint|HTC|Verizon

Hello World.
Tommy here. This time I have a nifty little trick for you guys.
This took a little creative thinking but I think I got it pretty good. I was chatting with some Team Ramen Noodles guys and someone asked how an AOSP botanimaiton zip can be flashed on a Sense ROM. This was the lightbulb moment
Instructions for dev:
Download from link below.
Place the file "bootanimation.zip" inside the update.zip. I put a placeholder so you would know where to replace it.
Optionally, you can put a sound "android_audio.mp3". If you don't want it, then just leave it out. Not necessary.
When you open it up, you will see two place holder files, "bootanimaion.zip__HERE" and "android_audo.mp3__HERE". You can delete them if you want, but they don't do anything. Just for reference.
Files must be named "bootanimation.zip" and "android_audio.zip", otherwise won't work.
The script "tt_uni_boot" looks for the animation and sound in the rom, and replaces it depending on what it finds.
This works on AOSP, Sense, Sprint, HTC, and Verizion
The update.zip below is what you should use as your base if you want to make your bootanimation universal for all roms.
Also, if anyone wants to flash it as is, it contains this lovely animation:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Original Thread Here
Universal Bootanimation update.zip v0.0.1 - January 08, 2012
Enjoy!
Please report feedback. I and dean_fx tested it before I posted, but if you want different feature or something like that let me know.
Tommy
edit1.
And in case anyone wants to adapt my script, I am more than happy to share. Just give a little credit
Sharing means caring. And collaborative efforts yield better results.
Code:
#!/system/bin/bash
#tommytomatoe
#universal animation flasher
# creating logfile "lockscreen" on sdcard
log=sdcard/bootanimation.log
touch $log
# mounting system as R/W
busybox mount -o remount,rw /system
echo "/system mounted as R/W" > $log
echo "" >> $log
# doing some checks
# bootanimation locatioon
if busybox [ -e /system/customize/resource/bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/bootanimation.zip
elif busybox [ -e /data/local/bootanimation.zip ]; then
BOOT_ANI=/data/local/bootanimation.zip
elif busybox [ -e /system/media/bootanimation.zip ]; then
BOOT_ANI=/system/media/bootanimation.zip
elif busybox [ -e /system/customize/resource/spc_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/spc_bootanimation.zip
elif busybox [ -e /data/local/spc_bootanimation.zip ]; then
BOOT_ANI=/data/local/spc_bootanimation.zip
elif busybox [ -e /system/media/spc_bootanimation.zip ]; then
BOOT_ANI=/system/media/spc_bootanimation.zip
elif busybox [ -e /system/customize/resource/VZW_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/VZW_bootanimation.zip
elif busybox [ -e /data/local/VZW_bootanimation.zip ]; then
BOOT_ANI=/data/local/VZW_bootanimation.zip
elif busybox [ -e /system/media/VZW_bootanimation.zip ]; then
BOOT_ANI=/system/media/VZW_bootanimation.zip
elif busybox [ -e /system/customize/resource/hTC_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/hTC_bootanimation.zip
elif busybox [ -e /data/local/hTC_bootanimation.zip ]; then
BOOT_ANI=/data/local/hTC_bootanimation.zip
elif busybox [ -e /system/media/hTC_bootanimation.zip ]; then
BOOT_ANI=/system/media/hTC_bootanimation.zip
else
echo "Bootanimation does not exist" >> $log
exit 1
fi
# bootanimation sound location
if busybox [ -e /system/customize/resource/android_media.mp3 ]; then
BOOT_SOUND=/system/customize/resource/android_media.mp3
elif busybox [ -e /data/local/android_media.mp3 ]; then
BOOT_SOUND=/data/local/android_media.mp3
elif busybox [ -e /system/media/android_media.mp3 ]; then
BOOT_SOUND=/system/media/android_media.mp3
elif busybox [ -e /system/customize/resource/android_audio.mp3 ]; then
BOOT_SOUND=/system/customize/resource/android_audio.mp3
elif busybox [ -e /data/local/android_audio.mp3 ]; then
BOOT_SOUND=/data/local/android_audio.mp3
elif busybox [ -e /system/media/android_audio.mp3 ]; then
BOOT_SOUND=/system/media/android_audio.mp3
elif busybox [ -e /system/customize/resource/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/system/customize/resource/SPC_animation_final.mp3
elif busybox [ -e /data/local/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/data/local/SPC_animation_final.mp3
elif busybox [ -e /system/media/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/system/media/SPC_animation_final.mp3
else
echo "Bootanimation sound does not exist" >> $log
fi
echo "$BOOT_ANI" >> $log
echo "$BOOT_SOUND" >> $log
echo "" >> $log
# moving animation
busybox mv -f /data/local/tmp/bootanimation.zip $BOOT_ANI
if busybox [ -e /data/local/tmp/bootanimation.zip ] ; then
buxybox rm -f /data/local/tmp/bootanimation.zip
fi
if busybox [ -e $BOOT_ANI ] ; then
echo "SUCCESS! Bootanimation moved to $BOOT_ANI" >> $log
else
echo "FAILURE! Bootanimation not moved to $BOOT_ANI" >> $log
fi
echo "" >> $log
# moving busybox mv -f /data/local/tmp/bootanimation.zip $BOOT_ANI
busybox mv -f /data/local/tmp/android_audio.mp3 $BOOT_SOUND
if busybox [ -e /data/local/tmp/android_audio.mp3 ] ; then
buxybox rm -f /data/local/tmp/android_audio.mp3
fi
if busybox [ -e $BOOT_SOUND ] ; then
echo "SUCCESS! Bootanimation sound moved to $BOOT_SOUND" >> $log
else
echo "FAILURE! Bootanimation sound moved to $BOOT_SOUND" >> $log
fi
echo "" >> #log
echo "Universal Bootanimation Flasher Commencing" >> $log
Nice one Tommy.
Edit. got the error tried couple ways going into, will check back soon.
Edit2. smooth sailing...
Tekn010933 said:
Nice one Tommy.
Edit. got the error tried couple ways going into, will check back soon.
Click to expand...
Click to collapse
Fixed!
I always type https instead of http out of habbit
Thanks Tommy, I've downloaded it and stored it in my vault..haha...NEVER know when this might come in handy!!
Thanks for sharing with us!
KIOWA69 said:
Thanks for sharing with us!
Click to expand...
Click to collapse
My pleasure! It was a fun one to do.
Sent from my PC36100 using Tapatalk
tommytomatoe said:
Hello World.
Tommy here. This time I have a nifty little trick for you guys.
This took a little creative thinking but I think I got it pretty good. I was chatting with some Team Ramen Noodles guys and someone asked how an AOSP botanimaiton zip can be flashed on a Sense ROM. This was the lightbulb moment
Instructions for dev:
Download from link below.
Place the file "bootanimation.zip" inside the update.zip. I put a placeholder so you would know where to replace it.
Optionally, you can put a sound "android_audio.mp3". If you don't want it, then just leave it out. Not necessary.
When you open it up, you will see two place holder files, "bootanimaion.zip__HERE" and "android_audo.mp3__HERE". You can delete them if you want, but they don't do anything. Just for reference.
Files must be named "bootanimation.zip" and "android_audio.zip", otherwise won't work.
The script "tt_uni_boot" looks for the animation and sound in the rom, and replaces it depending on what it finds.
This works on AOSP, Sense, Sprint, HTC, and Verizion
The update.zip below is what you should use as your base if you want to make your bootanimation universal for all roms.
Also, if anyone wants to flash it as is, it contains this lovely animation:
Original Thread Here
Universal Bootanimation update.zip v0.0.1 - January 08, 2012
Enjoy!
Please report feedback. I and dean_fx tested it before I posted, but if you want different feature or something like that let me know.
Tommy
edit1.
And in case anyone wants to adapt my script, I am more than happy to share. Just give a little credit
Sharing means caring. And collaborative efforts yield better results.
Code:
#!/system/bin/bash
#tommytomatoe
#universal animation flasher
# creating logfile "lockscreen" on sdcard
log=sdcard/bootanimation.log
touch $log
# mounting system as R/W
busybox mount -o remount,rw /system
echo "/system mounted as R/W" > $log
echo "" >> $log
# doing some checks
# bootanimation locatioon
if busybox [ -e /system/customize/resource/bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/bootanimation.zip
elif busybox [ -e /data/local/bootanimation.zip ]; then
BOOT_ANI=/data/local/bootanimation.zip
elif busybox [ -e /system/media/bootanimation.zip ]; then
BOOT_ANI=/system/media/bootanimation.zip
elif busybox [ -e /system/customize/resource/spc_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/spc_bootanimation.zip
elif busybox [ -e /data/local/spc_bootanimation.zip ]; then
BOOT_ANI=/data/local/spc_bootanimation.zip
elif busybox [ -e /system/media/spc_bootanimation.zip ]; then
BOOT_ANI=/system/media/spc_bootanimation.zip
elif busybox [ -e /system/customize/resource/VZW_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/VZW_bootanimation.zip
elif busybox [ -e /data/local/VZW_bootanimation.zip ]; then
BOOT_ANI=/data/local/VZW_bootanimation.zip
elif busybox [ -e /system/media/VZW_bootanimation.zip ]; then
BOOT_ANI=/system/media/VZW_bootanimation.zip
elif busybox [ -e /system/customize/resource/hTC_bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/hTC_bootanimation.zip
elif busybox [ -e /data/local/hTC_bootanimation.zip ]; then
BOOT_ANI=/data/local/hTC_bootanimation.zip
elif busybox [ -e /system/media/hTC_bootanimation.zip ]; then
BOOT_ANI=/system/media/hTC_bootanimation.zip
else
echo "Bootanimation does not exist" >> $log
exit 1
fi
# bootanimation sound location
if busybox [ -e /system/customize/resource/android_media.mp3 ]; then
BOOT_SOUND=/system/customize/resource/android_media.mp3
elif busybox [ -e /data/local/android_media.mp3 ]; then
BOOT_SOUND=/data/local/android_media.mp3
elif busybox [ -e /system/media/android_media.mp3 ]; then
BOOT_SOUND=/system/media/android_media.mp3
elif busybox [ -e /system/customize/resource/android_audio.mp3 ]; then
BOOT_SOUND=/system/customize/resource/android_audio.mp3
elif busybox [ -e /data/local/android_audio.mp3 ]; then
BOOT_SOUND=/data/local/android_audio.mp3
elif busybox [ -e /system/media/android_audio.mp3 ]; then
BOOT_SOUND=/system/media/android_audio.mp3
elif busybox [ -e /system/customize/resource/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/system/customize/resource/SPC_animation_final.mp3
elif busybox [ -e /data/local/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/data/local/SPC_animation_final.mp3
elif busybox [ -e /system/media/SPC_animation_final.mp3 ]; then
BOOT_SOUND=/system/media/SPC_animation_final.mp3
else
echo "Bootanimation sound does not exist" >> $log
fi
echo "$BOOT_ANI" >> $log
echo "$BOOT_SOUND" >> $log
echo "" >> $log
# moving animation
busybox mv -f /data/local/tmp/bootanimation.zip $BOOT_ANI
if busybox [ -e /data/local/tmp/bootanimation.zip ] ; then
buxybox rm -f /data/local/tmp/bootanimation.zip
fi
if busybox [ -e $BOOT_ANI ] ; then
echo "SUCCESS! Bootanimation moved to $BOOT_ANI" >> $log
else
echo "FAILURE! Bootanimation not moved to $BOOT_ANI" >> $log
fi
echo "" >> $log
# moving busybox mv -f /data/local/tmp/bootanimation.zip $BOOT_ANI
busybox mv -f /data/local/tmp/android_audio.mp3 $BOOT_SOUND
if busybox [ -e /data/local/tmp/android_audio.mp3 ] ; then
buxybox rm -f /data/local/tmp/android_audio.mp3
fi
if busybox [ -e $BOOT_SOUND ] ; then
echo "SUCCESS! Bootanimation sound moved to $BOOT_SOUND" >> $log
else
echo "FAILURE! Bootanimation sound moved to $BOOT_SOUND" >> $log
fi
echo "" >> #log
echo "Universal Bootanimation Flasher Commencing" >> $log
Click to expand...
Click to collapse
I do something a little different, I take the file.from aosp, its named bootanimation.zip, rename it to spc_bootanimation.zip and place it in system/cutomize/resource. Using root explorer. I reboot, and.it works. I use the ics animation on my on my swag rom.
Sent from my PC36100 using xda premium
davidstjohn1 said:
I do something a little different, I take the file.from aosp, its named bootanimation.zip, rename it to spc_bootanimation.zip and place it in system/cutomize/resource. Using root explorer. I reboot, and.it works. I use the ics animation on my on my swag rom.
Sent from my PC36100 using xda premium
Click to expand...
Click to collapse
Yep. That is the tradition method. But now the maker of the bootanimation just needs to post one zip that works on all roms. How handy
Sent from my PC36100 using Tapatalk
If I ever post another boot animation, you better believe I'm using this! Would save a ton of random "where does this go?" questions..
Sent from my PC36100 using xda premium
This looks familiar. Hmmmmm. Lol.
Great work Tommy!
Sent from my RamenizedEvo on Cricket.
tommytomatoe said:
Yep. That is the tradition method. But now the maker of the bootanimation just needs to post one zip that works on all roms. How handy
Sent from my PC36100 using Tapatalk
Click to expand...
Click to collapse
Tommy,
You are thanked x2.
You're as busy as a cat covering up sh*t.
I've been trying to quantify your knowledge and sum it up in a few words. I finally figured it out. You, my friend, are an "idea man". Your knowledge keeps expanding because of the unique ideas you formulate when you are challenged with each new endeavor. Yet, it goes beyond just that. You have the generosity to share your ideas and solutions with the community, which encourages others to participate. The kindness and respect that you show to all members of this community is refreshing and much appreciated. Thank you for all your contributions.
Mark
First off, great concept!
However, looking through the bash script i noticed what appear to be a few bugs.
1: some typos in the comments and echoed text.
2: you check for an existing sound and set it to BOOT_SOUND but if not found the script continues without BOOT_SOUND initialised to anything.
3: you typed "buxybox" instead of "busybox" in two locations (durring the move process)
4: when replacing the animation you move the new file to BOOT_ANI, then check for and delete the temp file. Then you check if BOOT_ANI exists and report success or failure. The problem as written is that BOOT_ANI always exists, regardless if the move operation succeeded. Same problem for the sound.
I'm working on a fix for these issues and will post it later today, after i have a chance to test it.
-SLS-
SouL Shadow said:
First off, great concept!
However, looking through the bash script i noticed what appear to be a few bugs.
1: some typos in the comments and echoed text.
2: you check for an existing sound and set it to BOOT_SOUND but if not found the script continues without BOOT_SOUND initialised to anything.
3: you typed "buxybox" instead of "busybox" in two locations (durring the move process)
4: when replacing the animation you move the new file to BOOT_ANI, then check for and delete the temp file. Then you check if BOOT_ANI exists and report success or failure. The problem as written is that BOOT_ANI always exists, regardless if the move operation succeeded. Same problem for the sound.
I'm working on a fix for these issues and will post it later today, after i have a chance to test it.
-SLS-
Click to expand...
Click to collapse
Thanks for those notes I caught most of these errors directly after I made posted. But this was just a fun idea I had to help out someone.
1. Yep. lol. locatioon isn't a word.
2. Good point. Bad logic on my part. But the script works regardless. If there is no "BOOt_SOUND" then there will be nothing to move and so the script will just error out during this part. No big deal since there isn't a sound anyways...but it should be fixed regardless.
3. buxybox is also not a word. lol. This was my first typo I noticed after putting the script up. I didn't bother to go in and fix it because the command is actually redundant. In the busybox mv -f command, the file is moved from the original location. No need to "busybox rm" it, or in my case "buxybox"
4. I actually didn't think about this. I wrote the script with intent to put any bootanimation where it belongs. I put the logs in there just for testing purposes and didn't consider that the animation/sound would exist regardless of failure.
Feel free to improve the script at your convenience! That is why I posted it so other users can improve.
While these errors should be fixed, the script still works as intended Only detail oriented people will notice.
I already have an updated version prepared but I will wait for your version. I will post it up
Just got home and about to begin working on this. just wanted to note that the check for a BOOT_SOUND is important in the case where a user doesn't currently have sound and is flashing one that does include a sound. In that scenario they would end up with only the new animation and no sound.
I think i have a solution to choose a default location when no sound is currently present. Will test and report back.
-SLS-
ok, after a little work, some testing, and many many delays, my update to your original script:
http://www.soulshadow.net/android/tt_uni_boot
a few things to note:
- i left the first line unchanged, however to work on my evo running CM 7.1 i had to change the path to /system/xbin/bash. *** Also works using /system/bin/sh ***
- I added more logging
- I added more conditional checks and changed the execution order. can now be used to replace an animation, a sound, or both. depending which files are included in the zip.
- Added a "default" location if no existing animation or sound is found.
- Currently only supports single phone distribution. Meaning, each phone model still requires a different animation zip file because of display size differences. hopefully this limitation can be eliminated with planned run time discovery, creating a truly universal script.
To Do:
- check and possibly reorder the animation and sound search order.
- find out which location should be used as a default
- check permissions on installed files
- run time discovery of phone specs (manufacturer, model, rom) to aid in installation choices.
- remove or back up existing files first
- read command line arguments to change run time functionality and allow for usage from within an app
I am currently working on some of the additional features, but wanted to share what i have so far.
Enjoy!
-SLS-
SouL Shadow said:
ok, after a little work, some testing, and many many delays, my update to your original script:
http://www.soulshadow.net/android/tt_uni_boot
a few things to note:
- i left the first line unchanged, however to work on my evo running CM 7.1 i had to change the path to /system/xbin/bash. *** Also works using /system/bin/sh ***
- I added more logging
- I added more conditional checks and changed the execution order. can now be used to replace an animation, a sound, or both. depending which files are included in the zip.
- Added a "default" location if no existing animation or sound is found.
- Currently only supports single phone distribution. Meaning, each phone model still requires a different animation zip file because of display size differences. hopefully this limitation can be eliminated with planned run time discovery, creating a truly universal script.
To Do:
- check and possibly reorder the animation and sound search order.
- find out which location should be used as a default
- check permissions on installed files
- run time discovery of phone specs (manufacturer, model, rom) to aid in installation choices.
- remove or back up existing files first
- read command line arguments to change run time functionality and allow for usage from within an app
I am currently working on some of the additional features, but wanted to share what i have so far.
Enjoy!
-SLS-
Click to expand...
Click to collapse
Thanks man! Glad someone took this script and adding to it. Thank you!
Sent from my PC36100 using Tapatalk
Dead links
canievision said:
Dead links
Click to expand...
Click to collapse
Ive been meaning to re-upload. Will do in a few days.
Sent from my EVO using Tapatalk 2
Hey can i get that flashable zip? the links seem to be dead
imilleson said:
Hey can i get that flashable zip? the links seem to be dead
Click to expand...
Click to collapse
I would like this also

[Q] Ice Cream Sandwich problem on JXD S5100 console

Hello folks,
ive bought this cheap android based console like 1 year ago for my son to play android games on it. In last few weeks ive figured that many apps are lost due some reason and i can see them with 0 kb in applications list. Ive bought new SD card from Kingston to test it with but still the same issue. After moving application to SD card with A2SD III, application disapears from console and from SD card. After several days spent on google ive found possible fix but im not able to apply it since i dont have in system file where this fix can be applied. I hope somebody can help me to locate or advice what file should be possibly modified. If you have any ideas, feel free to post them (except those to throw that crap out of window)
https://github.com/nadlabak/android...mmit/e5b9b3195687e04af7a7929f8637e77e1efae9a1
Thanks alot for any helpful comments.
Aiki
Please, some Android guru help me out with this
I presume noone has any single idea?
Aikimaniac said:
Hello folks,
ive bought this cheap android based console like 1 year ago for my son to play android games on it. In last few weeks ive figured that many apps are lost due some reason and i can see them with 0 kb in applications list. Ive bought new SD card from Kingston to test it with but still the same issue. After moving application to SD card with A2SD III, application disapears from console and from SD card. After several days spent on google ive found possible fix but im not able to apply it since i dont have in system file where this fix can be applied. I hope somebody can help me to locate or advice what file should be possibly modified. If you have any ideas, feel free to post them (except those to throw that crap out of window)
https://github.com/nadlabak/android...mmit/e5b9b3195687e04af7a7929f8637e77e1efae9a1
Thanks alot for any helpful comments.
Aiki
Click to expand...
Click to collapse
Format you're mem card (in your console itself ) then factory reset it....
Sent from my K-Touch W719 using XDA Premium 4 mobile app
shreygadikar said:
Format you're mem card (in your console itself ) then factory reset it....
Sent from my K-Touch W719 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
didnt help..im still looking for the file where i can set that parameter to avoid that services start before mounting of SD card is finished..
i think the problem is the "A2SD III". take another one like my script and test.
mildwild said:
i think the problem is the "A2SD III". take another one like my script and test.
Click to expand...
Click to collapse
have been out of country for some days..will test this asap and let you know...weird is that i removed SD card and installed game from market and it happened even without app was moved to SD card..i just lost it...looks like the ROM from factory is pretty messed up as well.. will let you know how this went..thanks alot
Not sure where to place this script..or if its necessary to modify some other already existing script... btw..this the original ROM if anyone experienced is willing to check it.. http://www.jxd.hk/download.asp?id=1152&selectclassid=020001 for what i would be very grateful :fingers-crossed:
Please gurus...help me out with this issue...here is the script and i have no idea where to put it... thanks in advance
Code:
#!/system/bin/sh
#
# Apps2SD using symlinks and bind mounts
# Original Apps2SD script by [email protected] (cyanogen)
# Fixed for slow detection of SD cards by _thalamus and output a bit more debugging info so we can see where problems are arising.
# execute any postinstall script then kill it
enablea2sd () {
# mount and set perms
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /sd-ext;
busybox chown 1000:1000 /sd-ext;
busybox chmod 771 /sd-ext;
# clean up any old symlinks, create data directories
for i in data;
do
if [ -h /data/$i ];
then
rm /data/$i;
fi;
if [ ! -d /data/$i ];
then
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
# don't allow /data/data on sd because of upgrade issues - move it if possible
if [ -d /sd-ext/data ];
then
busybox cp -a /sd-ext/data/* /data/data/;
busybox rm -rf /sd-ext/data;
fi;
# move apps from internal memory to sdcard
for i in app app-private dalvik-cache;
do
if [ ! -d /sd-ext/$i ];
then
mkdir /sd-ext/$i;
fi
busybox chown 1000:1000 /sd-ext/$i;
busybox chmod 771 /sd-ext/$i
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox cp -a /data/$i/* /sd-ext/$i/;
busybox rm -f /data/$i/*;
fi;
done;
# symlink app dirs - they must be on the same filesystem
for i in app app-private dalvik-cache;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox rm -rf /data/$i;
busybox ln -s /sd-ext/$i /data/$i;
fi;
done;
# clean up old whiteouts
for i in local misc property system tombstones data;
do
if [ -h /sd-ext/$i ]; then rm -f /sd-ext/$i; fi
done;
# please don't put odex files in the app directory people!
# it causes dexopt to crash when switching builds!
busybox rm -f /sd-ext/app/*.odex
echo "+++ Apps-to-SD successfully enabled";
}
disablea2sd() { # replace symlinks with directories so we can boot without sd
for i in app app-private dalvik-cache;
do
if [ -h /data/$i ];
then
rm -f /data/$i;
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
}
if [ -e /dev/block/mmcblk0p1 ]; # We check for the presence of the FAT partition first to see if the SD has initialised.
then
echo "SD Card has been initialised...checking for ext partition.";
if [ -e /dev/block/mmcblk0p2 ]; # If false, it isn't there so we don't have to sleep the script and delay the boot.
then
enablea2sd;
else
echo "No ext partition present, apps2sd disabled";
disablea2sd;
fi;
else
sleep 4; #Enables time for a slow SD to be detected and populate the device nodes.
if [ -e /dev/block/mmcblk0p2 ];
then
echo "enablea2sd for slow SD card";
enablea2sd;
else
echo "No ext partition present after sleep, apps2sd disabled";
disablea2sd;
fi;
fi;
sync;

Categories

Resources