There are two common methods used by programs that depend on database
schema. One is probably best described as "YOLO", i.e. don't bother
checking anything, not ideal but it is very common. The other is to have a
schema version stored in the database and refuse to run if it's not as
expected.
There are plenty of things in ports that require schema updates from time
to time and I don't think there's a single one that stops running services etc.
--
Sent from a phone, apologies for poor formatting.
On 16 December 2018 13:23:09 Kristaps Dzonsons <[email protected]> wrote:
It's really not expected that a package runs something which changes
packaged files or their permissions.
Automatically running something which stops and starts daemons is
also not expected.
If we go by the letter of the install process, where we're supposed to
"stop/disable all appropriate applications" during upgrades, none of it
is necessary except that the database must be upgraded, which in the
case of slant means kwebapp-sqldiff passes an upgrade script into slant.db.
(I assume that stop/disable means to remove packages from
pkg_scripts before upgrading so they don't automatically start upon
booting and/or are running during pkg_add -u.)
However, this requires users to know that the httpd and slant services
must be temporarily disabled. As a user myself, I'd probably never do
that. I reboot into bsd.rd, do the stuff, then run pkg_add -u afterward.
In this case, slant-collectd/httpd will be running during pkg_add, and
the CGI script will also be runnable. So there's a period during which
the database schema and the collector/cgi script are out of sync.
To counter this, I install the cgi script with mode 0 so it won't be
run, then run an upgrade script which stops the slant service, if it's
running. It then upgrades the database, sets the cgi script mode, and
restart (conditionally) the slant service.
I'm not sure which is proper---please let me know and I can make the
changes!