Updated busybox (including httpd)

From Joggler
Jump to navigation Jump to search

Here is version 1.6 of Busybox (the lightweight multi function utility that ships with the O2 software). This version includes a simple webserver which will allow local scripts to be called from the O2 interface to start non-O2 applications, such as xwd (screen capture), Squeezeplay etc.

File:Busybox-1.6.tar.gz


The O2 version had a limited build of version v1.10.4 including:

[, [[, adjtimex, arp, ash, bunzip2, bzcat, bzip2, cat, chgrp, chmod, chown, clear, cmp, cp, cryptpw, date, dd, df, diff, dmesg,
du, echo, ed, egrep, eject, env, expr, false, fdisk, fgrep, find, free, freeramdisk, fsck, ftpget, ftpput, fuser, getty, grep, gunzip,
gzip, halt, head, hostname, hwclock, id, ifconfig, init, insmod, ipcrm, ipcs, kill, killall, killall5, klogd, less, linuxrc, ln,
logger, login, logread, ls, lsmod, mdev, mesg, mkdir, mkfifo, mknod, modprobe, more, mount, mv, nslookup, passwd, pidof, ping, poweroff,
ps, pwd, rdate, readahead, readprofile, reboot, rm, rmdir, rmmod, route, runlevel, sed, sh, sleep, sort, strings, stty, sync, syslogd,
tail, tar, telnet, telnetd, test, time, top, touch, tr, true, tty, udhcpc, umount, uname, uptime, usleep, vi, watch, wc, wget, who,
whoami, yes, zcat

The updated version v1.16.1 includes:

[, [[, acpid, addgroup, adduser, adjtimex, ar, arp, arping, ash, awk, basename, beep, blkid, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat,
chattr, chgrp, chmod, chown, chpasswd, chpst, chroot, chrt, chvt, cksum, clear, cmp, comm, cp, cpio, crond, crontab, cryptpw, cttyhack, cut,
date, dc, dd, deallocvt, delgroup, deluser, depmod, devmem, df, dhcprelay, diff, dirname, dmesg, dnsd, dnsdomainname, dos2unix, du, dumpkmap,
dumpleases, echo, ed, egrep, eject, env, envdir, envuidgid, ether-wake, expand, expr, fakeidentd, false, fbset, fbsplash, fdflush, fdformat,
fdisk, fgrep, find, findfs, fold, free, freeramdisk, fsck, fsck.minix, fsync, ftpd, ftpget, ftpput, fuser, getopt, getty, grep, gunzip, gzip,
halt, hd, hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock, id, ifconfig, ifdown, ifenslave, ifplugd, ifup, inetd, init, inotifyd,
insmod, install, ionice, ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd, last,
length, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap, logger, login, logname, logread, losetup, lpd, lpq, lpr, ls, lsattr, lsmod,
lspci, lsusb, lzmacat, lzop, lzopcat, makedevs, makemime, man, md5sum, mdev, mesg, microcom, mkdir, mkdosfs, mke2fs, mkfifo, mkfs.ext2,
mkfs.minix, mkfs.vfat, mknod, mkpasswd, mkswap, mktemp, modprobe, more, mount, mountpoint, msh, mt, mv, nameif, nc, netstat, nice, nmeter, nohup,
nslookup, ntpd, od, openvt, passwd, patch, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, popmaildir, poweroff, printenv, printf,
ps, pscan, pwd, raidautorun, rdate, rdev, readahead, readlink, readprofile, realpath, reboot, reformime, renice, reset, resize, rm, rmdir, rmmod,
route, rpm, rpm2cpio, rtcwake, run-parts, runlevel, runsv, runsvdir, rx, script, scriptreplay, sed, sendmail, seq, setarch, setconsole, setfont,
setkeycodes, setlogcons, setsid, setuidgid, sh, sha1sum, sha256sum, sha512sum, showkey, slattach, sleep, softlimit, sort, split,
start-stop-daemon, stat, strings, stty, su, sulogin, sum, sv, svlogd, swapoff, swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar,
taskset, tcpsvd, tee, telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr, traceroute, traceroute6, true, tty, ttysize, tunctl,
tune2fs, udhcpc, udhcpd, udpsvd, umount, uname, uncompress, unexpand, uniq, unix2dos, unlzma, unlzop, unzip, uptime, usleep, uudecode, uuencode,
vconfig, vi, vlock, volname, wall, watch, watchdog, wc, wget, which, who, whoami, xargs, yes, zcat, zcip


Amongst other additional features, this adds the basic busybox httpd (webserver) - which is handy for launching processing from the O2 interface by setting up application.xml entries for locally served urls.

This could probably replace the stock busybox in /bin/busybox, or just save it somewhere else to preserve the original O2 installation.


You can start the webserver at boot time with a boot.d file:

vi /etc/init.d/boot.d/S99httpd

Line 2 reflects where ever you have saved the updated busybox binary (eg: /media/build ):

#!/bin/sh
cd /media/build
./busybox-1.6 httpd -c httpd.conf

Make this file executable:

chmod 755 /etc/init.d/boot.d/S99httpd

Create a suitable httpd.conf to set the document root (eg: /media/build/www ) and script handlers, eg:

vi /media/build/httpd.conf

Line 1 defines the directory for the webserver document root, line 2 sets .script files to be run as scripts, line 3 defines the default index page:

H:/media/build/www
*.script:/bin/sh
I:index.html

In the document root, create a suitable script to launch apps, such as Squeezeplayer

#!/bin/sh
echo "Content-type: text/plain"
echo ""
echo Starting Squeezeplayer
/usr/bin/killall jive
/media/squeezeplay/bin/squeezeplay.sh > /media/squeezeplay/log.txt &

To add a suitable shortcut on the O2 interface:

vi /media/appshop/applications.xml

add such a line (references the local webserver running on 127.0.0.1) :

<app static="1" id="SQU" title="Squeezeplayer" loc="" icon="/media/appshop/squeezeplay-icon.swf" app="http://127.0.0.1/squeeze.script"/>

Credit to http://www.tarkan.info/20100527/tutorials/guide-o2-joggler-and-logitech-squeezeplay for providing an archive of Squeezeplayer for the stock Joggler and the squeezeplay-icon.swf.

(The icon can be fetched thus:

wget http://www.tarkan.info/images/squeezeplay-icon.swf

)