Control: tags -1 patch

Hi Daniel,

On Wed, May 22, 2013 at 10:55:34PM +0200, Daniel Baumann wrote:
> tag 708851 moreinfo
> tag 708851 - patch
> retitle please add upstart script
> thanks

> On 05/22/2013 10:49 PM, Daniel Baumann wrote:
> > i've commited a proper version of above, and added the
> > upstart job unchanged.

> actually, no. first, it's not following the coding style of the rest of
> the package, and second, it doesn't come with the sanity checks that the
> sysvinit script does in do_start(), so the upstart script and the
> sysvinit script are not equal feature wise, so i'll not add it.

> please prepare an updated upstart script.

Ok - yes, I see the differences now; I'm guessing this is probably because
the upstart job was written a while ago and was not kept up to date with
respect to the init script.

I've updated the upstart job in Ubuntu and attached an updated patch.  Does
this address your concerns?  I'm not sure what you're referring to here wrt
coding style - if there are still style problems with this patch, could you
please clarify what they are?

Thanks,
-- 
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
=== modified file 'debian/control'
--- a/debian/control	2013-03-10 22:00:52 +0000
+++ b/debian/control	2013-06-01 01:54:40 +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

=== modified file 'debian/tftpd-hpa.init'
--- a/debian/tftpd-hpa.init	2011-02-20 00:18:01 +0000
+++ b/debian/tftpd-hpa.init	2013-06-01 01:55:33 +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

=== added file 'debian/tftpd-hpa.upstart'
--- a/debian/tftpd-hpa.upstart	1970-01-01 00:00:00 +0000
+++ b/debian/tftpd-hpa.upstart	2013-06-01 01:56:17 +0000
@@ -0,0 +1,50 @@
+# tftp-hpa - trivial ftp server
+
+description	"tftp-hpa server"
+author		"Chuck Short <zul...@ubuntu.com>"
+
+start on runlevel [2345]
+stop on runlevel [!2345]
+
+expect fork
+respawn
+
+env PIDFILE="/var/run/tftpd-hpa.pid"
+env DEFAULTS="/etc/default/tftpd-hpa"
+
+pre-start script
+	if [ -f ${DEFAULTS} ]; then
+		. ${DEFAULTS}
+	fi
+
+	# Ensure --secure and multiple server directories are not used at the
+	# same time
+	if [ "$(echo ${TFTP_DIRECTORY} | wc -w)" -ge 2 ] && \
+	   echo ${TFTP_OPTIONS} | grep -qs secure
+	then
+		echo
+		echo "When --secure is specified, exactly one directory can be specified."
+		echo "Please correct your /etc/default/tftpd-hpa."
+		stop
+		exit 0
+	fi
+
+	# Ensure server directories are existing
+	for _DIRECTORY in ${TFTP_DIRECTORY}
+	do
+		if [ ! -d "${_DIRECTORY}" ]
+		then
+			echo "${_DIRECTORY} missing, aborting."
+			stop
+			exit 0
+		fi
+	done
+
+end script
+
+script
+	if [ -f ${DEFAULTS} ]; then
+		. ${DEFAULTS}
+	fi
+	exec /usr/sbin/in.tftpd --listen  --user ${TFTP_USERNAME} --address ${TFTP_ADDRESS} ${TFTP_OPTIONS} ${TFTP_DIRECTORY}
+end script

Attachment: signature.asc
Description: Digital signature

Reply via email to