yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] prash:
Its nothing drastic as that. Most android forums are removing procedures and posts which detail in any way shape or form allow for piracy to happen. I see it this way: those smart enough and have done enough reading about files should already know what to do. Posting it on a forum would open it up for mass amount of piracy, I believe the forums are in their right to be able to remove such posts so they do not get in any sort of legal issues. Of course this does not deter the issue all together but keeps them out of legal trouble if in case it should ever pop up.

We can argue for hours about 'backups' here but I believe it would be fruitless, like I said, those who read enough will figure it out on their own. No need to make a post which could be taken as promoting piracy.
[G1 Android Development] beagz:
The history is now a separate db file in the database folder. I will see if deleting is safe and update the command
[G1 Android Development] shaneaus:
I have seen several posts since the beginning have portions removed that provided script that showed how to copy the app-private file to the fat32 partition - to protect against copying paid apps. I haven't seen anything removed about copying the app file as they are not copy-protected.

But, I think much is left to the individual moderators. If this moderator didn't realize that the app file contains non-copyrighted apps than... Maybe, that was why it was included.

But, like stated in the above post. If you can't figure out how to do that after reading/understanding most of the data on this forum........ :confused:
[G1 Android Development] beagz:
Best I found is :

rm /data/data/com.android.browser/databases/browser.db

But it also erases your bookmarks
[G1 Android Development] dumfuq:
I use this to toggle /system rw/ro

#remount.sh
#!/system/bin/sh

TMP=`cat "/proc/mounts" | grep "mtdblock3" | grep " rw "`;

if [ -z "$TMP" ];
then
echo "Mounting filesystem rw...";
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system;
else
echo "Mounting filesystem ro...";
mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system;
fi;

Do any scripting gurus know how to check the filesystem writability more elegantly?
[G1 Android Development] Z҉A҉L҉G҉O̚̕̚:
To see how much memory and swap you have.

free

Shortest script ever. :)
[G1 Android Development] nickf123654:
GScript for Meltus Audio Mod / LucidREM script

I am using Meltus' Audio Mod and applying it each time I re-flash my firmware using LucidREM's method in the terminal emulator. This works great and because I already have the audio files in a folder on my SD card, all I have to do is type the following into the terminal:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

su

mount -o rw,remount /dev/block/mtdblock3 /system

cd /sdcard/tmp

busybox cp AudioFilter.csv /system/etc

busybox cp AudioPara_TMUS.csv /system/etc

busybox cp AudioPara4.csv /system/etc

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and then reboot my phone.

It works but is not the most convenient thing to do every time I flash my firmware.

I was trying to make this into a script that could be run from GScript to make it even easier to apply each time I re-flash my firmware. Unfortunately, I am in the early stages of learning unix/linux and not 100% confident in creating my own script. Could someone help guide me in creating this script?

In GScript, could I just do the following?(w/ su):

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

mount -o rw,remount /dev/block/mtdblock3 /system

cd /sdcard/tmp

cp *.csv /system/etc

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It doesn't seem to be working correctly. I have tried the wildcard *.csv and also listing each one individually but I don't think it is copying the files from the /sdcard/tmp directory to the /system/etc directory.

What am I doing wrong here?
[G1 Android Development] bestwebs:
Hi,

I've been toying with a couple of scripts.

I would like to add a line to reboot the phone at the end of the script.

Can some one tell me how to do this?

I tried reboot and that doesn't work.

Thanks

:)
[G1 Android Development] dumfuq:
reboot works for me...maybe you don't have symlinks set up on busybox.

try

busybox reboot
[G1 Android Development] Franklees:
possible bluetooth on a JACHero ROM

I have a question or suggestion to put froward. A little wile back someone posted that they could get bluetooth working on a JACHero ROM. He did not write a script for it (quote below). Could someone write a script with that command and create a shortcut or 2 on the desktop (one for enable and one for disable). If I am mistaken or obviously do not know what I am talking about, there is no need to flame me, just tell me the idea was cute and I should run along and go play outside.
[G1 Android Development] the.snks:
Updated script for my cache cleaners:

Also, there's a 'cache' directory in the root of the filesystem. It contains download.apk, download1.apk and a few other files. I wanted to include that in this script.

Can anyone confirm if that's safe to delete?
[G1 Android Development] purg:
Thanks for this one... great idea

