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

Revision 25567, 1.8 KB checked in by jdreed, 12 years ago (diff)
Actually add the install.log queries, instead of just adding them to the 'queries' output.
  • 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    install.log)
47        tail -20 /target/var/log/athena-install.log ;;
48    install.log-full)
49        cat /target/var/log/athena-install.log ;;
50    *)
51        [ "$query" != "queries" ] && echo "Unknown query"
52        cat <<EOF
53version       echo "Installation in progress" && test -f /debathena/install-info && cat /debathena/install-info
54uname         uname -a
55preseed       grep -v "^d-i passwd/root-password" /debathena/preseed
56syslog        tail -20 /var/log/syslog
57syslog-full   cat /var/log/syslog
58hardware      cat /sys/class/dmi/id/product_name
59uptime        uptime
60install.log   tail -20 /target/var/log/athena-install.log
61install.log-full   cat /target/var/log/athena-install.log
62EOF
63esac
64exit 0
Note: See TracBrowser for help on using the repository browser.