[26054] in Source-Commits
/svn/athena r25367 - in trunk/debathena/scripts/installer: . athinfod.minimal
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Wed Aug 10 16:49:12 2011
Date: Wed, 10 Aug 2011 16:49:06 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201108102049.p7AKn6Bk021985@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2011-08-10 16:49:05 -0400 (Wed, 10 Aug 2011)
New Revision: 25367
Added:
trunk/debathena/scripts/installer/athinfod.minimal/
trunk/debathena/scripts/installer/athinfod.minimal/athinfod
Log:
Ship a minimal athinfod for the installer.
Added: trunk/debathena/scripts/installer/athinfod.minimal/athinfod
===================================================================
--- trunk/debathena/scripts/installer/athinfod.minimal/athinfod (rev 0)
+++ trunk/debathena/scripts/installer/athinfod.minimal/athinfod 2011-08-10 20:49:05 UTC (rev 25367)
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# This is largely inspired by/stolen from the "httpd" script in
+# "save-logs" in the "installation-report" package, which is licensed
+# under GPLv2 (as of installation-report-2.44ubuntu1, which was
+# current when this was written). This script is, therefore, licensed
+# under GPLv2.
+#
+PORT=49155
+DOCROOT=/var/log
+
+run_nc () {
+ nc -p $PORT -l -e $1 </dev/null >/dev/null 2>/dev/null &
+}
+
+if [ -z "$ATHINFOD_STARTED" ]; then
+ [ -f /var/lib/athinfod_stop ] && exit
+ ATHINFOD_STARTED=1
+ export ATHINFOD_STARTED
+ # daemonize
+ run_nc $0
+ exit
+else
+ # start up the next listener process
+ [ -f /var/lib/athinfod_stop ] || run_nc $0
+fi
+
+read query
+query="$(echo "$query" | sed 's/[^-.A-Za-z0-9_]//g')" # untaint
+
+case "$query" in
+ version)
+ echo "Installation in progress:" && cat /debathena/install-info ;;
+ uname)
+ uname -a ;;
+ preseed)
+ grep -v "^d-i passwd/root-password" /debathena/preseed ;;
+ syslog)
+ tail -20 /var/log/syslog ;;
+ syslog-full)
+ cat /var/log/syslog ;;
+ hardware)
+ cat /sys/class/dmi/id/product_name ;;
+ uptime)
+ uptime ;;
+
+ *)
+ [ "$query" != "queries" ] && echo "Unknown query"
+ cat <<EOF
+version echo "Installation in progress"
+uname uname -a
+preseed grep -v "^d-i passwd/root-password" /debathena/preseed
+syslog tail -20 /var/log/syslog
+syslog-full cat /var/log/syslog
+hardware cat /sys/class/dmi/id/product_name
+uptime uptime
+EOF
+esac
+exit 0
Property changes on: trunk/debathena/scripts/installer/athinfod.minimal/athinfod
___________________________________________________________________
Added: svn:executable
+ *