This file is indexed.

/usr/sbin/debian-edu-pxeinstall is in debian-edu-config 1.702.

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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
#!/bin/sh
#
# Prepare for PXE installation of Debian Edu.
#
# A better idea might be to use di-netboot-assistant,
# <URL:http://www.klabs.be/~fpiat/linux/debian/di-netboot-assistant/>.
# See also the original bin/debian-edu-pxelinux.cfg 
# (bin/debian-edu-pxelinux.cfg has been removed from the 
# debian-edu-config source after 1.443~svn66662)

set -e

LC_ALL=C
export LC_ALL

## FIXME: Why is resolv.conf empty or missing? Because network 
## was started in the chroot (target)? 
## Try to find the DNS from the leases file, if that fails use
## default DNS:
if [ ! -s /etc/resolv.conf ] ; then
    DNS="10.0.2.2"
    LEASEDIR=/var/lib/dhcp/
    if [ -d $LEASEDIR ] ; then
	LEASEFILE=$LEASEDIR`ls -tr -1 $LEASEDIR | tail -n 1`
	if [ -r $LEASEFILE ] ; then
	    if DNSLEASE=`cat $LEASEFILE | grep domain-name-servers | \
		tail -n 1 | \
		grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+"` ; then
		DNS=$DNSLEASE
		echo "info: Found leases file and domain-name-server: $DNS."
	    else
		echo "info: Could not extract DNS from leases file."
	    fi
	fi
    fi
    echo "info: Create temporary /etc/resolv.conf with DNS: $DNS."
    cat >> /etc/resolv.conf <<EOF
## This is a temporary resolv.conf created by $0.
## If you find it after installation, something went wrong. Try to replace it 
## by a symlink: /etc/resolv.conf -> /etc/resolvconf/run/resolv.conf, i.e.: 
## rm /etc/resolv.conf; ln -s /etc/resolvconf/run/resolv.conf /etc/resolv.conf
nameserver $DNS
search intern
EOF
fi

# Make sure the created directories and files are readable by tfptd
# run as user nobody.
umask 022

# Fetch ftp_proxy and http_proxy if set globally
if [ -f /etc/environment ] ; then
    . /etc/environment
fi

[ "$dist" ]      || dist=$(lsb_release -s -c)
[ "$archs" ]     || archs="i386 amd64"
[ "$mirrorurl" ] || mirrorurl=http://ftp.skolelinux.org/debian
[ "$archiveurl" ] || archiveurl=http://ftp.skolelinux.org/skolelinux
[ "$hostname" ]  || hostname=pxeinstall
[ "$domain" ]    || domain=intern
# Not hardcoded to allow PXE installation of a main-server without a
# proxy set
#[ "$http_proxy" ] || http_proxy=http://webcache:3128
#[ "$ftp_proxy" ] || ftp_proxy=http://webcache:3128

# Use Graphical installer by default
graphicdi=false

# Workaround for bad lsb_release behaviour when only a CD/DVD APT
# source is listed in /etc/sources.list.
if [ "n/a" = "$dist" ] ; then
    dist=squeeze
fi

if [ -f /etc/debian-edu/config ] ; then
    . /etc/debian-edu/config
fi

# Special case test builds
if [ true = "$TESTINSTALL" ] ; then
    edudist=$dist-test
else
    edudist=$dist
fi

# This part does not work from within debian-installer, as it is
# executed from cfengine before the cdebconf files are copied into
# /var/log/installer/cdebconf/ ("debconf-get-selections --installer"
# does not work).  A workaround for this issue was added to
# debian-edu-install, copying the files a bit earlier.
installconfig=""
for template in debian-installer/locale console-keymaps-at/keymap \
    tasksel/desktop; do
    value="$(debconf-get-selections --installer | grep $template | awk '{print $4}')"

    # Using desktop= as kernel argument work, while tasksel/desktop=
    # do not.  No idea why, but lets use the one that work.
    if [ "tasksel/desktop" = $template ] ; then template=desktop ; desktop=$value; fi

    if [ "$value" ] ; then
	installconfig="$installconfig $template=$value"
    fi
done

tftpdir=/var/lib/tftpboot

# Where to find the preseed file on the web
preseedurl=http://www/debian-edu-install.dat

# Where the preseed file is on the disk.
preseedfile=/etc/debian-edu/www/debian-edu-install.dat

# Allow site specific overrides to the variables
if [ -f /etc/debian-edu/pxeinstall.conf ] ; then
    . /etc/debian-edu/pxeinstall.conf
fi

[ -d $tftpdir ] || mkdir $tftpdir
[ -d $tftpdir/debian-edu ] || mkdir $tftpdir/debian-edu


