#!/usr/bin/haserl
<% if test "$FORM_submit" = "Download" ; then
	test -e /tmp/eeprom && source /tmp/eeprom
	DATE=$(date '+%Y-%m-%dT%H-%M-%S')
	FILENAME=${PRODUCT}_logfiles_${DATE}.tgz
	echo -en "Content-type: application/gzip\r\n"
	echo -en "Content-disposition: attachment;filename=$FILENAME\r\n"
	echo -en "\r\n"
	tar -zc --exclude=node /tmp /ross/etc 2>/dev/null
	exit
else
	echo -en "Content-type: text/html\r\n\r\n"
fi %>
<html>
<head>
<title>View System Log</title>
</head>
<body>

<form action="<% echo -n $SCRIPT_NAME %>" method="POST" enctype="multipart/form-data">
<h3>System log</h3>
<input type="submit" name="submit" value="Refresh">
<input type="submit" name="submit" value="Download">

<pre><% sed -e 's/&/\&amp;/g' \
	    -e 's/</\&lt;/g' \
	    -e 's/>/\&gt;/g' /var/log/messages
%></pre>

<p>Current time: <% date %></p>

<input type="submit" name="submit" value="Refresh">
<input type="submit" name="submit" value="Download">
</form>

</body>
</html>

