Need help writing script - Android Q&A, Help & Troubleshooting

Greetings,
I have these commands I run from cmd :
Code:
adb shell settings put secure qs_tile_row 2
adb shell settings put secure qs_tile_column 5
adb shell settings put secure sysui_qqs_count 5
The thing is, that these do not survive a reboot, so I wanted to create a script that would run the shell commands on boot.
I created a file in init.d but I can't get a hold of the syntax to put these exact 3 commands.
Any help is appreciated.

Related

remove icon

is there a way to remove icons from the start menu? i have a custom rom (modaco and there are a few apps i cant remove i was wondering if i can just remove ther icon? thanks!
I presume you are trying to remove apps that are installed on the system partition. (ie. most of the standard HTC apps).
If so, you can do so from your PC, but follow these instructions in case you remove something you shouldn't (!)
1. Take a Nandroid Backup before starting
2. Connect phone to your PC and set up ADB from the SDK if not already done.
3. Run command
Code:
adb remount
4. Type
Code:
adb shell
5. Type
Code:
su
6. Type
Code:
cd /system/app
7. Type
Code:
ls
8. Now have a look through the list for what you want to remove. Be aware that low-level things like the dialer are listed here, so be careful
9. When you find the app you want to uninstall, type the commands
Code:
exit
adb pull com.name.of.apk.file.apk C:\HTCHeroBackupApps
to copy the apk file to your PC in case you want to put it back
10. Then type
Code:
adb shell
cd /system/app
rm com.name.of.apk.file.apk
11. Application removed. Repeat for other apps you want rid of. Reboot phone when done.
(11.) If you need to restore an app in future for any reason, use the following command:
Code:
adb remount
adb push C:\HTCHeroBackupApps\com.name.of.apk.file.apk /system/app
and reboot the phone.
HTH, and don't go deleting things if you don't know what they are

[REQ] /system/bin/sh clockwork recovery

I just did a major mistake by copying sh from Windows to /system/bin/sh. Not haivng the execute bit has stopped me from using adb shell.
Could someone provide a clockworkmod recovery file that restores sh & it's permissions? I would greatly appreciate it. Thanks!
Why not just run the fix permissions script from the advanced menu in clockworkmod?
Sent from my SCH-I500 using XDA App
well, would be easier from a linux box:
chmod 755 sh
adb push sh /system/bin/sh
adb reboot
i_am_enderst said:
well, would be easier from a linux box:
chmod 755 sh
adb push sh /system/bin/sh
adb reboot
Click to expand...
Click to collapse
Thanks. I fixed it through recovery mode shell via adb.
I'm getting the following garbage when I do ls within adb shell. Is there any way to fix this?
Code:
# ls
ls
←[1;34mcache←[0m ←[1;32minit.rc←[0m ←[1;34msbin←[0m
←[1;34mconfig←[0m ←[1;32minit.smdkc110.rc←[0m ←[1;34msdcard←[0m
←[1;34mdata←[0m ←[1;32minit.smdkc110.sh←[0m ←[1;34msqlite_stmt_journals←[0m
←[1;34mdbdata←[0m ←[1;34mlib←[0m ←[1;34msys←[0m
←[1;32mdefault.prop←[0m ←[1;32mlpm.rc←[0m ←[1;34msystem←[0m
←[1;34mdev←[0m ←[1;34mmnt←[0m ←[1;32msystem.prop←[0m
←[1;34mefs←[0m ←[1;34mpreinstall←[0m ←[1;34mtmp←[0m
←[1;36metc←[0m ←[1;34mproc←[0m ←[1;34muserdata←[0m
←[1;32mfota.rc←[0m ←[1;32mrecovery.rc←[0m
←[1;36minit←[0m ←[1;34mres←[0m
Those are bash color escape codes but I don't know why adb is outputting them since I'm new to Android.
It's a windows command prompt thing..
Easiest solution, do this from your adb shell (you'll need to do it each time)
export LS_COLORS=none
alternatively you can installed cygwin and spend a little time setting it up so that the ANSI colors are displayed when using adb shell.
I assume the colors show up fine under linux, which is why this got included in some kernels/rom packages without anyone addressing it.
Thanks for the info. It shows up correctly through a cygwin terminal. I'll just use that for now on.

adb shell and terminal emulator

i gotta question. is adb shell and terminal emulator the same thing? and am i right getting into adb shell with the CMD from windows when having my phone via usb connected in debugging mode? and can someone tell me where i can get a list of commands?
thx
X10mini miniCM7 2.0 using XDA Premium App
freebordjunky said:
i gotta question. is adb shell and terminal emulator the same thing? and am i right getting into adb shell with the CMD from windows when having my phone via usb connected in debugging mode? and can someone tell me where i can get a list of commands?
thx
X10mini miniCM7 2.0 using XDA Premium App
Click to expand...
Click to collapse
adb shell and Terminal Emulator are not the same thing. One is an shell environment (adb shell) and the other is a tool to access that environment (Terminal Emulator).
adb shell is native to the phone and allows for Linux shell access. Terminal emulator will allow you to run adb shell ON the phone directly to access that shell environment.
Secondly, yes you are correct, in that you can use the Command Prompt (CMD) to access adb shell. Also, your phone must be in debugging mode as you stated.
To get a list of commands -- you type: adb, while in the androidsdk\tools folder and it'll display the default set of commands available to you.
Though, the most common commands you'll run are as follows:
adb shell -- Gives you shell access, best used with root access
adb remount -- Mounts the phone for r/w (read-write) access; this
needs to be done if you plan to run the next two commands, but only once.
adb push -- Push's/Move's a file to the specified dir, usually system/app
adb pull -- Copies a file from a specified dir, usually system/app
adb shell reboot -- Reboots your phone from the command line
Hope that helps.
thank you very much
X10mini miniCM7 2.0 using XDA Premium App
Sure, no problem.
pseudoremora said:
Sure, no problem.
Click to expand...
Click to collapse
Hi there, Im new to TE and ADB as well.
1) From what it looks like why would you ever use ADB if you didnt need to exchange files with the computer?
TE seems a lot easier to use without having to install the sdk, different exes etc.
2) I've also stumbled upon the ADBD insecure by chainfire, from what I've gathered, this app gives you root access to stock kernels that otherwise wouldn't have given you that. and saves you from typing long command lines.
But what lines is it saving you from typing? Just "su"?
Adb pull or push DOES NOT work with Terminal Emulator as they are not found as commands. What to do to use them with unrooted phone?
pseudoremora said:
adb shell and Terminal Emulator are not the same thing. One is an shell environment (adb shell) and the other is a tool to access that environment (Terminal Emulator).
adb shell is native to the phone and allows for Linux shell access. Terminal emulator will allow you to run adb shell ON the phone directly to access that shell environment.
Secondly, yes you are correct, in that you can use the Command Prompt (CMD) to access adb shell. Also, your phone must be in debugging mode as you stated.
To get a list of commands -- you type: adb, while in the androidsdk\tools folder and it'll display the default set of commands available to you.
Though, the most common commands you'll run are as follows:
adb shell -- Gives you shell access, best used with root access
adb remount -- Mounts the phone for r/w (read-write) access; this
needs to be done if you plan to run the next two commands, but only once.
adb push -- Push's/Move's a file to the specified dir, usually system/app
adb pull -- Copies a file from a specified dir, usually system/app
adb shell reboot -- Reboots your phone from the command line
Hope that helps.
Click to expand...
Click to collapse
I tried the following from powershell, on windows:
Code:
.\adb.exe shell cmd overlay enable com.android.internal.systemui.navbar.gestural
and it worked.
I tried the same from the terminal emulator, and it said
cmd: service not found: overlay
Click to expand...
Click to collapse
Why is it that it works one way, and not the other way? Aren't they interacting with the same shell enviromnent? Is there a permission difference?

[Tutorial] x10mini Linux helpers

Hello
Like some other guys i use linux on my PC. If you want to change your x10mini via shell you can do it but its not very confortable.
I made a few tools so it's easier to use.
Note: This "tricks" are only usefol to you if you are a little advanced with linux and want to "work" with your x10i via shell. I tested it all on a Debian 64bit but think most parts are universal.
1. Putting adb to /etc/bin
First of all you should put the adb-binary in /etc/bin/ so you can access it like every other cmd. You can use the binary in my attached tar or the one from SDK. use "sudo cp adb /system/bin/adb" (if you have a system with sudo, eg debian & ubuntu)
2. adb: error insufficient permissions for device
If you plug in the phone and want to connect via "adb shell" it may says that you don't have permissions for device. There is a workaround:
- Create file /etc/udev/rules.d/51-android.rules
- Put the following in the file:
Code:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="2137", MODE="0666"
- restart udev "sudo service udev restart" (again this is debian&ubuntu-only)
if you still got "insufficient permissions", i made a little shell-script "adb-fix-permissions" attached in tar-file
3. bash-completition for adb
Bash is really annoying whitout completion. That means you can just start to type a word, then press [tab] and bash complets it for you. For example you type "adb ki[tab]" and bash complets it to "adb kill server"
To get this you need "adb_completition" from my attached zip or from here. Put this file in /etc/bash_completion.d/ and you got it.
example command to copy it:
"sudo cp adb_completition /etc/bash_completion.d/adb_completition"
4. Some keys not work in adb shell
This is a known and annoying bug. Eg in nano text editor you cant use the [enter]-key. There is a (little unclean) workaround for it: start a telnet-service on the phone, forward ports via adb and connetc to your phone via telnet. You will need telnetd from the attached tar. And your phone needs to be rooted.
- Remount system writable:
Code:
adb remount
- Put telnetd on your phone
Code:
adb push telnetd /system/bin/telnetd
- Make it executable:
Code:
adb shell chmod +x /system/bin/telnetd
for usage i have a little made a little script (in attached tar) "adb-shell".
Or you can do it manual:
Code:
adb telnetd &
adb forward tcp:9999 tcp:23
telnet localhost 9999
.. to be continued...
if you have one, please share your linux-android-tricks with me
thanks

[Q] adb shell prompt

Hey everyone I got a very technical question
I am trying to set a custom prompt for the shell on an android device running bourne shell (sh), I have suceeded in setting it for a login shell (sh -l) but I would like to make this default for non login like adb or ssh through connectbot @localhost. Normally on linux I could do this by editing /etc/profile but for some reason on my android sh does not read /etc/profile unless it is a login shell. I tried moving the sh binary and replacing the sh binary in /system/bin with a shell script that executes sh -l but I loose superuser access ( shell reports su command not found) so I moved sh back to /system/bin/sh. Does anyone have any Idea which file is read in by sh at launch?

Categories

Resources