Welcome, guest ( Login )

WikiHome » haserl

haserl

Version 18, changed by mschnell. 07/23/2008.   Show version history

Using Haserl scripts for HTML based Runtime Configuration


For many projects its a good idea to have your users use a browser to do runtime configuration with the device.

Of course you need to have a Flash file system to store the configuration values. See the appropriate articles on Flash and on rc-Files on how to install a Flash file system and use it for holding system variables in one or more configuration files.

Usually, when doing runtime configuration via http, you need to write a cgi-program (in C or a scripting language like php) that takes the user's inputs and creates html code, that the http server can send to the client's browser. Writing a dedicated C program seems a lot too high level for the simple task we want to accomplish here, and learning php as an additional language and implementing the php interpreter also does not seem appropriate for a small embedded device.

Haserl is a quite small tool that allows to write scripting code directly in normal html pages. Moreover it does not contain a scripting language interpreter but can be used (e.g.) with an existing command line (shell script) interpreter like bash or msh. Thus the haserl scripts are a mixture of html and shell script code and you don't need to create html code programmatically and/or provide as well a program and some html based pages. The haserl scrips can be created using a html editor like Quanta.

haserl is provided as a "miscellaneous program" with the µCLinux distr.

msh is part of the busybox.

The web server boa is provided with the µCLinux distr.

Attached here, you'll find a file that contains haserl scripts and shell scripts that work together to show some system states on a web page and allow for some common realtime configuration settings like "use DHCP" and "use IP-Address".

Additional considerations

With the actual distribution (July 2008) haserl only seems to work with boa when a line like
	syslog(LOG_DEBUG, "haserl start");
is added to e.g. main() in the haserl code and the sylog daemon is activated. (right now nobody seems to know why it does not work otherwise. It does work when called from a command line and it works with boa on a PC.) Any help on this issue is very much appreciated !


Haserl makes heavy use of the echo command, both because it uses echo when handling the script and because each haserl script will contain lots of echo commands (or "<%: some text maybe containing $VARIABLES %>"   phrases that haserl converts to echo commands.) Now msh has no builtin command "echo" but same needs to be provided externally as an executable file (or symlink). With the µCLinux distr, this echo executable dwells in busybox, too, which of course is a huge file. With XIP (execute in place ) this is no problem, as busybox usally is located in a RAM based file system and does not need loding. But right now (July 2008) the NIOS µCLinux distr's tool chain does not support XIP. That is why it makes sense to install an extra small "echo" utility instead of activating echo in busybox. This will speed up the access to haserl script pages greatly. The source code of such an echo usility is provided here.

Attachments (2)

  File By Size Attached Ver.
 romfs.tar.gz mschnell 49K 07/21/2008 1 Delete attachment
 echo.c mschnell 373B 07/21/2008 1 Delete attachment