[Q][Solved]How to run Terminal command at startup? - Desire HD Q&A, Help & Troubleshooting

Hi,
I search a way to run some terminal command at startup so that i can apply persistant tweak to the internal memory manager. ( how to here)
Is there an apps or something to do to achieve this?
Solved :
theboostman said:
I finaly found how to do the job. We can run script at boot even with Su permissions!
Using tasker to launch script at device boot.(I wanted to be able to set it directly in android like in windows anyway)
how to launch the script at boot :
Prerequisite (available in market):
- Tasker by Crafty Apps
- Locale Execute Plugin by Michael Mauch (no need for the main locale apps)
Create a "loadable" script:
Use script file in UNIX format with no extension in the name and use a key like "on" in your script to be able to start the script on tasker, if not it will not work.
I use NotePad ++ to create my script starting from a . txt and select Edit , EOL Conversion, Unix Format. Then save as "filename.txt" and rename to delete ".txt".
Copy the script on your sdcard (see samples in .zip attached)
In tasker, Create a new profile and select |System| , |Device Boot|.
Then select |New task| and |Add an action| , |Plugin| , |Execute|.
Then |Edit| and tip @! sh /sdcard/filename key
For example for file name "bofstask" that contain a script tweaking internal memory manager settings and vdd level of kamma's 1.4 kernel.
The script run when the key "on" is used, so tip @! sh /sdcard/bofstask on
Done.
Mod: Do you think this thread has to be moved on a more "developement" thread since it allow to run basic developpement script?
Click to expand...
Click to collapse

I've search a bit and found how to create the script than can be run to apply the settings I want but i still don't find where to put this file on the android system so that it will run at each boot...
It was very easy to do this in windows, I'm sure there is a way to do it in android!
please skilled guys point me to the right thread...

Run script at boot with SU permissions!
I finaly found how to do the job. We can run script at boot even with Su permissions!
Using tasker to launch script at device boot.(I wanted to be able to set it directly in android like in windows anyway)
how to launch the script at boot :
Prerequisite (available in market):
- Tasker by Crafty Apps
- Locale Execute Plugin by Michael Mauch (no need for the main locale apps)
Create a "loadable" script:
Use script file in UNIX format with no extension in the name and use a key like "on" in your script to be able to start the script on tasker, if not it will not work.
I use NotePad ++ to create my script starting from a . txt and select Edit , EOL Conversion, Unix Format. Then save as "filename.txt" and rename to delete ".txt".
Copy the script on your sdcard (see samples in .zip attached)
In tasker, Create a new profile and select |System| , |Device Boot|.
Then select |New task| and |Add an action| , |Plugin| , |Execute|.
Then |Edit| and tip @! sh /sdcard/filename key
For example for file name "bofstask" that contain a script tweaking internal memory manager settings and vdd level of kamma's 1.4 kernel.
The script run when the key "on" is used, so tip @! sh /sdcard/bofstask on
Done.
Mod: Do you think this thread has to be moved on a more "developement" thread since it allow to run basic developpement script?
Edit: Maybe should I just create a new thread and keep this one as it is...??

Ended up using SManager from the play store - working great!

most roms for dhd i have used also support init.d scripts. all you have to do is to put your script with no file extension in /system/etc/init.d folder and that is it

Related

[MOD] Change Glass-Lockscreen to Android with a script

Hello!
So, some guys tested my bat-script and they reported that it works! So i create a new thread..
All you need is a java installation (i think jdk, becuase you need the jar binary) and adb! You have to edit the bat file and
set the 2 variables to the directory.
The other variables (sed, smali, baksmali, dexopt-wrapper) are in the package, so you shouldnt change it.
If anything necessary is not found, the script will not start!!
Attention: If you run the bat file, be sure your mobile is NOT IN STANDBY!! You have to be in normal mode (not recovery or sth) and the screen turned on!
So not in lockscreen/standby mode, because otherwhise SuperUser does not popup and ask for root-rights.
When you dont allow root-rights you will see a permission error during the script and this is bad (it will ask you 2-3 times for root rights).
I made this script, so everyone can look at the commands (not hiding inside an exe file which could do anything).
Here is the link: http://rapidshare.com/files/420586328/install_lockscreen.zip
Windows verion needs to be on rapidshare/filehoster, because i have put the sed binary + dll into it (you need it for windows and autopatching the .smali file)
Just download the bat script and edit it with an editor (notepad++ or jedit or just notepad) and set the ADB variable to adb.exe and JAVA_DIR to the JDK-directory (not including \bin - just the main-directory).
Tested successfully on my JM5 and some other user with JM8 and someone with JH2!
4 things todo (not for running the script, just for the future ):
1. create script for linux/mac os usage (shouldnt be so hard, but i have not so much time currently..)
2. auto-create an update.zip with the original android.policy.odex/.jar file for errors (because you cannot change this file if the phone cannot boot - su segmentation fault)
3. if /system/xbin/dd is not here or if it is missing the "conv=notrunc" option, the script should abort
4. create a version for deodexed mobiles/firmwares.
I dont have a clue, how to create an update.zip, so if anyone of you could give me a little help, i would be very happy
And i dont have a deodexed mobile, so someone should tell me the difference, so i can make a different script or the script should autodetect it.
Big thanx to Ateisti for found this solution: http://forum.xda-developers.com/showthread.php?t=779803
If you like my work you can buy me a beer (but you dont have to ): Beer via paypal
menu button fix included or not?
When someone would tell me what this is, then i can insert it in the script
Ateisti talk about it at the end of the first post of his thread
Found it
- By default, the menu button will also unlock the screen. To disable this behavior, you have to modify /res/values-hdpi-v4/bools.xml in /system/framework/framework-res.apk, and change the value of <bool name="config_disableMenuKeyInLockScreen">false</bool> to true. Can also be done by modifying code.
But, i have disabled WidgetLocker and just the AndroidLockscreen now..
I can hit so many times i want the menu button, the lockscreen will never be released..
I have JM5 (2.1). Maybe this is there different?
I will make on the weekend a linux version of the script and then i will also enable this feature..
thE_29 said:
When someone would tell me what this is, then i can insert it in the script
Click to expand...
Click to collapse
There is also a way to do this from the android.policy smali files. I did it on my UGJH2.
go into "android.policy\com\android\internal\policy\impl\LockScreen.smali"...
Do a search for "return v4" and change it to "return v6" (this should be within the method ".method private shouldEnableMenuKey()Z", closer to the ".end method" line.)
To add it to your script, have it change this at the same time as the other file you edit and bingo, no more menu button unlock....
didn't work here.
thank god you made a backup folder
JHJP8, not de-odexed.

[KERNEL MODULE][HOWTO] Open Files Directly from Windows Share