for arch in $archs ; do
    (
	[ -d $tftpdir/debian-installer ] || \
	    mkdir $tftpdir/debian-installer
        cd $tftpdir/debian-installer
        tarball=""
        if [ -d /usr/lib/debian-installer/images/$arch ]; then
	    # Use the debian/installer netboot debs
            tarball=""
	    if [ true = "$graphicdi" ]; then
		ln -sf /usr/lib/debian-installer/images/$arch/gtk $arch
		gtkvideo="video=vesa:ywrap,mtrr"
	    else
		ln -sf /usr/lib/debian-installer/images/$arch/text $arch
	    fi
        elif [ ! -f netboot-$arch.tar.gz ] ; then
	    if [ true = "$graphicdi" ]; then
                # Use this URL for graphical installer, and fix
                # gtkvideo setting below
                url=$mirrorurl/dists/$dist/main/installer-$arch/current/images/netboot/gtk/netboot.tar.gz
                gtkvideo="video=vesa:ywrap,mtrr vga=788"
            else
                url=$mirrorurl/dists/$dist/main/installer-$arch/current/images/netboot/netboot.tar.gz
            fi
            echo "Fetching $url"
            if wget -q -O netboot-$arch.tar.gz.new $url ; then
                mv netboot-$arch.tar.gz.new netboot-$arch.tar.gz
                tarball=netboot-$arch.tar.gz
            else
                echo "error: Unable to download $url"
                exit 1
            fi
        fi
        if [ "$tarball" ] ; then
            tar --strip-components=2 -zxvf $tarball
        fi
    )
done

echo "Generating $preseedfile"
(
    cat <<EOF
# Enable the Debian Edu installer overrides
d-i     anna/choose_modules     multiselect     debian-edu-install-udeb: Execute Debian-Edu debian-installer profile

# Just accept the proposed hostname and domain, as it is dynamically
# fetched from DNS.
d-i     netcfg/get_hostname     seen    true
d-i     netcfg/get_domain       seen    true

# location of the proxies, in case it is required, both http and ftp
# in case someone ask d-i to use ftp mirrors.
d-i     mirror/http/proxy       string  $http_proxy
d-i     mirror/ftp/proxy        string  $ftp_proxy

# list extra packages to install here
#d-i     pkgsel/include string acroread

# if you want popcon enabled by default
#d-i     debian-edu-install/participate-popcon boolean true

# If you want a specific set of profiles installed
#d-i	debian-edu-install/profile multiselect Workstation, Thin-Client-Server

# If you want automatic partitioning
#d-i	debian-edu-install/confirm boolean true

# If you want to avoid the password question
#d-i passwd/root-password-crypted password passwordhash

# Tell LTSP to not use the CDROM, but a HTTP mirror
d-i ltsp-client-builder/use_cdrom boolean false
d-i ltsp-client-builder/build-client-opts string --mirror $mirrorurl --dist $dist

# Pass on the time zone used on the main-server
EOF
    debconf-get-selections --installer | grep -w 'time/zone'

    if [ squeeze = "$dist" ] ; then
	# FIXME check if this workaround is still needed.  It is
	# needed when the udebs we want to use during installation are
	# newer in our repository than in the official Debian
	# repository.
        cat <<EOF

# Workaround for old udebs in Debian/Squeeze
d-i     preseed/early_command   string  anna-install dmidecode-udeb; export http_proxy="$http_proxy"; cd /tmp; archiveurl=$archiveurl; arch=i386; wget \$archiveurl/dists/$edudist/local/debian-installer/binary-\$arch/Packages; packages_file=Packages; desired_udebs="debian-edu-profile-udeb"; for file in \$(grep 'Filename:' \$packages_file | cut -d : -f 2); do udeb=\$(basename \$file | cut -d _ -f 1); for u in \$desired_udebs ; do if [ "\$u" = "\$udeb" ]; then url="\$archiveurl/\$file"; echo "info: Trying to fetch and install \$url"; if wget \$url; then udpkg --unpack \$(basename \$file); else echo "error: Unable to download \$url"; fi; break; fi; done; done; if [ -z "\$url" ] ; then echo "error: Unable to find updated udebs"; fi
EOF
    fi

    # Enable test repository during testing, but not for production
    if [ "$dist" != "$edudist" ] ; then
	cat <<EOF

# Test install, activate test repository, uses local0 which is also
# used by debian-edu-install, which will make sure a duplicate APT
# source is not inserted into sources.list when doing test installs.
d-i apt-setup/local0/repository string http://ftp.skolelinux.org/skolelinux $edudist local
d-i apt-setup/local0/comment string Debian Edu $edudist repository
d-i apt-setup/local0/source boolean true
EOF
    fi

    # No use copying the installation mirror setting if a DVD was used
    if grep -qi dvd /etc/apt/sources.list ; then
cat <<EOF

# Avoid questions about mirrors, using manual setup
choose-mirror-bin     mirror/country          string  manual
choose-mirror-bin     mirror/protocol select  http
choose-mirror-bin     mirror/http/hostname    string  cdn.debian.net
choose-mirror-bin     mirror/http/directory   string  /debian
EOF
    else
	debconf-get-selections --installer | egrep -w 'mirror/country|mirror/protocol|mirror/http/hostname|mirror/http/directory|mirror/ftp/hostname|mirror/ftp/directory'
    fi

    # Make it easier to have local overrides and still be able to
    # rerun debian-edu-pxeinstall.
    if [ -f $preseedfile.local ] ; then
	cat $preseedfile.local
    fi
) > $preseedfile

