If you like my work, please consider donating!

Scriptybox

Background

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!).

Using Scriptybox

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.

Viewing Available Commands

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!

Running Commands

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.

Available Commands

Below I will outline the available commands as well as what they do.

adblock: Block/Unblock ads

Usage statement
Usage:
    adblock [on|off]

Turns ad blocking for the system on or off
How it's used
# turn on ad blocking
adblock on
 
# turn off ad blocking
adblock off
How it Works

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 :)

camsounds: Turn camera sounds on/off

Usage statement
Usage:
    camsounds [on|off]

Turns the camera sounds (shutter and video cam) on or off
How it's used
# turn on camera sounds (shutter / video record)
camsounds on
 
# turn off camera sounds (shutter / video record)
camsounds off
How it works

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.

cpuinfo: Display CPU information

Usage statement


How it's used
# just simply type it in!
cpuinfo
How it works

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.

Sample output
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

dalvikjit: Turn the ESE81 JIT on/off

FIXME

freemem: Ensure that a certain amount of memory always remains free

FIXME

halt: Power off the system

FIXME

meminfo: Display memory information

FIXME

mtdinfo: Display system partition information

FIXME

rmapk: Remove unwanted system apps

FIXME

swapinfo: Display swap space information

FIXME

switchapk: Swap between common apps

FIXME

sysro: Mount /system read-only

FIXME

sysrw: Mount /system read-write

FIXME

zipalign_apks: Auto-zipalign all apps on the system

FIXME

 
documentation/scriptybox.txt · Last modified: 2010/07/23 06:35 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki