Monday, July 1, 2013

Back to Reality

The original design of the zipit envisioned it as a communications toy for kids.  However, when I first saw it I pictured it as more of a learning toy, at least for me.  It's got all the basics for software development built into a teensy toy form factor.  And over the past few years I've learned quite a bit, porting various pieces of software to fit on the slow processor and gizmo shape of the zipit.  In fact it's been almost 2 years now since I attempted to relearn some shell scripting techniques that I'd nearly forgotten with the passage of time.  I always thought that stuff might come in handy some day, possibly even at work.  And sure enough, it's finally paid off.

At work I'm occasionally called to help support the field engineers by phone as they deploy the software parts of the systems we build.  Some of these are built on TinyCore linux and installed in a little black box with no local user interface.  This can be challenging when someone wants to transfer files to and from the devices with say a usb stick at the site.  Now, TinyCore comes with a really nice simple gui for identifying and mounting usb sticks, but if you don't happen to have a monitor or mouse you wind up trying to do it all via an ssh window from a laptop nearby.  Just try talking someone over the phone through the linux commands for identifying, and mounting a usb stick on the command line.  Let me tell you, it's a challenge. 

So to make my life somewhat easier, I decided to devote some of my spare time to make a shell script that emulates the TinyCore disk mounter tool.  You can see here the original FLTK gui tool and the scripty tool below it running in an xterm.

Not too bad, eh?  Now what, you say, does this have to do with the zipit?  Well, it turns out TinyCore runs on a busybox ash shell, just like the zipit.  And it doesn't come with the dialog program so I had to build the scripty disk mounter out of /bin/sh, sed, and grep (with a sprinkling of ANSI escape codes) just like I did with the zipit almost 2 years ago.  I suppose it might even be handy on the zipit if the homemade usb adapters were ever to become commonplace.

Here's the code.  The mnttool.sh script uses 3 helper scripts that are also included.  Two of them come from TinyCore and are also used by the GUI tool.  The cfajfuncs helper script comes from http://cfaj.freeshell.org (I bought and recommended his book previously) and is slightly modified to work with the variations of the echo and read commands in the TinyCore busybox shell. 

mnttool-sh.tgz

No comments:

Post a Comment