Couldnt you use something like -w to check if a directory is writable on a ffilesystem thats read only or not?

if [ -w /root/ ]
[G1 Android Development] dumfuq:
Pretty sure -w just looks at file permissions not how the drive is mounted.
[G1 Android Development] DirectMatrix:
wait for keystroke

I would imagine that this would fall under the category of linux commands but I figured someone here may know....

Does anyone know how to tell a script running in gscript to wait for an input from the user? (a trackball or home button depress for example)

I have been playing around with the "read" command in terminal but can't seem to get it to work and there is also the fact that I have no idea if this is even possible.

I have several scripts that I run to erase data before I do a restore of the similar data and I have occasionally hit the wrong script in Gscript whereby executing the script and making it too late for my data. However, an input from the user (me) would allow me to realize that I am in the wrong script and cancel it. Any ideas???

This is what I have been reading to see if there was anything there to help me out. Keep in mind that I am just starting to learn basic Linux so be gentle if you respond :)

http://www.linuxquestions.org/quest...ript-wait-for-key-press-to-proceed...-687491/

and this:

http://www.unix.com/shell-programming-scripting/28899-script-not-waiting-user-responce.html
[G1 Android Development] xidominicanoix:
Try asking cyanogen, since he uses this method in his recovery image :D
[G1 Android Development] DirectMatrix:
Thanks, I'll give Cyanogen a shot but I'm sure he has much better things to do than answer what I can only imagine is a very simplistic question
[G1 Android Development] RichieDaze:
Ask him, he'll answer you. Don't forget to post. :D
[G1 Android Development] balazer:
Thanks for this app.

Here is my feature wish list:

* option to keep a notification icon in the status bar while a script continues to run

* ability to check back in on a running script and see its console output

* ability to scroll up to see older output
[G1 Android Development] free-sidux:
thx alot, snks! very helpful
[G1 Android Development] prscott1:
Hey, you can get a great example here on xda - search for the latest switchrom.sh - it prompts you for a response (i.e., which rom to recover from).
[G1 Android Development] etiennepb:
wrong thread
[G1 Android Development] ThR1LL:
Is it ok if I just delete the whole cache folder for gmail and browser?
[G1 Android Development] the.snks:
Should be. I think they will just be recreated the next the app is opened.
[G1 Android Development] cx92001:
This is a good one. Thanks.
[G1 Android Development] cx92001:
Use this:

cp -u /system/intmem/data/com.wktmngr/MyWorkout /sdcard/workoutmanager

---

cp -u means copy only if the source file is newer than the destination file or the destination file does not exist.
[G1 Android Development] miketaylor00:
This script will delete the akmd and rild files to temporarily fix the annoying issue with the auto-rotate screwing up. It has to be run from recovery. Can anyone tell me how to make the script reboot into recovery, open the console and then execute these commands? I saw the post at the beginning of the thread that would run an update, but I don't know how to go to the console. Thanks.

#mount the data partition and move to the /misc directory
mount /data
cd /data/misc/

echo "Contents of /data/misc/"
echo `ls /data/misc/`

#Delete the rild and akmd files
rm -r akmd*
rm -r rild*

echo "Contents of /data/misc/ after delete"
echo `ls /data/misc/`
[G1 Android Development] IConrad01:
Has anyone compared GScript to Android Scripting Environment?
[G1 Android Development] SteveTilsed:
Hi all,

I'm having some real trouble running scripts. After some tinkering i finally thought i had it and the script did what i asked it too.

Here is the code

I then reflashed the theme to put it to the test and i'm getting the following,

Error:

Why is this happening?

SU is ticked? Any ideas?
[G1 Android Development] ThR1LL:
Did you ever figure out how to get this to work with GScript bc it looks like a good thing save :)
[G1 Android Development] miketaylor00:
Not yet, you have to manually reboot into recovery and run it there. It works really well I just don't know how to automate it. I'm hoping someone on here can help me out.
[G1 Android Development] RichieDaze:
Hey Steve,

Try using a lower case m for mount...LOL
[G1 Android Development] SteveTilsed:
Thanks! Such a n00b :o
[G1 Android Development] essayou:
Do you need root access to run a script?

I want to run a script like the changing wireless settings

am start -a android.intent.action.MAIN -n com.android.settings/com.android.settings.Settings

