Bug 217873

Summary: net-mgmt/seafile-server: Fix setup scripts and corrected proper startup procedures
Product: Ports & Packages Reporter: Ultima <Ultima1252>
Component: Individual Port(s)Assignee: Nikolai Lifanov <lifanov>
Status: Closed FIXED    
Severity: Affects Only Me CC: lifanov, pi
Priority: --- Keywords: easy, patch-ready
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
seafile-server.diff
Ultima1252: maintainer-approval+
seafile-server.diff Ultima1252: maintainer-approval+

Description Ultima 2017-03-17 17:02:53 UTC
Created attachment 180905 [details]
seafile-server.diff

This patch will fix the setup scripts changing the generated configuration files to the correct uid/gid. The directions were also fixed for how to start and setup seafile/seahub correctly. This should fix any confusion when setting up seafile entirely.


portlint -AC:
WARN: Makefile: Consider adding support for a NLS knob to conditionally disable gettext support.
WARN: Makefile: for new port, make $FreeBSD$ tag in comment section empty, to make SVN happy.
WARN: Makefile: new ports should not set PORTREVISION.
0 fatal errors and 3 warnings found.
Comment 1 Nikolai Lifanov freebsd_committer freebsd_triage 2017-03-17 17:11:36 UTC
I only have a couple of comments, but looks good so far:

+	${REINPLACE_CMD} 's/%%SEAFILE_USER%%/${USERS}/ ; s/%%SEAFILE_GROUP%%/${GROUPS}/' \
+			${WRKSRC}/scripts/setup-seafile.sh ${WRKSRC}/scripts/setup-seafile-mysql.py

This should be ${USERS:[1]} and ${GROUPS:[1]} because these can have multiple values.

+-run seafile server:     ./seafile.sh { start | stop | restart }
+-run seahub  server:     ./seahub.sh  { start <port> | stop | restart <port> }
++run seafile server:     echo "seafile_enable=\"YES\"" >>/etc/rc.conf
++                        service seafile { start | stop | restart }
++run seahub  server:     echo "seahub_enable=\"YES\"" >>/etc/rc.conf
++fastcgi (optional):     echo "seahub_fastcgi=\"1\"" >>/etc/rc.conf
++                        service seahub { start | stop | restart }
++run reset-admin:        ./reset-admin.sh
+ 

You may consider asking the user to use "sysrc" to manipulate rc files.
In this case
 echo "seafile_enable=\"YES\"" >>/etc/rc.conf
 echo "seahub_fastcgi=\"1\"" >>/etc/rc.conf
becomes
 sysrc seafile_enable=YES
 sysrc seahub_fastcgi=1

This is idempotent, verbose about the change, and will handle seafile_enable already being set to something different correctly.
Comment 2 Ultima 2017-03-18 16:43:12 UTC
Created attachment 180929 [details]
seafile-server.diff

(In reply to Nikolai Lifanov from comment #1)
Thanks for the feedback, much less escaping with sysrc! =]

Also fixed the USERS and GROUPS to select first in array as suggested.

I added one more fix to the scripts, selecting the default localhost translates to 127.0.0.1. Normally this wouldn't be an issue but for a jail without this will change to the host ip. Removing this fixes issues with jails that do not have 127.0.0.1 as loopback.
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-03-19 16:22:44 UTC
A commit references this bug:

Author: lifanov
Date: Sun Mar 19 16:22:09 UTC 2017
New revision: 436504
URL: https://svnweb.freebsd.org/changeset/ports/436504

Log:
  fixes for net-mgmt/seafile-server

  Fix the setup scripts changing the generated configuration files to the correct uid/gid. The directions were also fixed for how to start and setup seafile/seahub correctly. This should fix any confusion when setting up seafile.

  This also augments pkg-message with better directions for setup.

  PR:		217873
  Submitted by:	ultima1252@gmail.com (maintainer)

Changes:
  head/net-mgmt/seafile-server/Makefile
  head/net-mgmt/seafile-server/files/patch-scripts_setup-seafile-mysql.py
  head/net-mgmt/seafile-server/files/patch-scripts_setup-seafile.sh
  head/net-mgmt/seafile-server/files/pkg-message.in
Comment 4 Nikolai Lifanov freebsd_committer freebsd_triage 2017-03-19 16:23:34 UTC
Committed, thanks!