This file is indexed.

/usr/lib/fai/get-boot-info is in fai-client 5.0.3ubuntu1.

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
#! /bin/bash

#*********************************************************************
#
# bootinfo -- get boot information via DHCP protocol
#
# This script is part of FAI (Fully Automatic Installation)
# (c) 2003-2014 by Thomas Lange, lange@informatik.uni-koeln.de
# Universitaet zu Koeln
#
#*********************************************************************
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# A copy of the GNU General Public License is available as
# `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution
# or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html.  You
# can also obtain it by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#*********************************************************************

# this script writes received information to $LOGDIR/boot.log

bootlog=$LOGDIR/boot.log

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
netdevice_info() {

    # devices that are running
    netdevices_up=$(ip link show up | grep "^[1-9$].*LOWER_UP" | cut -d : -f 2 | cut -d ' ' -f 2 | grep -v "^lo" | sort | uniq| tr '\n' ' ')
    # netdevices is the list of ethernet devices which will be used for bootpc (maybe dhcp)
    # if not defined, use boot messages to determine network devices
    [ -n "$netdevices" ] || netdevices=$netdevices_up

    # some network driver do not echo eth0,..; they are not detected
    netdevices_all=$(dmesg| perl -ne 'print $&,"\n" if m/\beth[0-9]+\b/')
    tmp=$(ip link | grep "^[1-9]" | cut -d : -f 2 | cut -d ' ' -f 2 | grep "^eth")
    netdevices_all="$netdevices_all $tmp"
    netdevices_all=$(for dev in $netdevices_all; do echo $dev; done| sort | uniq| tr '\n' ' ')
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
get_dhcp_info() {

    if [ $boot -eq 1 ]; then
	return
    fi
    boot=1
    cat > $bootlog <<-EOF
	netdevices_all="$netdevices_all"
	netdevices_up="$netdevices_up"
	netdevices="$netdevices"
EOF
    dhclient -lf /dev/null -cf /usr/share/fai/dhclient-fai.conf -sf /usr/share/fai/dhclient-fai-script $netdevices >>$bootlog 2> $LOGDIR/dhclient.log
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setnet() {

    # get network parameters
    # first get first active network device
    local dev dummy n

    n=0
    until [ $n = 7 ]; do
	dev=$(ip ad show up | awk -F': ' '/^[0-9]/ && ! / lo:/ {print $2;exit}')
	if [ -z "$dev" ]; then
            sleep 2 # if interface needs some time to come up
	else
	    break
	fi
	n=$(($n + 1))
    done

    read IPADDR NETMASK BROADCAST dummy<<<$(ifdata -p $dev)
    GATEWAYS=$(ip route | awk '/^default/ {print $3}')

    cat >> $bootlog <<-EOF
	netdevices_all="$netdevices_all"
	netdevices_up="$netdevices_up"
	netdevices="$netdevices"
	IPADDR=$IPADDR
	SERVER=$SERVER
	NETMASK=$NETMASK
	GATEWAYS=$GATEWAYS
	BROADCAST=$BROADCAST
EOF

    if [ -n "$DOMAIN" ]; then
        # DOMAIN was specified on the kernel command line
        echo "DOMAIN=$DOMAIN" >> $bootlog
    fi
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
get_fixed_info() {

    if [ $boot -eq 1 ]; then
	return
    fi
    boot=1
    # ip contains the network parameters
    echo $ip | grep -q : || echo "Kernel parameter ip= does not contain network parameters."
    setnet
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
nic_list_from_cmdline() {

    # parse nic(s) that are specified on the kernel command line like this:  ip=etX:dhcp

    niclist=
    line=$(< /proc/cmdline)

    for item in $line; do
	case $item in

	    ip=*:dhcp)
            nic=
	    # count the : char in the argument of ip=
	    n="${item//[^:]}"
	    # if there are more than 5 :, it's an static IP configuration, do not use this nic
	    if [ ${#n} -lt 5 ]; then
		nic=$(expr match "$item" 'ip=\(.*\):dhcp')
		niclist+=" $nic"
	    fi
	    ;;
	esac
    done
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

netdevice_info
boot=0

# if ip= parameter contains IP address, get fixed IP data, otherwise use DHCP
if [[ $ip =~ ^.*:*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} ]]; then
    get_fixed_info
fi

# if devices are specified on the kernel command line, only use those devices for DHCP
nic_list_from_cmdline
if [ -n "$niclist" ]; then
    netdevices=$niclist
fi

get_dhcp_info

# DHCP should not overwrite the hostname if it's already set
# then remove this line from boot.log
read hname < /proc/sys/kernel/hostname
if [ -n "$hname" -o "$hname" = '(none)' ]; then
    sed -i -e '/^HOSTNAME=/d' $bootlog
fi

if ! grep -q DOMAIN= $bootlog; then
    echo 'Info: no domain name configured, using "localdomain"' >&2
    echo "DOMAIN=localdomain" >> $bootlog
fi