This file is indexed.

/etc/init.d/xdebian-edu-firstboot is in debian-edu-install 1.916.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#!/bin/sh
### BEGIN INIT INFO
# Provides:          xdebian-edu-firstboot
# Required-Start:    $remote_fs $all
# Required-Stop:
# Should-Start:      $x-display-manager xdm kdm gdm wdm slim lightdm
# Default-Start:     2 3 4 5
# Default-Stop:
# X-Interactive:     true
# Short-Description: Check the Debian Edu installation after first boot
# Description:       Run the self test and report any errors found.
#                    Install this as /etc/rc2.d/99xdebian-edu-firstboot
### END INIT INFO
#
# Author: Petter Reinholdtsen
# Date:   2006-09-22
#

# only run if package is installed (debian policy 9.3.2)
test -f /usr/lib/debian-edu-install/version || exit 0

. /lib/lsb/init-functions

firstboot_file=/etc/debian-edu/xdebian-edu-firstboot

set -e

info() {
    logger -t debian-edu-install "info: $@"
}

error() {
    logger -t debian-edu-install "error: $@"
}

at_exit() {
    error "script $0 terminated unexpectedly."
}
disable_exception() { trap - INT TERM EXIT; }
trap at_exit INT TERM EXIT

run_testsuite() {
    log_begin_msg "Collecting testsuite results"
    logfile=/var/log/installer/debian-edu-install-testsuite

    temp_dir=$(mktemp -d)
    errfile=$temp_dir/errors

    nice debian-edu-test-install > $logfile 2>&1

    # find error and partition resize messages in the d-i log and the
    # self test
    if [ -f /var/log/installer/syslog  ] ; then
        # remove syslog prefix
        # Ignore normal errors from wget commands used to test it
        # mirrors are available [pere 2010-07-22].
        egrep 'error:|fsautoresize' /var/log/installer/syslog | \
	    grep -v 'wget: server returned error: HTTP/1.0 404 Not Found' | \
	    grep -v 'wget: server returned error: HTTP/1.1 404 Not Found' | \
	sed 's/.*error: /error: /g' > $errfile
    fi
    grep error: $logfile >> $errfile || true

    if [ -s $errfile ] ; then
        log_end_msg 1 || true
        log_begin_msg "Reporting errors found"
        if $0 report-errors $errfile ; then
            log_end_msg 0 || true
        else
            log_end_msg 1 || true
        fi
    else
        log_end_msg 0 || true
        $0 report-success || true
    fi
    rm $errfile
    rmdir $temp_dir
}

do_start() {
    logger -t debian-edu-install "Executing xdebian-edu-firstboot"

    # The parts updating LTSP and readahead was moved to
    # debian-edu-config, this hook made it possible.
    if [ -x /usr/share/debian-edu-config/tools/run-at-firstboot ] ; then
	log_begin_msg "Running debian-edu-config run-at-firstboot"
	/usr/share/debian-edu-config/tools/run-at-firstboot 
	log_end_msg 0 || true
    fi

    # Create firstboot file to prevent it from being run again
    touch "$firstboot_file"

    # only run the testsuite and report errors during development, not
    # during production
    if [ -f /etc/debian-edu/config ] ; then . /etc/debian-edu/config ; fi
    if [ true = "$TESTINSTALL" ]; then
	run_testsuite
    else
	log_begin_msg "Not collecting testsuite results"
	log_end_msg 0 || true
    fi
}

prepare_debconf() {
    # Try to get debconf to pop up the dialog on top of the display
    # manager.  Need to do this before starting debconf.
    if [ ! "$DEBIAN_HAS_FRONTEND" ] ; then
        # This is generated by kdm
	candidate="`ls -tr /var/run/xauth/* 2>/dev/null|tail -1`"

        # gdm, lightdm
	candidate="$candidate /var/lib/gdm/:0.Xauth /var/lib/lightdm/.Xauthority"

        # gdm3
	for f in /var/run/gdm3/auth-for-Debian-gdm*/database ; do
	    candidate="$candidate $f"
	done

	XAUTHORITY=
	for f in $candidate ; do
	    if XAUTHORITY=$f DISPLAY=:0 xauth list >/dev/null 2>&1 &&
		XAUTHORITY=$f DISPLAY=:0 xhost > /dev/null 2>&1 ; then
		XAUTHORITY=$f
		break
	    fi
	done

	if [ "$XAUTHORITY" ] ; then
            info "found X authority file $XAUTHORITY, trying to start debconf with X frontend."
            # Try to use kde frontend (require libqt-perl) or gnome frontend
            # (libgtk2-perl).  debconf will fall back to dialog if either
            # frontend fails to start.  The frontend need to be set before
            # confmodule is sourced to have effect.
            DISPLAY=:0
            # TODO: find graphical variant that works with dialog frontend?
            if perl -MGtk2 -e 'exit 0' ; then
               # use gnome frontend
		export DEBIAN_FRONTEND=gnome
            elif perl -MQtCore4 -e 'exit 0' ; then
               # use kde frontend
		export DEBIAN_FRONTEND=kde
            else
		info "unable to find usable debconf X frontend"
            fi
            export XAUTHORITY DISPLAY
	elif [ -d /run/systemd/system ] ; then
            # FIXME Figure out what to do under systemd, where no tty
            # is available!  For now, just give up. :(
            info "systemd and no X detected, not showing test status"
            return 1
	fi
    fi
    . /usr/share/debconf/confmodule

    # Disable usplash if enabled and not using the X display, to get
    # the debconf dialog to show up.  Need to do this after the
    # $DISPLAY variable is set up, to detect if the X connection is
    # working.
    if [ -z "$DISPLAY" ] && type usplash_write >/dev/null 2>&1; then
        clear >/dev/tty8
        /sbin/usplash_write QUIT
        chvt 8
    fi
}

cleanup_debconf() {
    # Move back to tty1, to get the login prompt
    if [ -z "$DISPLAY" ] && type usplash_write >/dev/null 2>&1; then
        chvt 1
    fi
}

report_errors() {
    errfile="$2"

    prepare_debconf $@ || return

    # Quick fix to make sure all error entries at least are
    # displayed.  The correct fix is to find out how to replace a
    # debconf variable with multiline content.  not sure why I
    # need to change this in to one long line
    errors=`cat $errfile | sed 's/$/, /g' | tr -d "\n" | sed 's/, $//'`

    # Take a look at how CURRENT_CONFIG is built up in
    # partman/partman-lvm/choose_partition/lvm/do_option

    db_subst debian-edu-install/errors-found ERRORS "$errors"

    db_fset debian-edu-install/errors-found seen false
    db_input critical debian-edu-install/errors-found || [ $? -eq 30 ]
    db_go

    cleanup_debconf
}

report_success() {
    prepare_debconf $@ || return

    log_begin_msg "Reporting successful installation"

    db_input critical debian-edu-install/no-errors-found || [ $? -eq 30 ]
    db_go

    log_end_msg 0 || true

    cleanup_debconf
}

case "$1" in
    start)
        if [ ! -f "$firstboot_file" ]; then
            do_start
        fi
        ;;
    stop|force-reload|restart)
        ;;
    report-errors)
        # Need to pass all arguments, to get debconf re-exec to work
        report_errors $@
        ;;
    report-success)
        # Need to pass all arguments, to get debconf re-exec to work
        report_success $@
	;;
    *)
        echo "Usage: /etc/init.d/xdebian-edu-firstboot {start|stop|restart|force-reload}"
        disable_exception
        exit 1
        ;;
esac

disable_exception
exit 0