Bug 238307

Summary: irc/quassel: Add REQUIRES for postgresql to start script if specified
Product: Ports & Packages Reporter: Larry Rosenman <ler>
Component: Individual Port(s)Assignee: Ben Woods <woodsb02>
Status: Open ---    
Severity: Affects Some People CC: girgen, koobs
Priority: --- Flags: bugzilla: maintainer-feedback? (woodsb02)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch to add Requires. none

Description Larry Rosenman freebsd_committer 2019-06-03 10:58:17 UTC
Created attachment 204800 [details]
Patch to add Requires.

Add a REQUIRES for postgresql if PostgreSQL is selected.  This prevents quasselcore from starting before PostgreSQL is ready.
Comment 1 Larry Rosenman freebsd_committer 2019-06-03 11:33:44 UTC
I guess technically PostgreSQL could be on a different server.  But I'd like a way to have this show up somehow in the start script if the user has PostgreSQL on the same server and using PostgreSQL for the quassel database.
Comment 2 Larry Rosenman freebsd_committer 2019-06-03 11:43:27 UTC
Also, the BUGS section of rcorder(8) is "interesting" in this context.  I'm not sure what the right answer is here.  koobs@ and I have been discussing this on IRC, but didn't come to a conclusion.
Comment 3 Ben Woods freebsd_committer 2019-08-18 14:32:26 UTC
Hi Larry,

Thanks for submitting this.

The other issue I can think of with this, is if a user has enabled the PGSQL option at compile time, but is not using it (is using sqlite). Will this prevent the quasselcore server from starting because postgresql is not started?

I note that the PGSQL option only adds a dependency on postgresql95-client (the server is not installed as a dependency).

What options do we have available to us to configure rcorder to "if postgresql server is installed then start quasselcore after postgresql, or otherwise just start quasselcore regardless"?
Comment 4 Palle Girgensohn freebsd_committer 2020-09-23 08:45:37 UTC
(In reply to Ben Woods from comment #3)

Hi,

The idea with postgresql clients is that there's no way of knowing if the postgresql server is running on the same machine as the client. It is very common that the database cluster is running on a separate system from the client.

With that said, I'm not sure, but doesnt't REQUIRE only kick in if the required service is actually enabled? the REQUIRE just sets the rcorder, it does not really require the service per se. This can easily be checked.

Also, the patch seems to not really do the trick:

%%NO_PGSQL%%# REQUIRE: LOGIN
%%PGSQL%%# REQUIRE: LOGIN postgresql


rather sometthing like

# REQUIRE: LOGIN %%REQUIRE_POSTGRESQL%%

and setting the REQUIRE_POSTGRESQL substitute variable in the Makefile, in that case?
Comment 5 Ben Woods freebsd_committer 2020-09-23 23:08:22 UTC
(In reply to Palle Girgensohn from comment #4)
> doesn't REQUIRE only kick in if the required service is actually enabled?
> the REQUIRE just sets the rcorder, it does not really require the service per se.

If that’s correct, then I think you have solved this one for us. Have you got a few minutes to test this?


> # REQUIRE: LOGIN %%REQUIRE_POSTGRESQL%%

That looks much cleaner.

I feel like this is something that should be added to one of the handbooks, to describe how to do this. Probably here:
https://www.freebsd.org/doc/en/books/porters-handbook/rc-scripts.html