[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Release update



In article <[🔎] 1080656620.663.10.camel@barney.ehbuehl.net>,
Joachim Breitner  <nomeata@debian.org> wrote:
>why two packages? A little bit of magic should do it: Service gets
>installed turned off, and whatever the administrator sets is respected -
>on upgrade, on logrotate, on boot.
>This would require some clarifications (is update-rc.d now for
>administrators or for package maintainers) and some common guidelines
>(some packages currently use /etc/defaults/something, some use the
>symlinks in /etc/rc?.d directly, others have something set in
>/etc/init.d/something or use some magic, like checking for a line in
>/etc/inetd.conf).
>
>Ideally, all network daemons, from the administrator POV:
> * are installed disabled
> * may be started temporarily (/etc/init.d/package start)
>   - then being logrotated, restarted on upgrade, but no start on boot
> * may be started permanently (perhaps symlinking in /etc/rc?.d)
>   - logrotated, restarted on upgrade, restarted on boot
> * may then be temporarily disabled (/etc/init.d/package stop)
>   - no logrotate restart, no start on upgrade, but start on boot.
>
>That is, for each service we have two states ( (not)running generally
>and (not)running right now) which should both be off on installation and
>never be changed by upgrades or cronjobs.
>
>Questions to be solved: how to implement, what interface for package
>maintainers, what interface for administrators

Implementation is easy.. Set "AUTORUN" to "True" or "False" in
/etc/default/sshd. Then:

AUTORUN=True
[ ! -f /etc/default/sshd ] || . /etc/default/sshd

case "${0##*/}" in
	S*)
		case "$AUTORUN" in
			[YyTt]*)
				;;
			*)
				exit 0
				;;
		esac
		;;
esac

That's all. The only thing is that file-rc must be changed to start
the init.d scripts with SnnNAME or KnnNAME instead of just NAME.
Sysvinit already does this because it executes the symlink to
the script, so you can test $0.

Restart should only be done if the service is currently running.
That's hard when upgrading: if you stop the package in preinst
and want to start it in postinst, you have to remember the
"is running" state somewhere. It would be better than the
current invoke-rc.d though, which might not restart a service
that was running, or might start a service that wasn't.

Perhaps two new arguments to an initscript: "suspend" which would
stop the service if it was running and save the running state
to /var/run/running/packagename, and "resume" which would be
like "start" but only if /var/run/running/packagename is
present.

Invoke-rc.d would have to be modified to try "suspend" first,
and fall back to the normal "stop if normally running in this
runlevel" behaviour if it didn't work.

Hmm, "suspend" and "resume" are perhaps not the best names in the
world for this because of their association with powersave mode.

Mike.
-- 
Netu, v qba'g yvxr gur cynvagrkg :)



Reply to: