Wednesday, September 10, 2008

busybox

Category: Clever hacks I like most
Entry: BusyBox

Citing the man page, The Swiss Army Knife of Embedded Linux, BusyBox combines tiny versions of many common UNIX utilities into a single small executable.

The day before yesterday I wgot me a recent source snapshot tarball of <a href=http://www.busybox.net>busybox</a>.
Configuration, as stated in the TODO, should be revamped but is endurable. Compilation under Knoppix 5.something a no brainer. Had to disable some SELinux and crypt related stuff.

I first made a busybox binary containing only ash, and then another with nearly everything.Stripped and UPXed, the ash is 42944 bytes small and the 'allinone' comes down to 384616.

There was just little sed magic and general hacking to be had in making my 'workbench' shell scripts compatible to
the syntax of the ash.. 'echo -en'..
Beautyful KISS. Small and fast.
Very nice to see good old ash updated.
Some things previously not implementet in older 'ashes' that I used to know are a $RANDOM special variable, command line editing and history, better arithmetic (%), Tab completion goodness, aliases ..

One of zsh's features that I miss most is the abbility to '=' $path expand command lines, eg:
vim =blender.sh
expands to vim /usr/local/bin/blender.sh
I wrote a very simple wrapper function that does more or less the same:
vv () { [ ! "$1" ] || [ $1 = --help ] && echo Usage: vv FILE.. ' finds and edits FILE in $PATH' && return 1
vim `which $1`
}

a shortcut to edit /usr/local/bin/compsopogon being thus:
vv compsopogon

I am planning to implement a 'hist_ignore_dups' function, just for the comfort of it.
Already having started to read and understand the ash.c and library source code it'd be a matter of several lines changed or added.
Meanwhile rent, electric power and gas want to be paid though, so donations are welcomed by
Yours Truely.

ps. and I am out of coffee.

No comments: