So what is scriptybox? (besides a tool with an hilariously awesome name?) Well, scriptybox is my attempt at combining all of the functionality provided by most of the scripts included with today's ROMs into one simple, easily relocatable location. However, I didn't want to force users to type “scriptybox [blah]” whenever they wanted to run a command, so I took the approach of busybox, and made scriptybox run differently depending of the name of the symbolic link that was linking to it (hence the name scriptybox). But what is scriptybox?
Scriptybox is essentially nothing more than a BASH script. To use it, you MUST have BASH installed (which it is in Sapphire), as it relies heavily on the use of scripting functions, which are not available in the core shell included with android. Since it is a script, you can easily open it up with any text editor and see exactly how it ticks (and if you are interested, I recommend you do!).
Scriptybox is a BASH script that consists of a collection of commands. There are several ways to use scriptybox, those of which I will outline below.
To see a list of commands available to your current install of scriptybox, simply open up an adb shell/terminal emulator, and type:
scriptybox
This will output a list of commands as well as a short usage statement for each, as such:
Available commands:
adblock [on|off]
camsounds [on|off]
cpuinfo
dalvikjit [on|off]
freemem [50mb|75mb|100mb|default]
halt
meminfo
mtdinfo
rmapk [alarm|browser|calc|carhome|corpcal|
deskclock|devtools|email|genie|im|lwps|
mms|mp3|music|qoffice|spare]
swapinfo
switchapk [clock|music]
sysro
sysrw
zipalign_apks
(Android 2.1-update1 / Sapphire-0.5.0-Droid [ESE81] by cvpcs)
Now you know exactly what commands you can run, great!
All of the supported commands will have their symbolic links installed by default for you, so for any command, you can run it as:
# this is ok (and probably easiest) [command] [options] # e.g.: switchapk music milestone # this is ok too though scriptybox [command] [options] # e.g.: scriptybox switchapk music milestone
Thus as you can see, scriptybox works just the same as busybox in that respect.
Below I will outline the available commands as well as what they do.
Usage:
adblock [on|off]
Turns ad blocking for the system on or off
# turn on ad blocking adblock on # turn off ad blocking adblock off
The premise of it is that it replaces your phones /system/etc/hosts file, which defines several of the well-known ad servers to be located at IP address 0.0.0.0.
When a hostname is resolved on linux, the first place it looks is the defined hosts file (for android, /system/etc/hosts). If the hostname is found there, it uses the IP address provided. If not, then it uses the DNS servers to look it up. adblock essentially takes advantage of that by assigning the NULL IP address (0.0.0.0) to many well-known ad server hostnames. Thus, when an app or the browser attempt to access one of those servers, linux tells it that it is located at 0.0.0.0, but since this is NULL, the connection immediately fails and nothing happens. Hence, no ads :)
Usage:
camsounds [on|off]
Turns the camera sounds (shutter and video cam) on or off
# turn on camera sounds (shutter / video record) camsounds on # turn off camera sounds (shutter / video record) camsounds off
Camsounds is a super simple script. All it does is rename the camera sounds from .ogg files to .bak files, and back again. So when they are renamed to .bak, the device can't find them and therefore they don't play. When they're renamed as .ogg files, they are found and play properly.
# just simply type it in!
cpuinfo
All this script does is display the information found in /proc/cpuinfo. This file is dynamically populated by the linux kernel to include information about the processor.
Processor : ARMv7 Processor rev 3 (v7l) BogoMIPS : 995.78 Features : swp half thumb fastmult vfp edsp neon vfpv3 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x1 CPU part : 0xc08 CPU revision : 3 Hardware : sholes Revision : 0000 Serial : 0000000000000000