ports/162049: The Ports tree lacks a framework to restart
services
Stefan Ehmann
shoesoft at gmx.net
Thu Oct 27 15:59:46 UTC 2011
On Thursday, October 27, 2011 11:15:00 AM Ed Schouten wrote:
> Hi folks,
>
> As crees@ suggested, I'm sending an email to ports@ about this.
>
> What really bothers me when I use the FreeBSD Ports tree on one of my
> systems, is that the behaviour of dealing with services is quite
> inconsistent. As mentioned in the PR:
>
> - If I upgrade Apache, MySQL or PostgreSQL, it does not restart the
> service, meaning it won't use the freshly installed daemon. This has
> potential security issues.
>
> - If I upgrade Dovecot, it shuts it down during the upgrade, but won't
> restart it. This means that I have to watch portmaster to complete and
> must not forget to restart Dovecot afterwards.
>
> My question is whether anyone has ever attempted to improve the
> integration with rc-scripts? In the PR I propose something along these
> lines:
>
> We know exactly which ports install rc scripts (USE_RC_SUBR).
> Why not run `/usr/local/etc/rc.d/${FOO} status' and
> `/usr/local/etc/rc.d/${FOO} stop' prior to installation. Based
> on the return value of the first, we can run
> `/usr/local/etc/rc.d/${FOO} start' after installation.
portupgrade provides basic support for restarting services via pkgtools.conf:
BEFOREDEINSTALL = {
# Automatically stop the service for each package that has a
# rc script enabled
'*' => proc { |origin|
cmd_stop_rc(origin)
},
}
AFTERINSTALL = {
# Automatically start the server for each package that
# installs a rc file enabled
'*' => proc { |origin|
cmd_start_rc(origin)
},
}
Keeping a service running during/after upgrade is potentielly unsafe. E.g., it
might be looking for files that have just been removed or modified in an
incompatible way.
Keeping a service running after deletion (no reinstall) also seems like a
really bad idea to me.
More information about the freebsd-ports
mailing list