sleep 1

input keyevent 20

input keyevent 23

when running the script it only opens the settings page but the keyevent dont happen does have to do with root access or something else?

And is het possible to run a script file through adb instead of executing one line at a time?
[G1 Android Development] icetomyst:
deleted (sorry posted in the wrong topic...no idea, dont post at 5am)

but while we're here @essayou, you need root to run that, yes.
[G1 Android Development] Argusi:
I'm not really sure why that doesn't work, but here's my take on it. I keep my .csv files in /sdcard/audio. The killall I saw in Meltus' thread as an alternative to rebooting.

mount -o rw,remount /dev/block/mtdblock3 /system
cp /sdcard/audio/*.csv /system/etc
mount -o ro,remount /dev/block/mtdblock3 /system
killall mediaserver
[G1 Android Development] dumfuq:
restart launcher

I use this one to restart the launcher. It does need root.

#!/system/bin/sh

killall android.process.acore
[G1 Android Development] bmfc187:
I tried to make a script to start Debian, and it opened it up in the Gscript terminal instead of in terminal emulator, and it wouldnt allow me to do anything but sit there and look at it. then when i hit the close button at the bottom, it left debian running in the background, then the phone rebooted. So is there any way to make gscript open debian in the terminal emulator? or do i just have to type it out everytime? Thanks...

-BMFC
[G1 Android Development] dumfuq:
I cant answer your question directly and there might be an easier way of doin it but...

You can use "am" to start any android application from a terminal (or gscript).

This should be able to launch your favorite terminal emulator with your debian script as the argument from within gscript.

This URL can explain how to use "am" to launch an app.

http://learnandroid.blogspot.com/2008/01/run-android-application-from-command.html
[G1 Android Development] bmfc187:
Thanks, dumfuq!

-BMFC
[G1 Android Development] prscott1:
You do need root - but here is a script I use that goes straight to wifi settings, toggles it and back to home:

am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings
sleep 1

#toggle wifi
input keyevent 20
input keyevent 23

input keyevent 3

Also - here is one for bluetooth:

am start -a android.intent.action.MAIN -n com.android.settings/.bluetooth.BluetoothSettings
sleep 1

#toggle bluetooth
input keyevent 20
input keyevent 23

input keyevent 3
[G1 Android Development] Proxin:
So I am trying to make a script to do Meltus's volume hack.

cp /sdcard/AudioFilter.csv /system/etc
cp /sdcard/AudioPara4.csv /system/etc
cp /sdcard/AudioPreProcess.csv /system/etc

When I try it out, I get stderr's saying that it can't create the /system/etc files because they already exist.

Now, I'm fairly certain it's supposed to overwrite the files without prompt, as stated here:

http://www.comptechdoc.org/os/linux/usersguide/linux_ugbasics.html

But it won't do that for some reason. What can I do to get it working? I know I could just remove the default ones before doing it but I'd like to figure this out so I can know for other projects.

Edit: Had to mount /system as read/write ;) in case anyone else had the same problem.
[G1 Android Development] dumfuq:
Have you tried explicitly declaring the filenames?

cp /sdcard/AudioFilter.csv /system/etc/AudioFilter.csv
cp /sdcard/AudioPara4.csv /system/etc/AudioPara4.csv
cp /sdcard/AudioPreProcess.csv /system/etc/AudioPreProcess.csv
[G1 Android Development] xidominicanoix:
try with -r

cp -r /sdcard/Audio* /system/etc/
[G1 Android Development] dumfuq:
This could be dangerous to anyone with a sdcard/Audio* folder with mp3's or whatnot.

Recursive isn't needed anyway so...

cp /sdcard/Audio* /system/etc/

Should work and fail on directories

Personally I use `cp /sdcard/v7/* /system/etc`

I think that proxin's original problem was that he/she forgot to mount the filesystem rw.
[G1 Android Development] miketaylor00:
Fix for auto-rotate not working

I can't figure out a way to make the phone reboot and continue running a script in the recovery console but I think I have found a way to fix the auto-rotate problem without a reboot. Unfortunately I can't get auto-rotate to break on my phone. If anyone has the issue, please test this out for me.

echo ""
echo "Contents of /data/misc/"
echo `ls /data/misc/`

#Kill the processes using the akmd and rild files
#then delete the file
killall -9 rild
rm -r /data/misc/rild*
killall -9 akmd
rm -r /data/misc/akmd*

echo ""
echo "Contents of /data/misc/ after delete"
echo `ls /data/misc/`
[G1 Android Development] speoples20:
Is there a way to use gscript to clear your compcache? That way when my phone starts to lag I can clear out the compcache and make it run smooth again.
[G1 Android Development] jinx10000:
Try

swapoff /dev/ramzswap0

swapon /dev/ramzswap0
[G1 Android Development] Proxin:
Yes, that was indeed my problem. I edited the post since realizing that.

And yes, I am indeed a he :p

Will that only work if you have done the whole procedure of allocating special space on your SD card for use with RAM?

Pardon my ignorance, but I'd love to be able to clear a cache on-the-go. It's just I don't know if I have the cache set up correctly or not - I never did the swap procedure because I don't want to kill my SD card.
[G1 Android Development] speoples20:
I'll try that. thanks
[G1 Android Development] jinx10000:
I think it will only turn off then turn on existing compcache setup. However, I do not think compcache would have any impact on your sd card. I do not remember who to thank for this code at this point.

Turns off and on (resets) existing compcache setup.

swapoff /dev/ramzswap0

swapon /dev/ramzswap0

Turns off and on (resets) existing linux swap setup.

swapoff /dev/block/mmcblk0p3

swapon /dev/block/mmcblk0p3
[G1 Android Development] BrooklynAvi:
There is an error in the compcache reset code. The "block" portion was left out. It should read:

swapoff /dev/block/ramzswap0
swapon /dev/block/ramzswap0
[G1 Android Development] cx92001:
Does anybody know a script to backup email setup? Thanks
[G1 Android Development] shaneaus:
10-15-09 * Update * I realized that the restore files did not restore the market data base as well. I added that code into them.

I created this script which copies all of the apps installed on the phone, your market data (so, market won't show your having to re-install all of your apps), as well as, all of the data and dalvik-cache data files on the phone. It stores all of the apps/data/market data on the SDCard.

This script copies ALL of the data in the appropriate files - then deletes the files associated with the stock apps. So, if you change your ROM this WILL NOT EFFECT your stock apps - only your installed apps.

You need to create the following files on your SDcard (or change the script as needed to the file structure you wish to use):

/sdcard/backupdata//backupdata/market_assets_data

/sdcard/backupdata/backupappdata/app

/sdcard/backupdata/backupappdata/app-private

/sdcard/backupdata/backupappdata/data

/sdcard/backupdata/backupappdata/dalvik-cache

The first script clears out the data in the above created folders, then copies the data from the system files into the above created SDCArd files. The second one puts the apps/data back into your system (without dalvik-cache - use this most of the time to restore). The last one includes the dalvik-cache - I would only use this if you re-installed the same ROM).

This will keep all of your settings/data from your programs. I have used these scripts several times. K-9Mail/ToggleSettings/Sweeterhome/Archipelago/Xgalaxy/ChompSMS/etc. all retained their settings.

Instructions: download the files, change the ".txt" to ".sh," and place in your gscript folder on your sdcard.

Ready to go!

After installing a new Rom, I now just install Gscript, run the restore script, and use My Backup to restore my data.

edit (11-12-09): added the files from the system/sd folders to the saved files. I left them out in the previous version so not all files were being copied if one used A2SD. This is corrected in the updated file.

***The only change I am considering at this point is to change the restore script from using "-fr" to "-u".... So, if anyone has any thoughts on that let me know (via PM - as I don't check up on this thread all the time.) If anyone checks the scripts out and finds a file I included in the remove list that shouldn't be included or knows of one that should be added to the remove list - please let me know and I'll update the script on this post.***
[G1 Android Development] overground:
Thanks for this. I do this sometimes manually, but it is really time consuming removing the system apps and whatnot. What would also be cool is a cross reference between installed apps and corresponding data to remove data items for apps no longer installed. TwistedUmbrella started a thread on this topic and said to accept any TOS popups an app might have before restoring data. I don't know if that's necessary though. Thanks again.
[G1 Android Development] shaneaus:
I forgot to mention - when you use the copy all apps/data script it first deletes all the data in those files on your SDCard prior to copying the current data. In this way you don't re-install the older app/data you previously had - you only install the app/data from your last copy.

I try to run the copy script before I do anything with my ROMS - that way I know the data in the backupdata file is the latest.

The reason I the file structure /sdcard/backupdata/backupappdata/ is: I have two files in the backupdata folder to backup all of my apps/private apps (in case I should ever want to revert to an older program). So, I have another script that uses the "-u" option to save the latest app/private app data from the backupappdata files into the ones in the backupdata file.... Did that make sense? LOL Should I update an app and it not work properly I can just install the previous version from the backupdata file.
[G1 Android Development] shaneaus:
I didn't remember seeing TwistedUmbrella's thread.

My approach was pretty simple. I used a program to print out all of the files in the data and dalvik-cache files. I noted which files appeared to be specific to stock apps/programs/android.

I then wrote the script to copy everything in those files, then delete the ones I had flagged above. This way all apps/private/data/dalvik-cache files are captured - then the flagged files are removed.

That way after you install a new ROM only the non-system/stock apps are restored.

I have only had one error running the script - for a game's data/dalvik-cache files that wouldn't copy (super-Gstunt). Might have been because I hadn't played it so there were no files to copy.

I had an old script that didn't remove all the old files prior to copying the new ones! LOL! That was a mess having all those old apps I didn't want anymore. That was why I changed it to clear out the old data prior to copying the new.
[G1 Android Development] Frogzilla:
thanks - i have already benefited from this post

you mentioned that you learned this new - where does one to go and learn the deepest most inner most secrets of Android? i spend time on xda and github, anywhere else?
[G1 Android Development] overground:
Here is the link to that thread: http://xdaforums.com/showthread.php?t=527997

I'll PM it to you also. Don't know if there's any relevant info in there, but it's interesting nonetheless.
[G1 Android Development] Proxin:
This didn't work for me to restore from Cyanogen 4.1.11.1 to 4.1.999. I am sincerely hoping there is a way to restore so I can get updates again.
[G1 Android Development] prash:
Did you reboot? Or just use atrackdog for updates, and go down the atrackdog apps list and do 'install from market' on each app, you'll manually get to rebuild your app database, easy as that.
[G1 Android Development] Proxin:
I did reboot.

Tried killing the task and manually pushing my backup folder, didn't work either.

That is true, I wish I could just get it working to automatically restore it. I'd really not prefer to manually go through ~110 apps and reinstall them. :/
[G1 Android Development] shaneaus:
@Proxin - Try my scripts in the post above. It clears out the old files in the folders I instruct to create. Then saves your market data, apps, app data, and dalivk-cache.

After installing your new ROM run the restore file to restore your market data, apps, and app data. If the ROM is the SAME version as the old one (a re-install) then you can use the file that also restores the dalvik-cache.

This will NOT save any of your stock Google apps/app data.

But, if you do want that info saved you just go into the scripts and delete the appropriate code lines (not that hard if you know the basic commands).
[G1 Android Development] Proxin:
Actually I just gave up and went through aTrackDog manually to get updates :p

Thank you for this though, I will look back here if I encounter the problem again.
[G1 Android Development] smasraum:
Is there a way to enable wifi using a script. I'm running Cyanogen 4.2.3.1. Anytime I reboot, I have to change the permissions of the wpa_supplicant.conf file, and enable wifi. I've got the script for the permissions, but it would be great if I couuld have that script enable the wifi too.

I did a search and didn't see anything.

Thanks
[G1 Android Development] xidominicanoix:
you could make a script using keyevents
[G1 Android Development] mobilepgk:
text to notification bar

[edit: deleted. posted twice]
[G1 Android Development] mobilepgk:
posting text to notification bar

is there way to post text to notification bar from shell script directly?

For sure we can write a app to post notification and this app can be invoked from shell. But I am looking at any snappier solution!

btw, I see /system/bin/notify but not sure what it does.
[G1 Android Development] Technochris1:
Is it possible to change the begging of this script to open market and install an app.

Ive been playing around with it , but i dont think i have the intent right...
[G1 Android Development] clubber2k:
Wow, I was thinking about that a while ago, so simple and yet so vial..

thanks
[G1 Android Development] Macrophage001:
Forget it :D
[G1 Android Development] Macrophage001:
Why dont you make a sh directory in the system folder? maybe that will work?