if [ "$passwdmd5hash" ]; then
    cat <<EOF > $tftpdir/debian-edu/menupasswd.cfg
        MENU PASSWD $passwdmd5hash
EOF
fi

menufile=$tftpdir/debian-edu/install.cfg
echo "Generating $menufile"
(
    for arch in $archs ; do
        cat <<EOF
	# Based on the values used in Debian, and added the preseed URL
LABEL neteduboot-$arch
        MENU LABEL Install Edu/^$arch ($desktop)
        kernel debian-installer/$arch/linux
        append $gtkvideo initrd=debian-installer/$arch/initrd.gz -- quiet url=$preseedurl hostname=$hostname domain=$domain $installconfig
include menupassword.cfg

EOF
    done
) > $menufile

memtest=
if [ -f /boot/memtest86.bin ] ; then
    memtest=/boot/memtest86.bin
fi
if [ -f /boot/memtest86+.bin ] ; then
    memtest=/boot/memtest86+.bin
fi
if [ "$memtest" ] ; then
    cp $memtest $tftpdir/debian-edu/memtest86
    cat <<EOF > $tftpdir/debian-edu/memtest.cfg
LABEL memtest86
        MENU    LABEL  Test ^memory
        kernel  debian-edu/memtest86

EOF
fi

if [ -d /var/lib/tftpboot/ltsp/i386 ] ; then
    ltsproot=/opt/ltsp/i386

    cat <<EOF > $tftpdir/debian-edu/ltsp-thin.cfg

LABEL ltsp-thin
        MENU    LABEL  LTSP ^thin client
        KERNEL ltsp/i386/vmlinuz
        APPEND initrd=ltsp/i386/initrd.img nfsroot=$ltsproot boot=nfs ro quiet 4

EOF
    cat > $tftpdir/debian-edu/default-thin.cfg <<EOF
DEFAULT ltsp/i386/vmlinuz initrd=ltsp/i386/initrd.img nfsroot=$ltsproot boot=nfs ro quiet 4
EOF

# See if LTSP also have diskless workstation support
    if [ -e $ltsproot/lib/security/pam_ldap.so ] || \
       [ -e $ltsproot/lib/security/pam_krb5.so ] || \
       [ -e $ltsproot/lib/security/pam_sss.so ] ; then
	cat <<EOF > $tftpdir/debian-edu/ltsp-diskless.cfg

LABEL ltsp-diskless
        MENU    LABEL  LTSP ^diskless workstation
        KERNEL ltsp/i386/vmlinuz
        APPEND initrd=ltsp/i386/initrd.img nfsroot=$ltsproot boot=nfs ro quiet 3


EOF
	cat > $tftpdir/debian-edu/default-diskless.cfg <<EOF
DEFAULT ltsp/i386/vmlinuz initrd=ltsp/i386/initrd.img nfsroot=$ltsproot boot=nfs ro quiet 3
EOF
    fi
fi

cat <<EOF > $tftpdir/debian-edu/localboot.cfg
LABEL localboot
        MENU LABEL Boot from ^local harddrive
        MENU DEFAULT
        localboot 0

EOF

ln -sf /usr/lib/syslinux/pxelinux.0 $tftpdir/pxelinux.0
ln -sf /usr/lib/syslinux/vesamenu.c32 $tftpdir/debian-edu/vesamenu.c32
ln -sf /usr/share/pixmaps/splash/debian-edu-splash.png $tftpdir/debian-edu/debian-edu-splash.png

defaultfile=$tftpdir/debian-edu/default-menu.cfg
echo "Generating $defaultfile"
(
    cat <<EOF
include debian-edu/localboot.cfg
MENU SEPARATOR
include debian-edu/ltsp-diskless.cfg
include debian-edu/ltsp-thin.cfg
MENU SEPARATOR
include debian-edu/install.cfg
MENU SEPARATOR
include debian-edu/memtest.cfg

menu color title        * #FFFFFFFF *
menu color border       * #00000000 #00000000 none
menu color sel          * #ffffffff #76a1d0ff *
menu color hotsel       1;7;37;40 #ffffffff #76a1d0ff *
menu color tabmsg       * #ffffffff #00000000 *
menu color help         37;40 #ffdddd00 #00000000 none

menu vshift 8
menu rows 10
menu hshift 13
menu width 49
menu background debian-edu/debian-edu-splash.png
menu tabmsg Press ENTER to boot or TAB to edit a menu entry
default debian-edu/vesamenu.c32
prompt 0
timeout 0
EOF
) > $defaultfile

# Use the complete menu by default
pxecfgdir=$tftpdir/pxelinux.cfg
[ -d  $pxecfgdir ] || mkdir $pxecfgdir
ln -sf ../debian-edu/default-menu.cfg $pxecfgdir/default