[8185] in athena10
Re: [Debathena] #818: Run athinfod during the install
daemon@ATHENA.MIT.EDU (Debathena Trac)
Tue Aug 9 21:07:59 2011
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
From: "Debathena Trac" <debathena@MIT.EDU>
Cc: debathena@mit.edu
To: geofft@mit.edu, jdreed@mit.edu
Date: Wed, 10 Aug 2011 01:07:52 -0000
Reply-To:
Message-ID: <052.eea11c59d8d06a8f0af768a2eef7c7d5@mit.edu>
In-Reply-To: <043.4047f9cfa4ee0e052015b441b2d49fcc@mit.edu>
Content-Transfer-Encoding: 8bit
#818: Run athinfod during the install-------------------------+--------------------------------------------------
Reporter: geofft | Owner: jdreed
Type: enhancement | Status: accepted
Priority: normal | Milestone: The Distant Future
Component: -- | Keywords:
See_also: |
-------------------------+--------------------------------------------------Changes (by jdreed):
* owner: => jdreed
* status: new => accepted
Comment:
Geoff pointed me at `httpd` from the `save-logs` udeb, whose source is in
the `installation-report` package. I propose we copy that and implement
our athinfod in shell. Building a udeb, in addition to being yet another
thing we need to do, requires that anna be functional. We actually do a
bunch of things long before anna is functional. wget, however, is
functional that early in the install. Here's my proposed script. Note
that nc is traditional netcat, not openbsd netcat.
{{{
#!/bin/sh
#
# The idea of using netcat as a lightweight inetd was inspired by the
# "httpd" script in the "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. The
# license of athinfod itself is unaffected by this.
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" ;;
uname)
uname -a ;;
preseed)
cat /debathena/preseed ;;
syslog)
cat /var/log/syslog ;;
*)
[ "$query" != "queries" ] && echo "Unknown query"
cat <<EOF
version echo "Installation in progress"
uname uname -a
preseed cat /debathena/preseed
syslog cat /var/log/syslog
EOF
esac
exit 0
}}}
-- Ticket URL: <http://debathena.mit.edu/trac/ticket/818#comment:2>Debathena <http://debathena.mit.edu/>MIT Debathena Project