Package: rpcbind
Version: 0.2.0-8.1
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu saucy ubuntu-patch
Dear maintainers,
Now that jessie is open, I am hoping to get support for native upstart
booting into Debian. Please find attached a patch that brings upstart jobs
for the rpcbind package from Ubuntu.
These are slightly different than the upstart jobs currently shipped in
Ubuntu; the Ubuntu rpcbind package ships a 'portmap' job for compatibility
with older Ubuntu releases, and this patch provides an 'rpcbind' job
instead. I'm taking the opportunity to clean this up as part of submitting
this to Debian.
This debdiff also includes a patch to the upstream source to reference
rpcbind.sock and rpcbind.lock directly via /run instead of via /var/run.
This simplifies boot-time ordering with respect to /var as a separate mount
point and preserves the ability to use NFS mounts for /var.
Thanks for considering the patch. If you would like, I'd be happy to NMU
this change (along with a fix for the rpcbind side of bug #623377).
--
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/
[email protected] [email protected]
=== modified file 'debian/control'
--- debian/control 2012-06-16 00:02:37 +0000
+++ debian/control 2013-08-10 23:11:06 +0000
@@ -9,7 +9,7 @@
Package: rpcbind
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 3.2-14), insserv (>= 1.14.0-2.1) | file-rc, initscripts (>= 2.88dsf-13.3)
+Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 4.1+Debian3), insserv (>= 1.14.0-2.1) | file-rc, initscripts (>= 2.88dsf-13.3)
Conflicts: portmap
Provides: portmap
Description: converts RPC program numbers into universal addresses
=== modified file 'debian/init.d'
--- debian/init.d 2012-06-16 00:02:37 +0000
+++ debian/init.d 2013-08-10 22:28:30 +0000
@@ -78,12 +78,21 @@
case "$1" in
start)
+ if init_is_upstart; then
+ exit 1
+ fi
start $OPTIONS
;;
stop)
+ if init_is_upstart; then
+ exit 0
+ fi
stop
;;
restart|force-reload)
+ if init_is_upstart; then
+ exit 1
+ fi
stop
start $OPTIONS
;;
=== added file 'debian/patches/run-migration'
--- debian/patches/run-migration 1970-01-01 00:00:00 +0000
+++ debian/patches/run-migration 2013-08-10 21:22:57 +0000
@@ -0,0 +1,44 @@
+Author: Steve Langasek <[email protected]>
+Description: Fix to look directly in /run instead of via the /var/run symlink
+ Because /var may be a separate partition, and could even be mounted via NFS,
+ and in wheezy and later /var/run is a symlink to /run, look up our files in
+ /run directly. This ensures rpcbind can be started early in boot without
+ any races.
+Index: oneiric/src/rpcbind.c
+===================================================================
+--- oneiric.orig/src/rpcbind.c
++++ oneiric/src/rpcbind.c
+@@ -89,7 +89,14 @@
+ /* who to suid to if -s is given */
+ #define RUN_AS "daemon"
+
+-#define RPCBINDDLOCK "/var/run/rpcbind.lock"
++#define RPCBINDDLOCK "/run/rpcbind.lock"
++
++/* Bypass the libtirpc definition, because we know that /var/run is a compat
++ * symlink to /run. */
++#ifdef _PATH_RPCBINDSOCK
++#undef _PATH_RPCBINDSOCK
++#endif
++#define _PATH_RPCBINDSOCK "/run/rpcbind.sock"
+
+ int runasdaemon = 0;
+ int insecure = 0;
+Index: oneiric/src/rpcinfo.c
+===================================================================
+--- oneiric.orig/src/rpcinfo.c
++++ oneiric/src/rpcinfo.c
+@@ -75,6 +75,13 @@
+ #define MAX_VERS ((u_long)4294967295UL)
+ #define UNKNOWN "unknown"
+
++/* Bypass the libtirpc definition, because we know that /var/run is a compat
++ * symlink to /run. */
++#ifdef _PATH_RPCBINDSOCK
++#undef _PATH_RPCBINDSOCK
++#endif
++#define _PATH_RPCBINDSOCK "/run/rpcbind.sock"
++
+ /*
+ * Functions to be performed.
+ */
=== modified file 'debian/patches/series'
--- debian/patches/series 2011-12-10 11:36:35 +0000
+++ debian/patches/series 2013-08-10 21:18:15 +0000
@@ -2,3 +2,4 @@
02-manpages.patch
03-563971-warmstart-error-msg.patch
04-610718-non-linux.patch
+run-migration
=== added file 'debian/rpcbind.portmap-wait.upstart'
--- debian/rpcbind.portmap-wait.upstart 1970-01-01 00:00:00 +0000
+++ debian/rpcbind.portmap-wait.upstart 2013-08-10 22:27:10 +0000
@@ -0,0 +1,28 @@
+# portmap-wait
+# Note that this is called portmap-wait rather than rpcbind-wait because
+# other packages rely on the portmap-wait name.
+
+description "Start this job to wait until rpcbind is started or fails to start"
+author "Clint Byrum <[email protected]>"
+
+stop on started rpcbind or stopped rpcbind
+
+# Needed to make starting the job successful despite being killed
+normal exit 2
+task
+
+# We know that we have more than one job that needs to wait for rpcbind and
+# will make use of this service, so we need to instantiate.
+instance $WAITER
+
+script
+
+ status rpcbind | grep -q "start/running" && exit 0
+
+ start rpcbind ON_BOOT=y || true
+
+ # Waiting forever is ok.. upstart will kill this job when
+ # the rpcbind we tried to start above either starts or stops
+ while sleep 3600; do :; done
+
+end script
=== added file 'debian/rpcbind.rpcbind-boot.upstart'
--- debian/rpcbind.rpcbind-boot.upstart 1970-01-01 00:00:00 +0000
+++ debian/rpcbind.rpcbind-boot.upstart 2013-08-10 21:18:15 +0000
@@ -0,0 +1,10 @@
+# portmap-boot
+
+description "Upstart job to start rpcbind on boot only"
+author "Clint Byrum"
+
+start on virtual-filesystems and net-device-up IFACE=lo
+
+task
+
+exec initctl emit --no-wait start-rpcbind ON_BOOT=y
=== added file 'debian/rpcbind.upstart'
--- debian/rpcbind.upstart 1970-01-01 00:00:00 +0000
+++ debian/rpcbind.upstart 2013-08-10 21:25:49 +0000
@@ -0,0 +1,38 @@
+# rpcbind - RPC portmapper replacement
+
+# rpcbind is a server that converts RPC (Remote Procedure Call) program
+# numbers into DARPA protocol port numbers. It must be running in order
+# to make RPC calls.
+
+# Note that this is called portmap rather than rpcbind because other
+# packages rely on the portmap name.
+
+description "RPC portmapper replacement"
+author "Colin Watson <[email protected]>"
+
+start on start-rpcbind
+stop on unmounted-remote-filesystems
+
+# ON_BOOT is set on start-rpcbind in rpcbind-boot.conf
+# Used by statd which must not start on started portmap during boot
+export ON_BOOT
+env ON_BOOT=
+
+expect fork
+respawn
+
+pre-start exec mkdir -p /run/rpcbind
+
+script
+ OPTIONS="-w"
+ if [ -f /etc/default/rpcbind ]; then
+ . /etc/default/rpcbind
+ elif [ -f /etc/rpcbind.conf ]; then
+ . /etc/rpcbind.conf
+ fi
+ exec rpcbind $OPTIONS
+end script
+
+# For compatibility with older upstart jobs in Ubuntu
+post-start exec initctl emit --no-wait started portmap ON_BOOT=$ON_BOOT
+pre-stop exec initctl emit --no-wait stopping portmap
=== modified file 'debian/rules'
--- debian/rules 2012-06-16 00:02:37 +0000
+++ debian/rules 2013-08-10 23:10:19 +0000
@@ -72,7 +72,9 @@
dh_installdocs
dh_installexamples
dh_installman man/rpcinfo.7
- dh_installinit -- start 43 S 2 3 4 5 . start 32 0 6 . stop 81 1 .
+ dh_installinit --no-start --name rpcbind-boot
+ dh_installinit --no-start --name portmap-wait
+ dh_installinit
dh_link
dh_strip
dh_compress