#!/bin/sh

set -e

if [ "$1" = configure ] ; then
	# /run transition (see #633035)
	if dpkg --compare-versions "$2" lt "0.2.0-7"; then
		if [ -f /lib/init/rw/sendsigs.omit.d/rpcbind ]; then
			mv /lib/init/rw/sendsigs.omit.d/rpcbind /run/rpcbind.pid
			ln -s /run/rpcbind.pid /run/sendsigs.omit.d/rpcbind
		fi
	fi
	if dpkg --compare-versions "$2" lt "0.2.0-8.1"; then
		update-rc.d -f rpcbind remove
	fi
fi

# Automatically added by dh_installinit
if [ -x "/etc/init.d/rpcbind-boot" ]; then
	update-rc.d rpcbind-boot defaults >/dev/null || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/portmap-wait" ]; then
	update-rc.d portmap-wait defaults >/dev/null || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/rpcbind" ]; then
	update-rc.d rpcbind defaults >/dev/null
	invoke-rc.d rpcbind start || exit $?
fi
# End automatically added section

