Bug 219734 - mail/rspamd: respect user/group on upgrade
Summary: mail/rspamd: respect user/group on upgrade
Status: Closed Not Accepted
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Vsevolod Stakhov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-02 18:54 UTC by Peter Putzer
Modified: 2018-08-20 04:41 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (vsevolod)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Putzer 2017-06-02 18:54:19 UTC
The port should not change the user and group of /var/log/rspamd, /var/run/rspamd and /var/db/rspamd when upgrading. By default, Rspamd uses nobody:nobody on FreeBSD, but the admin might have changed the default (via /etc/rc.conf).
Comment 1 Vsevolod Stakhov freebsd_committer freebsd_triage 2017-06-02 21:29:23 UTC
No, just change the default settings if you need to. This behaviour is desired.
Comment 2 Peter Putzer 2017-06-02 22:05:29 UTC
Maybe we are talking about something else, but why is resetting the directory ownership on every port upgrade (independent of whatever I've set for rspamd_user and rspamd_group in /etc/rc.conf) a desirable behavior?

Or do you mean there is some compile option that could be set via make.conf?
Comment 3 Peter Putzer 2017-06-03 07:29:56 UTC
(In reply to Vsevolod Stakhov from comment #1)

I may be missing something, but I seem to be unable to pass any CMAKE_ARGS from make.conf or the commandline (adding "CMAKE_ARGS+= -DRSPAMD_USER=rspamd -DRSPAMD_GROUP=rspamd" to the build via make.conf does not change the port's behavior when upgrading). 

Why not simply leave those directories alone if they already exist? Alternatively, instructions how to change the default user/group without patching the port Makefile itself would be greatly appreciated.
Comment 4 Peter Putzer 2017-06-04 18:38:54 UTC
Sorry to re-open this, but I don't see a way to "change the default settings" with the current state of the port. If I missed the proper procedure, please advise.
Comment 5 Walter Schwarzenfeld freebsd_triage 2018-02-07 13:11:46 UTC
Either you make a bash that do it for you
or
you put something like this in /etc/make.conf:

.if ${.CURDIR:M*/ports/mail/rspamd}
post-clean:
        ${CHOWN} -R user:group  /var/log/rspamd /var/run/rspamd /var/db/rspamd
.endif

(I think this should do, what you want).

Is rejected, so I close here.
Comment 6 Walter Schwarzenfeld freebsd_triage 2018-02-07 13:23:35 UTC
Have to correct (needed for deinstall)

.if ${.CURDIR:M*/ports/mail/rspamd}
post-clean:
        if [ -e /var/log/rspamd ];then \
                ${CHOWN} ngorx:wheel /var/log/rspamd /var/run/rspamd /var/db/rspamd;fi 
.endif
Comment 7 dewayne 2018-08-20 04:41:45 UTC
(In reply to w.schwarzenfeld from comment #6)
Thank-you for your suggestions, very helpful.