--- pxe-1.4.2.orig/debian/postinst
+++ pxe-1.4.2/debian/postinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if ! id -u Debian-pxe 2>/dev/null >/dev/null
+then
+ adduser --system --no-create-home --disabled-login --force-badname \
+ --gecos "Dummy user for Debian pxe package" Debian-pxe
+fi
+
+#DEBHELPER#
--- pxe-1.4.2.orig/debian/manpages
+++ pxe-1.4.2/debian/manpages
@@ -0,0 +1 @@
+debian/manpage/*
--- pxe-1.4.2.orig/debian/copyright
+++ pxe-1.4.2/debian/copyright
@@ -0,0 +1,30 @@
+This package was debianized by Daniel Baumann <daniel@debian.org> on
+Mon, 22 Aug 2005 15:26:00 +0200.
+
+It was downloaded from <http://www.kano.org.uk/projects/pxe/>.
+
+Upstream Author: Tim Hurman <kano@kano.org.uk>
+
+License:
+
+ Copyright (C) 2000-2004 Tim Hurman <kano@kano.org.uk>
+
+ 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in /usr/share/common-licenses/GPL file.
+
+The Debian packaging is (C) 2005-2007, Daniel Baumann <daniel@debian.org> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
--- pxe-1.4.2.orig/debian/docs
+++ pxe-1.4.2/debian/docs
@@ -0,0 +1,2 @@
+README
+THANKS
--- pxe-1.4.2.orig/debian/README.Debian
+++ pxe-1.4.2/debian/README.Debian
@@ -0,0 +1,17 @@
+pxe for Debian
+--------------
+
+This is the Debian package of pxe, a free implementation of a PXE daemon. You
+have probably installed it because you want to netboot a PC and saw PXE
+mentioned in the output from your network card's boot PROM. There are a number
+of things you need to know:
+
+ 1. pxe is not sufficient for a PXE boot. The PXE boot sequence consists of a
+ number of steps, but only one of them is handled by the daemon provided in
+ this package.
+
+ 2. pxe may not be necessary for a PXE boot. Ironically, some PXE
+ implementations skip the very step that is handled by the pxe daemon.
+ Therefore, you may even be able to netboot without this package.
+
+ -- Jens Schmalzing <jensen@debian.org> Sun, 21 Mar 2004 10:13:34 +0100
--- pxe-1.4.2.orig/debian/manpage/pxe.8
+++ pxe-1.4.2/debian/manpage/pxe.8
@@ -0,0 +1,23 @@
+.T PXE 8 "2006-06-30" "1.4.2" "PXE daemon"
+
+.SH NAME
+pxe \- a free PXE daemon
+
+.SH SYNOPSIS
+.B pxe
+
+.SH DESCRIPTION
+.B PXE
+is a specification to boot PCs from the net. Apart from BOOTP or DHCP for
+acquiring an IP address and TFTP for transferring files, it requires a PXE
+daemon on the server which implements the boot loader selection.
+
+.SH OPTIONS
+.B PXE
+has no options, but a configuration file in /etc/pxe.conf.
+
+.SH AUTHOR
+PXE was written by Tim Hurman <kano@kano.org.uk>.
+.PP
+This manual page was written by Jens Schmalzing <jensen@debian.org>, for the
+Debian project (but may be used by others).
--- pxe-1.4.2.orig/debian/changelog
+++ pxe-1.4.2/debian/changelog
@@ -0,0 +1,101 @@
+pxe (1.4.2-7) unstable; urgency=low
+
+ * New maintainer (Closes: #407907)
+
+ -- Herve Rousseau <herve@moulticast.net> Wed, 28 Feb 2007 22:44:20 +0100
+
+pxe (1.4.2-6) unstable; urgency=low
+
+ * Orphaning package.
+ * Minor cleanups.
+ * Added lsb section to init.d.
+
+ -- Daniel Baumann <daniel@debian.org> Mon, 22 Jan 2007 11:10:00 +0100
+
+pxe (1.4.2-5) unstable; urgency=medium
+
+ * New email address.
+ * Splittet out pidfile modifications from 03-gcc4.dpatch to 03-pidfile.dpatch.
+ * Adapted patch from Lars Wirzenius <liw@iki.fi> for unstable:
+ - debian/postinst: Created. In addition to the usual stuff added by
+ debhelper, we now create a Debian-pxe user.
+ - debian/prerm: Created. Handle a failed upgrade from a previous version by
+ manually killing the daemon and removing the pid file.
+ - debian/postrm: Remove /var/run/pxe, /var/run/pxe/pxe.pid, and
+ /var/run/pxe.pid.
+ - debian/init.d: Create /var/run/pxe before starting the daemon, and chown
+ it to the Debian-pxe user. Also, wait for the pid file to disappear when
+ stopping (or restarting), instead of blindly assuming that one second is
+ enough. Further, allow start-stop-daemon to not do anything (--oknodo)
+ when doing "start", "stop", or the stopping part of "restart".
+ - Closes: #376501.
+
+ -- Daniel Baumann <daniel@debian.org> Tue, 15 Aug 2006 12:18:00 +0200
+
+pxe (1.4.2-4) unstable; urgency=low
+
+ * Updated recommends (Closes: #375957).
+ * Using dpatch for upstream modifications now.
+ * Rewritten dummy manpages, removed copy for pxe.conf, storing them as
+ manpages now instead of sgml files.
+
+ -- Daniel Baumann <daniel.baumann@panthera-systems.net> Fri, 30 Jun 2006 11:57:00 +0200
+
+pxe (1.4.2-3) unstable; urgency=low
+
+ * pxe.cc: Added patch to fix segfaulting (Closes: #330851).
+
+ -- Daniel Baumann <daniel.baumann@panthera-systems.net> Thu, 3 Nov 2005 23:06:00 +0100
+
+pxe (1.4.2-2) unstable; urgency=low
+
+ * New maintainer (Closes: #323476).
+ * Bumped policy version.
+ * Formal cleanup, watch file added.
+
+ -- Daniel Baumann <daniel.baumann@panthera-systems.net> Mon, 22 Aug 2005 15:26:00 +0200
+
+pxe (1.4.2-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Jens Schmalzing <jensen@debian.org> Thu, 29 Jul 2004 11:04:16 +0200
+
+pxe (1.4.1-1) unstable; urgency=low
+
+ * New upstream release.
+
+ * Added a pointer to the upstream author's site (closes: Bug#235758) and
+ a few explanatory notes in README.Debian.
+
+ -- Jens Schmalzing <jensen@debian.org> Sun, 21 Mar 2004 09:54:55 +0100
+
+pxe (1.4-4) unstable; urgency=high
+
+ * Cleaned out a test path in the init.d script.
+
+ -- Jens Schmalzing <jensen@debian.org> Wed, 25 Feb 2004 12:35:22 +0100
+
+pxe (1.4-3) unstable; urgency=high
+
+ * Moved pidfile to appropriate directory /var/run.
+
+ * Moved logfile to appropriate directory /var/log.
+
+ -- Jens Schmalzing <jensen@debian.org> Wed, 25 Feb 2004 10:57:02 +0100
+
+pxe (1.4-2) unstable; urgency=low
+
+ * Wrote manpages for pxe and pxe.conf (closes: Bug#220456).
+
+ * Corrected the section in debian/control (closes: Bug#226598).
+
+ * Added a startup script.
+
+ -- Jens Schmalzing <jensen@debian.org> Sat, 24 Jan 2004 15:53:59 +0100
+
+pxe (1.4-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Jens Schmalzing <jensen@debian.org> Wed, 5 Nov 2003 07:21:43 +0100
--- pxe-1.4.2.orig/debian/init.d
+++ pxe-1.4.2/debian/init.d
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides: pxe
+# Required-Start: $network
+# Required-Stop: $network
+# Should-Start:
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: starts pxe
+# Description: PXE is a specification to boot PCs from the net.
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/pxe
+NAME=pxe
+DESC=pxe
+PID=/var/run/$NAME/$NAME.pid
+
+create_pid_dir()
+{
+ dir=$(dirname "$PID")
+ if [ ! -d "$dir" ]
+ then
+ mkdir "$dir"
+ fi
+ chown Debian-pxe "$dir"
+}
+
+wait_no_pid()
+{
+ while [ -e "$PID" ]
+ do
+ sleep 1
+ done
+}
+
+test -x $DAEMON || exit 0
+
+set -e
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: "
+ create_pid_dir
+ start-stop-daemon --start --quiet --pidfile $PID \
+ --oknodo --exec $DAEMON
+ echo "$NAME."
+ ;;
+
+ stop)
+ echo -n "Stopping $DESC: "
+ start-stop-daemon --stop --quiet --pidfile $PID \
+ --oknodo --exec $DAEMON
+ wait_no_pid
+ echo "$NAME."
+ ;;
+
+ restart|force-reload)
+ echo -n "Restarting $DESC: "
+ start-stop-daemon --stop --quiet --pidfile $PID \
+ --oknodo --exec $DAEMON
+ wait_no_pid
+ start-stop-daemon --start --quiet --pidfile $PID \
+ --exec $DAEMON
+ echo "$NAME."
+ ;;
+
+ *)
+ N=/etc/init.d/$NAME
+ echo "Usage: $N {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
--- pxe-1.4.2.orig/debian/prerm
+++ pxe-1.4.2/debian/prerm
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = failed-upgrade ]
+then
+ # The old version's prerm failed to work. This may be due to
+ # http://bugs.debian.org/376501 so we try to kill the daemon
+ # by hand here.
+ if [ -e /var/run/pxe.pid ]
+ then
+ kill -s KILL `cat /var/run/pxe.pid` || true
+ rm -f /var/run/pxe.pid
+ exit 0
+ fi
+fi
+
+#DEBHELPER#
--- pxe-1.4.2.orig/debian/rules
+++ pxe-1.4.2/debian/rules
@@ -0,0 +1,83 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+include /usr/share/dpatch/dpatch.make
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+config.status: patch-stamp configure
+ dh_testdir
+
+ # Configuring package
+ CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --with-log=/var/log/pxe.log --with-setuid=Debian-pxe
+
+build: build-stamp
+build-stamp: config.status
+ dh_testdir
+
+ # Building package
+ $(MAKE)
+
+ touch build-stamp
+
+clean: unpatch
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Cleaning package
+ -$(MAKE) distclean
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+ cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+ cp -f /usr/share/misc/config.guess config.guess
+endif
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Installing package
+ install -D -m 0755 pxe debian/pxe/usr/sbin/pxe
+ install -D -m 0644 pxe.conf debian/pxe/etc/pxe.conf
+
+binary-indep: build install
+
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs Changes
+ dh_installdocs
+ dh_install
+ dh_installinit
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- pxe-1.4.2.orig/debian/compat
+++ pxe-1.4.2/debian/compat
@@ -0,0 +1 @@
+5
--- pxe-1.4.2.orig/debian/watch
+++ pxe-1.4.2/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://www.kano.org.uk/projects/pxe/pxe-(.*)\.tar\.gz
--- pxe-1.4.2.orig/debian/control
+++ pxe-1.4.2/debian/control
@@ -0,0 +1,18 @@
+Source: pxe
+Section: net
+Priority: optional
+Maintainer: Herve Rousseau <herve@moulticast.net>
+Build-Depends: debhelper (>= 5), dpatch
+Standards-Version: 3.7.2
+
+Package: pxe
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
+Recommends: dhcp3-server | dnsmasq, syslinux, tftpd-hpa | atftpd
+Description: free PXE daemon
+ PXE is a specification to boot PCs from the net. Apart from BOOTP or DHCP for
+ acquiring an IP address and TFTP for transferring files, it requires a PXE
+ daemon on the server. This package provides only this daemon. For the other
+ protocols, it recommends alternatives that are known to work.
+ .
+ Homepage: <http://www.kano.org.uk/projects/pxe/>
--- pxe-1.4.2.orig/debian/postrm
+++ pxe-1.4.2/debian/postrm
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
+
+rm -f /var/run/pxe/pxe.pid /var/run/pxe.pid
+if [ -d /var/run/pxe ]; then rmdir /var/run/pxe; fi
--- pxe-1.4.2.orig/debian/patches/01-logfile.dpatch
+++ pxe-1.4.2/debian/patches/01-logfile.dpatch
@@ -0,0 +1,19 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+## 01-logfile.dpatch by Jens Schmalzing <jensen@debian.org>
+##
+## DP: Adjusts permission of the logfile.
+
+@DPATCH@
+
+diff -Naur pxe-1.4.2.orig/logfile.cc pxe-1.4.2/logfile.cc
+--- pxe-1.4.2.orig/logfile.cc 2003-02-02 12:33:32.000000000 +0000
++++ pxe-1.4.2/logfile.cc 2006-06-30 10:07:43.000000000 +0000
+@@ -57,7 +57,7 @@
+ LogFile::Open(const char *filename)
+ {
+ /* open the file */
+- umask(077);
++ umask(022);
+ logfile = new std::fstream(filename, std::ios::out|std::ios::app);
+ if(logfile == NULL)
+ {
--- pxe-1.4.2.orig/debian/patches/00list
+++ pxe-1.4.2/debian/patches/00list
@@ -0,0 +1,4 @@
+01-logfile
+02-lockfile
+03-pidfile
+04-gcc4
--- pxe-1.4.2.orig/debian/patches/02-lockfile.dpatch
+++ pxe-1.4.2/debian/patches/02-lockfile.dpatch
@@ -0,0 +1,31 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+## 02-lockfile.dpatch by Jens Schmalzing <jensen@debian.org>
+##
+## DP: Adjusts location and content of the lockfile.
+
+@DPATCH@
+
+diff -Naur pxe-1.4.2.orig/autoconf.h.in pxe-1.4.2/autoconf.h.in
+--- pxe-1.4.2.orig/autoconf.h.in 2002-08-22 18:06:11.000000000 +0000
++++ pxe-1.4.2/autoconf.h.in 2006-07-22 19:50:33.000000000 +0000
+@@ -61,7 +61,7 @@
+ /* should not need to change from here onwards */
+
+ /* the lock file */
+-#define LOCKFILE "/tmp/pxe.pid"
++#define LOCKFILE "/var/run/pxe/pxe.pid"
+
+ #define DEF_MULTI_BOOT 0xe0000102
+ #define DEF_ADDR "0.0.0.0"
+diff -Naur pxe-1.4.2.orig/pxe.cc pxe-1.4.2/pxe.cc
+--- pxe-1.4.2.orig/pxe.cc 2003-02-02 12:39:26.000000000 +0000
++++ pxe-1.4.2/pxe.cc 2006-07-22 19:50:33.000000000 +0000
+@@ -312,7 +312,7 @@
+ umask(0);
+
+ // write out the pid
+- sprintf(pidnum, "%ld", (long)getpid());
++ sprintf(pidnum, "%ld\n", (long)getpid());
+ if(write(chk, pidnum, strlen(pidnum)) !=
+ (ssize_t)strlen(pidnum)) {
+ std::cerr << "Unable to write lockfile\n";
--- pxe-1.4.2.orig/debian/patches/03-pidfile.dpatch
+++ pxe-1.4.2/debian/patches/03-pidfile.dpatch
@@ -0,0 +1,56 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+## 03-pidfile.dpatch
+
+@DPATCH@
+
+diff -Naur pxe-1.4.2.BAR/pxe.cc pxe-1.4.2.FOO/pxe.cc
+--- pxe-1.4.2.BAR/pxe.cc 2006-08-15 10:12:25.000000000 +0000
++++ pxe-1.4.2.FOO/pxe.cc 2006-08-15 10:10:51.000000000 +0000
+@@ -214,7 +214,7 @@
+ ******************************************************************************/
+ int main(int argc, char **argv)
+ {
+- int chk;
++ int chk,log;
+ char pidnum[8];
+ int _debug, c, errflg;
+ const char *configfile=PXECONFIGFILE;
+@@ -258,6 +258,13 @@
+ debug.close();
+ }
+
++ // check to see if the daemon is already running
++ chk = open(LOCKFILE, O_WRONLY|O_CREAT|O_EXCL, 0666);
++ if(-1 == chk)
++ {
++ std::cerr << "PXE daemon already running\n";
++ return(-1);
++ }
+
+ // set the UID/GID to a low user
+ #ifndef NO_SUID
+@@ -269,6 +276,9 @@
+ << ", continuing with user id " << getuid() << "\n";
+ else
+ {
++ if(log=open(PXELOGFILE, O_CREAT, 0666)) close(log);
++ if(chown(PXELOGFILE,pw->pw_uid,pw->pw_gid)<0)
++ std::cout << "Unable to acquire logfile " << PXELOGFILE << "\n";
+ if((-1 == setgid(pw->pw_gid)) || (-1 == setegid(pw->pw_gid)))
+ std::cout << "Unable to change group id, continuing with group id "
+ << getgid() << "\n";
+@@ -278,14 +288,6 @@
+ }
+ #endif
+
+- // check to see if the daemon is already running
+- chk = open(LOCKFILE, O_WRONLY|O_CREAT|O_EXCL, 0644);
+- if(-1 == chk)
+- {
+- std::cerr << "PXE daemon already running\n";
+- return(-1);
+- }
+-
+ // if not in debug mode, fork and go
+ if (0 == _debug) {
+ signal(SIGCHLD, SIG_IGN);
--- pxe-1.4.2.orig/debian/patches/04-gcc4.dpatch
+++ pxe-1.4.2/debian/patches/04-gcc4.dpatch
@@ -0,0 +1,26 @@
+#!/bin/sh /usr/share/dpatch/dpatch-run
+## 04-gcc4.dpatch by Alexandre Francois <alexandre-francois@voila.fr>.
+##
+## DP: Fixes segfault with GCC 4.x (Closes: #330851).
+
+@DPATCH@
+
+diff -Naur pxe-1.4.2.orig/pxe.cc pxe-1.4.2/pxe.cc
+--- pxe-1.4.2.orig/pxe.cc 2006-08-15 10:49:17.000000000 +0000
++++ pxe-1.4.2/pxe.cc 2006-08-15 10:48:33.000000000 +0000
+@@ -263,7 +263,7 @@
+ if(-1 == chk)
+ {
+ std::cerr << "PXE daemon already running\n";
+- return(-1);
++ exit(-1);
+ }
+
+ // set the UID/GID to a low user
+@@ -333,5 +333,5 @@
+ StartPxeService(configfile);
+ }
+
+- return(0);
++ exit(0);
+ }