Comment 22 for bug 569757

Revision history for this message
Clint Byrum (clint-fewbar) wrote : Re: NIS upstart dependancy broken for lucid

Re: the linked branch, here is a quick review of things I'd suggest changing:

* I understand that the package doesn't use debhelper. But to repeat all of the hard work that has gone into dh_installinit would be asking for bugs later. So you'd also need to add debhelper to the build-depends. After that add a call to dh_installinit and the #DEBHELPER# tag to the end of postinst. Also if you do this, the files are named incorrectly. Rename *.conf to nis.*.upstart . This will trigger dh_installinit to do its magic. Then you can remove all of the lines that install the upstart files in /etc/init.

* start/stop/reload/restart $job in maintainer scripts is going to cause issues. You should at the very least use invoke-rc.d, per Debian Policy 9.3.3. Further, this is all handled by dh_installinit...

* the removal of the old /etc/init.d/nis may accidentally remove the user's local changes to said file, which is in fact a conffile and so must be handled delicately. dh_installinit handles this as well, as long as you don't pass --upstart-only, which you wouldn't as that is only for things that are upstart specific (like wait jobs).

* default env values can and should be set with env stanzas.. so instead of putting START_YPBIND="false" in the first lines of pre-start.. just put env START_YPBIND="false" in the upstart job. This is really just a nit.. as this just makes the job run a tiny bit faster (these variables are parsed out at job load time by upstart instead of by the shell).

* changelog target should be natty since we'll have to fix this there first.

* Given the previous discussions, each of these needs a wait job that is started and waited for by anything needing NIS. One easy way to get "most of the jobs out there" is by blocking runlevel 2. This would work:

# ypbind-wait
start on starting rc RUNLEVEL=2
stop on started ypbind or stopped ypbind

env WAITER=
instance $WAITER$UPSTART_EVENTS
task
normal ext 2

script
  ... normal wait job stuff

The instance argument allows anything that is started before runlevel 2 to block on ypbind as well by doing:

start ypbind-wait WAITER=autofs

This will work as a stop gap until we solve the issue more elegantly with exported variables and a generic waiter job.