Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

GScript * Easily launch/save shell scripts from within Android UI * - Useful scripts

OP rogro82

3rd March 2009, 09:02 PM   |  #1  
rogro82's Avatar
OP Senior Recognized Developer
Thanks Meter: 440
 
862 posts
Join Date:Joined: May 2008
Donate to Me
More
As some of you might have seen or even used, I have created an application that allows executing of shell scripts from within Android and it will even allow you to create a direct shortcut on your homescreen to a script ( for example to start Debian or reboot your phone ).

I know a lot of developers ( I also didnt at first ) don't look in the "applications and games" section, but i thought it was the best place to post the actual application.

I will keep updating that post with the actual application process/updates, but ive created this thread to see if people ( I think most of the actual linux experienced people are in this section ) would like to share their linux knowledge to other peoples uploading useful .sh files ( for backing up stuff etc etc ), so that less experienced can just load them in to my application, without risking all typos.

So if you have a nice script that is useful please upload it so we can all benefit from it.

The actual application can be found here:
http://forum.xda-developers.com/showthread.php?t=486486

Please dont ask question or place suggestions about the application in this thread, but use the one Ive created for the actual development and keep this thread for scripts only.

Regards,

Rob
Last edited by rogro82; 3rd March 2009 at 09:13 PM.
5th March 2009, 10:21 PM   |  #2  
Member
Thanks Meter: 3
 
97 posts
Join Date:Joined: Jan 2009
I was thinking about starting a thread just like this one-- for everyone to post up their scripts. Don't know why I didn't. Anyway, I asked the question awhile back how to create a script for remounting the file system as read/write, which led to my discovery of GScript. In any case, here's what I was told to use:

Quote:

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

Be advised that I have no idea if this actually works or not. Perhaps someone could test and post the results?
Last edited by the.snks; 5th March 2009 at 10:22 PM. Reason: clarity
6th March 2009, 03:53 AM   |  #3  
Gary13579's Avatar
Retired Moderator
Thanks Meter: 61
 
521 posts
Join Date:Joined: Nov 2008
More
Quote:
Originally Posted by tubaking182

that takes to long, i find it easier when i am using the comp to just click my terminal(which is almost always up and running) and type reboot_phone(i have a script on the computer that contains the comand adb shell reboot) and also another for rebooting into recovery and one more for bootloader

i guess i'm lazy but if i can find a way to automate anything i do in life i go ahead and do it. i have a script for nearly everything i do to my phone.

on a more on-topic note, i was hoping someone would post the command to reboot and apply an update.zip, i know it is in the JF autoupdater, but i just want to be able to hit a shortcut on my home screen to apply themes as well.

Code:
su
echo "boot-recovery
--update_package=/sdcard/update.zip" > /cache/recovery/command
reboot recovery
Untested, you might have to play around with the /sdcard/update.zip to get it to load properly, I'm not sure exactly how you put the path in there. This will, for sure, reboot it into recovery mode, and tries to automatically apply an update.zip.

Edit:
--update_package=sdcard:update.zip

Should do it. I hope.
6th March 2009, 06:01 PM   |  #4  
benmyers2941's Avatar
Senior Member
Flag Phoenix, AZ
Thanks Meter: 8
 
363 posts
Join Date:Joined: Oct 2007
More
Here's a script I built to make a rom into the "lite" version needed by many of the themes. It's not much but it's my first one.

Code:
mount -o rw,remount -t yaffs2, /dev/block/mtdblock /system
rm -r /system/media/audio/ringtones
rm -r /system/media/audio/notifications
reboot
Attached Files
File Type: zip Make Lite.zip - [Click for QR Code] (215 Bytes, 463 views)
6th March 2009, 08:45 PM   |  #5  
benmyers2941's Avatar
Senior Member
Flag Phoenix, AZ
Thanks Meter: 8
 
363 posts
Join Date:Joined: Oct 2007
More
Quote:
Originally Posted by Gary13579

Code:
su
echo "boot-recovery
--update_package=/sdcard/update.zip" > /cache/recovery/command
reboot recovery
Untested, you might have to play around with the /sdcard/update.zip to get it to load properly, I'm not sure exactly how you put the path in there. This will, for sure, reboot it into recovery mode, and tries to automatically apply an update.zip.

Edit:
--update_package=sdcard:update.zip

Should do it. I hope.

You don't need the "su" at the beginning. Gscript has a checkbox to indicate if SU is needed and will add it on it's own. Putting it in causes the script to hang.
18th March 2009, 07:03 PM   |  #6  
Senior Member
Thanks Meter: 17
 
443 posts
Join Date:Joined: Oct 2006
More
Anyway to make it close the script window when the script completes? Right now I have it doing an app backup and echoing DONE. But I'd like to automate the process if possible.

Exit doesn't seem to work.
18th March 2009, 07:15 PM   |  #7  
Senior Member
Flag Chicago
Thanks Meter: 9
 
179 posts
Join Date:Joined: Jun 2008
More
Quote:
Originally Posted by Gary13579

Code:
su
echo "boot-recovery
--update_package=/sdcard/update.zip" > /cache/recovery/command
reboot recovery
Untested, you might have to play around with the /sdcard/update.zip to get it to load properly, I'm not sure exactly how you put the path in there. This will, for sure, reboot it into recovery mode, and tries to automatically apply an update.zip.

Edit:
--update_package=sdcard:update.zip

Should do it. I hope.

It does reboot into recovery mode but I get the error "Can't mount /sdcard/Update.zip Installation aborted."

I'm able to just apply the update by pressing Alt+S but would be nice if it was all automated.
18th March 2009, 07:45 PM   |  #8  
beagz's Avatar
Senior Member
Flag Greenacres, FL
Thanks Meter: 23
 
1,056 posts
Join Date:Joined: Jan 2009
More
Quote:
Originally Posted by wpbcubsfan

It does reboot into recovery mode but I get the error "Can't mount /sdcard/Update.zip Installation aborted."

I'm able to just apply the update by pressing Alt+S but would be nice if it was all automated.

Same result for me.
18th March 2009, 09:53 PM   |  #9  
beagz's Avatar
Senior Member
Flag Greenacres, FL
Thanks Meter: 23
 
1,056 posts
Join Date:Joined: Jan 2009
More
Got it!!!
ok!

used this as script to change theme

cp /sdcard/themes/aero/update.zip /sdcard/
echo "boot-recovery
--update_package=SDCARD:update.zip" > /cache/recovery/command
reboot recovery


Needed to use caps for SDCARD!!!

found it poking around the recovery.c file

better still no need to copy over update.zip in root Just in case of emergency.
Code:
echo "boot-recovery
--update_package=SDCARD:themes/aero/update.zip" > /cache/recovery/command
reboot recovery
Last edited by beagz; 18th March 2009 at 09:58 PM. Reason: shortcut:
18th March 2009, 10:19 PM   |  #10  
Senior Member
Flag Chicago
Thanks Meter: 9
 
179 posts
Join Date:Joined: Jun 2008
More
Quote:
Originally Posted by beagz

ok!

used this as script to change theme

cp /sdcard/themes/aero/update.zip /sdcard/
echo "boot-recovery
--update_package=SDCARD:update.zip" > /cache/recovery/command
reboot recovery


Needed to use caps for SDCARD!!!

found it poking around the recovery.c file

better still no need to copy over update.zip in root Just in case of emergency.

Code:
echo "boot-recovery
--update_package=SDCARD:themes/aero/update.zip" > /cache/recovery/command
reboot recovery

Dude, you rock! Thanks!

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes