source: trunk/debathena/scripts/installer/athinfod.minimal/athinfod @ 25565

Revision 25565, 1.6 KB checked in by jdreed, 12 years ago (diff)
Support serving the athena installation log over athinfo
  • Property svn:executable set to *
Line 
1#!/bin/sh
2#
3# This is largely inspired by/stolen from the "httpd" script in
4# "save-logs" in the "installation-report" package, which is licensed
5# under GPLv2 (as of installation-report-2.44ubuntu1, which was
6# current when this was written).  This script is, therefore, licensed
7# under GPLv2.
8#
9PORT=49155
10DOCROOT=/var/log
11
12run_nc () {
13        nc -p $PORT -l -e $1 </dev/null >/dev/null 2>/dev/null &
14}
15
16if [ -z "$ATHINFOD_STARTED" ]; then
17        [ -f /var/lib/athinfod_stop ] && exit
18        ATHINFOD_STARTED=1
19        export ATHINFOD_STARTED
20        # daemonize
21        run_nc $0
22        exit
23else
24        # start up the next listener process
25        [ -f /var/lib/athinfod_stop ] || run_nc $0
26fi
27
28read query
29query="$(echo "$query" | sed 's/[^-.A-Za-z0-9_]//g')" # untaint
30
31case "$query" in
32    version)
33        echo "Installation in progress" && test -f /debathena/install-info && cat /debathena/install-info ;;
34    uname)
35        uname -a ;;
36    preseed)
37        grep -v "^d-i passwd/root-password" /debathena/preseed ;;
38    syslog)
39        tail -20 /var/log/syslog ;;
40    syslog-full)
41        cat /var/log/syslog ;;
42    hardware)
43        cat /sys/class/dmi/id/product_name ;;
44    uptime)
45        uptime ;;
46   
47    *)
48        [ "$query" != "queries" ] && echo "Unknown query"
49        cat <<EOF
50version       echo "Installation in progress" && test -f /debathena/install-info && cat /debathena/install-info
51uname         uname -a
52preseed       grep -v "^d-i passwd/root-password" /debathena/preseed
53syslog        tail -20 /var/log/syslog
54syslog-full   cat /var/log/syslog
55hardware      cat /sys/class/dmi/id/product_name
56uptime        uptime
57install.log   tail -20 /target/var/log/athena-install.log
58install.log-full   cat /target/var/log/athena-install.log
59EOF
60esac
61exit 0
Note: See TracBrowser for help on using the repository browser.