Package: tftp-hpa
Version: 5.2-7
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu saucy ubuntu-patch

Hi Daniel,

In Ubuntu, the tftpd-hpa package has been enhanced with native support for
upstart.  In jessie, it is now possible to ship upstart jobs in Debian
packages alongside sysvinit scripts.  Please consider the attached patch to
tftpd-hpa, which will cause the service to be run as a native upstart job
when using upstart as init.

Thanks for considering the patch.
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
--- debian/control	2013-03-10 22:00:52 +0000
+++ debian/control	2013-05-19 05:32:33 +0000
@@ -21,7 +21,7 @@
 
 Package: tftpd-hpa
 Architecture: any
-Depends: ${misc:Depends}, ${shlibs:Depends}, adduser
+Depends: ${misc:Depends}, ${shlibs:Depends}, adduser, lsb-base (>= 4.1+Debian3)
 Conflicts: tftpd, atftpd
 Suggests: syslinux-common
 Description: HPA's tftp server

--- debian/tftpd-hpa.init	2011-02-20 00:18:01 +0000
+++ debian/tftpd-hpa.init	2013-05-19 00:10:15 +0000
@@ -70,18 +70,27 @@
 
 case "${1}" in
 	start)
+		if init_is_upstart; then
+			exit 1;
+		fi
 		log_daemon_msg "Starting ${DESC}" "${NAME}"
 		do_start
 		log_end_msg ${?}
 		;;
 
 	stop)
+		if init_is_upstart; then
+			exit 0;
+		fi
 		log_daemon_msg "Stopping ${DESC}" "${NAME}"
 		do_stop
 		log_end_msg ${?}
 		;;
 
 	restart|force-reload)
+		if init_is_upstart; then
+			exit 1;
+		fi
 		log_daemon_msg "Restarting ${DESC}" "${NAME}"
 		do_stop
 		sleep 1

--- debian/tftpd-hpa.upstart	1970-01-01 00:00:00 +0000
+++ debian/tftpd-hpa.upstart	2013-05-19 00:06:40 +0000
@@ -0,0 +1,28 @@
+# tftp-hpa - trivial ftp server
+
+description	"tftp-hpa server"
+author		"Chuck Short <zul...@ubuntu.com>"
+
+start on runlevel [2345]
+stop on runlevel [!2345]
+
+console output
+expect fork
+respawn
+
+env PIDFILE="/var/run/tftpd-hpa.pid"
+env DEFAULTS="/etc/default/tftpd-hpa"
+
+script
+
+	if [ -f ${DEFAULTS} ]; then
+		. ${DEFAULTS}
+	fi
+
+	if [ ! -d "${TFTP_DIRECTORY}" ]; then
+		echo "${TFTP_DIRECTORY} missing, aborting."
+		exit 1
+	fi
+
+	exec /usr/sbin/in.tftpd --listen  --user ${TFTP_USERNAME} --address ${TFTP_ADDRESS} ${TFTP_OPTIONS} ${TFTP_DIRECTORY}
+end script

Reply via email to