What you need
Cifs kernel module. Download from http://www.mediafire.com/?uhdo6h2z5fbtz4w
Rooted SGY, with ROM/kernel/apk that support running init.d script
CifsManager from Google Play
Know how to share folder and open shared folder in windows
Step
Put cifs-signed.zip in your sdcard (don't put inside folder)
Turn-off your SGY, enter to recovery mode (vol up+home+power). Select "apply update from sdcard", then select "cifs-signed.zip". Wait few second until you see message "Completed." and reboot your phone.
Install CifsManager
In CifsManager add new share with fields
Share Path : your windows share with format <ip>/<shared folder>, ex: 192.168.0.1/Music
Mount Point : path in your SGY where windows share will be appear, ex: /mnt/sdcard/WinMusic
Username : windows user name. If your share don't need password, just leave it default (guest).
Password : windows user password
Tap your share CifsManager to mount your share.
If success, browse using your file manager to your mount point and open your files without copy.
Tips
Only use in wi-fi connection and make sure your wi-fi sleep policy is "Never" (open in "Setting>wireless and networks>Wi-Fi settings" tap menu button and select "Advanced" and open Wi-Fi sleep policy and select "Never")
If your mount point on SDCARD, unmount your share from CifsManager before connected your SGY to pc usb as use storage
CifsManager need rooted phone. If your ROM/kernel not support init.d you still can used it with call init.d script manually.
Run from your terminal emulator/adb shell/ssh
Code:
su
/etc/init.d/90cifs
You only need run it once after your SGY booting. Using Script Manager maybe work but i am not testing yet.
I compile and write patch for kernel module by myself. You can share my post on your blog or other forums but please, don't re-upload file in download link. I just need to see how much people download my work. Thank you.
Kernel patch will be upload after i clean up.
Another work from you after patch and dualboot kernel.
Must try this one.
Thanks bro.
-Just Farmer and Newbie Android-
Testing now,will report back in the morning.
Lol so old thread
yes i m Flasholic
a new masterwork/info :good:. thanx

[XAP] Any application launcher

There is simple, but usefull tool, able to launch any application, script, or other shell directive, by own tile icon tapping.
Using:
1. Rename UniLaunch7.xap to YourOwnName.zip
2. Edit zipped WMAppManifest.xml file:
- replace all occurences of string "UniLaunch7" by "YourOwnName"
- replace line "\Windows\calc7.exe" by your wanted exe, batch, or Mortscript full filepath (see my other threads about console and Mortscript).
3. If you want, replace ApplicationIcon.png by your own icon picture.
4. Repack zip and rename YourOwnName.zip to YourOwnName.xap
5. Deploy it to device
Notes:
Using batch with LaunUri.exe calling you can simply make any "undocumented" system CPL shortcut as internet sharing (LaunchUri app://5B04B775-356B-4AA0-AAF8-6491FFEA5629/_default), GPS enabling (LaunchUri app://5b04b775-356b-4aa0-aaf8-6491ffea5642/_default) etc. Examples are in attached zip (enable scripting first by HaRET Console 7 or another batch interpreter enabling tool e.g. PocketCMD7 registered to batch as cmd /C CALL "%1"
).
Using batch with registry changing you can make simply native installator or profile changer. For example simple scripts RingingOffVibrateOn.bat, RingingOffVibrateOff.bat and RingingOnVibrateOn.bat is tiled in my device.
You can see differences between UniLaunch7.xap and KeyboardCPL.xap (unzip booth) to understand tutorial. First one launches Calcullator, second launches Keyboard CLP.
I will prepare authomatical on-device launchers creator, probably as feature of Phone Commander.
More information on the benefits and advantages.
Or do explained in video

Getting a syntax error when trying to load a script

Hi. I just finished installing CyanogenMod 11 on my Galaxy Nexus. I also put the DirtyV-SR kernel on as well. Everything seems to be working fine. I then learned about a custom edit of the DirtyV kernel by Nephilim that seems to be popular. I have no idea how to change the settings manually though. Luckily in the DirtyV post there is a link to a script by the user "buscher" that supposedly does the changes for you. I followed the instructions and put the script in the System/etc/init.d folder, removed the .txt extension on the script, and changed it's permission settings (I think I changed the permissions correctly). I'm using an app called SManager to do this BTW. When I try to launch the script I get a syntax error. Here is a screen shot of said error...
i.imgur. com/ b5jAVe3. jpg
(Added spaces so I could post the link)
Link to DirtyV thread: http://forum.xda-developers.com/galaxy-nexus/development/kernel-dirtyv-t2613655
Link to buscher's post with the script: http://forum.xda-developers.com/gal...nel-dirtyv-t2613655/post50202995#post50202995
Does anyone have any idea what im doing wrong? Or perhapsna different way to use Nephilims version of DirtyV?
Thx
I've never used any of the scripts you're talking about, but normally that syntax error means that there's a coding error in the script file that the interpreter doesn't know how to handle. I looked at the script in that thread and I can't see anything that would jump out as being problematic, so there's a chance something may have happened when you downloaded the script or copied it to the device.
I'd say you should try downloading the script again directly on your device, and make sure you're clicking the "Download" button on the Mediafire page with the script instead of doing a "save link as" or anything similar from the forum thread. You may even want to open it up in a text editor app and compare it to the version online to make sure that the file matches.
Alright so I redownloaded it and got it to run this time. My problem now is that it seems some of the required directories for the script don't exist on my phone for some reason.
Here's a new screenshot of the errors
http:// i.imgur. com /mjBjQ88. jpg (again had to add spaces)
It's probably safe to ignore those errors, they probably come from that script being older than the latest kernel version you're running it against. Basically, Linux kernels create a whole bunch of files and folders in /sys that control certain kernel settings. By writing a value to specific files, you can change those settings. Those two errors are the result of the script trying to change two settings files that don't exist anymore, possibly because they were removed in a newer version of the kernel. The rest of the script should run without problems and make the rest of the changes.
just wanted to say, there is no need for script manager to run that script.
remove the .txt
put it in /etc/init.d folder/dir
set all perms(i.e rwxrwxrwx)
then just reboot
it will automatically run and set everything in the script when the device boots.
also
if you want to set those things from nephilim thread, use the app called trickster mod(or Synapse, though trickster might be less overwhelming for someone new to setting these things)
enjoy
any questions feel free to ask

[REVIEW] V6 Supercharger on Galaxy Y

Hi all,
I'd like to share my experience with V6 SuperCharger script by zeppelinrox [V6U9RC13] on my Galaxy Y
For those who wonder what V6 SuperCharger is I'd say it's a very long shell script (about 11.000 lines of code) that aims to optimize some system parameters and system/apps files in order to boost the phone performance.
Official thread of V6 SuperCharger is here along with the official downloads:
http://forum.xda-developers.com/showthread.php?t=991276
To execute the V6 SuperCharger main script any terminal emulator is suitable, but it's advised to install and use SManager app, available at Google Play store.
So, here is how my story begin.
I ran the script but the SManager paired with the Galaxy Y small screen, doesn't make it quick to go through all the Driver Options without having to tediously use the super small full keyboard, and having hard time to hit the proper keys.
I'm used to use the numeric pad, bigger buttons, but unfortunately on SManager numeric pad only can input number, not letters, and V6 SuperCharger doesn't usually accept numbers as answers to the many options.
So I decided to make a "quick" modification to the script on-the-fly, seeking all the 11 thousands lines for the options answers like y, Y, n, N, a, A etc... and adding a 1, 2, 3,4 at convenience.
After that, going through the Driver Options has been as nice as a breeze, using only the numeric pad to answer to all the options
Good right? no, not much...
Somehow the script didn't work at all... the Driver options were set but the boot script were not made, and all the main menu options were actually inactive....
Well... I thought it was a problem with my own phone configuration but I finally found out, after many hours of debugging, that zeppelinrox had hidden in the code a check that automatically and silently disable almost all the script functions if the script is been modified in a way that there are more o less lines than the original script.
Ok, found the problem, fixed, now everything run properly...
The scripts makes and installs its boot scripts and the tweaks are applied at everyboot... fine!
I then tried the zipalign function.
Zipaligning the apps packages (apk files) provide quicker access to their contents by system and apps... sounds good... isn't it?
Well... the 1st run of the Zipaligning wasn't a good one.... the script found something like 8 thousands apk files to check for zip alignment... and that was very weird as I don't have more than 200 apk in my phone.
Plus the process to check and eventually zipalign each apk was dramatically slow... something like 8-10 seconds per package (that is about 20 hours needed to process 8000 apk ).
Something was wrong somewhere... and I found it!
In the script the command used to find all the APKs doesn't work properly on the Galaxy Y stock rom... problably because of some simlinks that makes like a loop between folders.
Anyway the problem has been recognized too by another developer, Black Dog http://forum.xda-developers.com/showthread.php?p=42884332 , who actually fixed it in upd9 RC12, but the latest V6 script, upd9 RC13, from zeppelinrox, unfortunately didn't kept the "fix"... so, after I stumble on the issue, I had to find the source of the problem and make the fix myself
I just actually found the command used by Black Dog script to seek the APK and copied to the latest RC13 script by zeppelinrox.
Fine... let's try the Zipaligning again...
Ahh... this time the script found 187 apk to check for zipalignment... sounds nice.
But hey!... still processing each apk takes many seconds... and seems that ALL the apks aren't zipaligned... is that possibile?
No, something was wrong again.
And more I was sure it was wrong because repeating the zipalignment didn't report any of the previous zipaligned apk as already aligned, but instead, they were processed and zipaligned again
I then tried the zipalign command manually on terminal to check it's behaviour on any of the supposed not aligned apk.
Weird enough... the zipalign executable, that I installed with the SuperCharger_Starter_Kit_RC12.zip provided by zeppelinrox in it's official download page http://forum.xda-developers.com/showpost.php?p=18703418&postcount=5021 , when executed it simply didn't do anything... just few seconds of "nothing" and then... nothing!
No output of any kind in the terminal screen.
I then got a zipalign executable from another package (Adrenaline Engine, or Universal v.3.1... very same executable there) and copied to my phone and tried and this time... yeah... that's it! I got output!
Code:
# zipalign
Zip alignment utility
Usage: zipalign [-f] [-v] <align> infile.zip outfile.zip
zipalign -c [-v] <align> infile.zip
#
Tried again the so called "Wheel Alignment" (the zipalign task) and this time, finally, everything worked as supposed.
Found 187 APKs, 10 were not aligned and so they been aligned.
Repeated the process... 187 APKs found, 0 not aligned
I guess that the zipalign executable provided in SuperCharger_Starter_Kit_RC12.zip is been compiled to run on KitKat 4.4 and somehow it broken the backward compatibility with earlier version of Android like the one running on Galaxy Y (GingerBread 2.3.6).
Hope that sharing my own experience in here will help someone :angel:
Hi, so it is better to use RC12Fix over RC13 because of the zipalign function? Should I downgrade from 13 to 12Fix?
Fix align, Wheel align, and Fix emmisions on RC13 always has error on my galaxy y. But I am 100% supercharge.
If Im staying at Rc13, I have to manually zipalign my apks? and fix permission on cwm right? For it to work..
When I try the zipalign command. Nothing happens.
#zipalign
(wait for 5 seconds then goes back nothing)
#
Hi Klmiciano,
yes, the Wheel alignment (ZipAlin APKs), Fix emissions (Fix Force Close Errors) and Fix Alignment (which is just the execution in sequence of both Wheel alignment and Fix emissions) options are not involved with the system parameters optimization done by the script to achieve the "supercharge", so no wonder you still can get 100% supercharged.
Actually the "Fix emissions" option is just a set of commands that automatically scan all the system and try to fix any files and folder permissions (write, read, modify permissions) inconsistency.
Fixing of permission is an utility task provided also by other common apps, like, for example, "Nandroid Manager", which in my opinion everyone should have it installed along with "Online Nandroid Backup", obviously for backup purpose.
Fixing permissions (called Fix Emission in Supercharge) isn't really a task that has to be done on a regular schedule; it is a "fix", so it's meant to be executed when there's a problem (an app that keeps Force Closeing, after an update, or backup restore).
ZipAligning too isn't much important. Almost all apps available are already Zipaligned and even if you might have one app not aligned among one hundreds Apps installed, that won't problably affect your phone performances in a way that can be recognized also because is only the App that comes with a "not aligned" APK file that is affected, not the whole system.
Anyway, if you like to have the Wheel Alignment to run properly you need to replace the zipalign executable (which is located in /system/xbin/zipalign ); using RC12Fix won't work either because the issue is caused by the Zipalign executable version installed with the SuperCharger_Starter_Kit_RC12.zip provided by zeppelinrox in it's official download page.
It's not a script issue, it's a zipalign executable issue.
So, if you care to have Wheel Alignment to run properly you need to replace the /system/xbin/zipalign with zipalign executable from another package (Adrenaline Engine, or Universal v.3.1... very same executable there).

Categories

Resources