== How to convert to metainit ==

(Without using dh_metainit)
 * Write the Metainit file. You can find examples in /usr/share/doc/metainit/examples
 * Make the package with the init script depend on metainit
   (If you require a feature that was introduced later, make the Depends versioned)
 * Make sure your package installs the metainit file to /etc/metainit.
 * Make sure your packge does not install any file to init.d.
 * Add code compareable to the following to your postinst script:
===================================================================
/usr/sbin/update-metainit  >/dev/null
if [ -x "/etc/init.d/infon-server" ]; then

        if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
                invoke-rc.d infon-server start || exit $?
        else
		if [ -x /etc/init.d/infon-server ]; then
	                /etc/init.d/infon-server start || exit $?
		fi
        fi
fi
===================================================================
 * Add code compareable to the following to your prerm script:
===================================================================
if [ -x "/etc/init.d/infon-server" ]; then
	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
		invoke-rc.d infon-server stop || exit $?
	else
                /etc/init.d/infon-server stop || exit $?
	fi
fi
===================================================================
 * Add code compareable to the following to your postrm script:
===================================================================
if [ "$1" = "purge" -a -x /usr/sbin/update-metainit ] ; then
        /usr/sbin/update-metainit --remove infon-server --purge >/dev/null
fi
===================================================================

That should work. Of course, it’s easier to use dh_metainit: Then you just write the metainit file, add the dependency and dh_metainit will take care of the rest.
