Page MenuHomeFreeBSD

D3947.id11782.diff
No OneTemporary

D3947.id11782.diff

Index: GIDs
===================================================================
--- GIDs
+++ GIDs
@@ -240,6 +240,7 @@
dahdi:*:843:asterisk
subsonic:*:844:
sogod:*:846:
+seafile:*:900:
fossy:*:901:www
scanlogd:*:902:
_ocserv:*:903:
Index: UIDs
===================================================================
--- UIDs
+++ UIDs
@@ -251,6 +251,7 @@
munin:*:842:842::0:0:Munin:/var/munin:/usr/sbin/nologin
subsonic:*:844:844::0:0:Subsonic standalone-server:/nonexistent:/usr/sbin/nologin
sogod:*:846:846::0:0:SOGo groupware:/nonexistent:/usr/sbin/nologin
+seafile:*:900:900::0:0:seafile user:/nonexistent:/usr/bin/nologin
fossy:*:901:901::0:0:FOSSology user:/usr/local/share/fossology:/usr/local/bin/bash
scanlogd:*:902:902::0:0:scanlogd user:/nonexistent:/usr/sbin/nologin
_ocserv:*:903:903::0:0:ocserv user:/nonexistent:/usr/sbin/nologin
Index: net-mgmt/seafile/Makefile
===================================================================
--- net-mgmt/seafile/Makefile
+++ net-mgmt/seafile/Makefile
@@ -1,8 +1,7 @@
# $FreeBSD$
PORTNAME= seafile
-PORTVERSION= 4.0.6
-PORTREVISION= 3
+PORTVERSION= 5.0.2
DISTVERSIONPREFIX= v
DISTVERSIONSUFFIX= -server
CATEGORIES= net-mgmt devel
@@ -11,6 +10,7 @@
COMMENT= Framework for writing networked applications
LICENSE= GPLv3
+LICENSE_FILE= ${WRKSRC}/LICENSE.txt
BUILD_DEPENDS= valac:${PORTSDIR}/lang/vala
LIB_DEPENDS= libsearpc.so:${PORTSDIR}/devel/libsearpc \
@@ -27,9 +27,12 @@
USE_GITHUB= yes
GH_ACCOUNT= haiwen
-USES= autoreconf iconv libarchive libtool pathfix pkgconfig python:2 \
+USES= autoreconf iconv libarchive libtool pathfix pkgconfig python:-2.7 \
shebangfix
-SHEBANG_FILES= scripts/*.sh scripts/upgrade/*.sh
+SHEBANG_FILES= scripts/*.sh scripts/upgrade/*.sh tests/*.py tests/basic/*.sh \
+ tests/sync-auto-test/*.template *.sh scripts/build/*.py \
+ scripts/*.py *.py scripts/upgrade/*.py app/seaf-cli \
+ tools/seafile-admin
GNU_CONFIGURE= yes
USE_OPENSSL= yes
USE_LDCONFIG= yes
@@ -47,7 +50,7 @@
SEABIN= ${SEAFILE_SERVER}/seafile/bin
SEALIB= ${SEAFILE_SERVER}/seafile/lib
-SEAFILE_USERNAME?= www
+SEAFILE_USERNAME?= seafile
SEAFILE_GROUPNAME?= ${SEAFILE_USERNAME}
USE_RC_SUBR= ${PORTNAME}
@@ -56,6 +59,13 @@
SEAFILE_SERVER=${SEAFILE_SERVER} \
HAIWENDIR=${HAIWENDIR}
+SUB_FILES= pkg-message
+
+SUB_LIST+= SEAFILE_USERNAME=${SEAFILE_USERNAME} \
+ SEAFILE_GROUPNAME=${SEAFILE_GROUPNAME} \
+ SEAFILE_SERVER=${SEAFILE_SERVER} \
+ HAIWENDIR=${HAIWENDIR}
+
MAKE_JOBS_UNSAFE= yes
OPTIONS_DEFINE= FUSE RIAK
@@ -75,20 +85,31 @@
OPTIONS_DEFAULT=
.endif
+post-patch:
+ ${REINPLACE_CMD} -e 's|^INSTALL.*|INSTALLPATH="${PREFIX}/${SEAFILE_SERVER}/seafile"|' \
+ ${WRKSRC}/scripts/seaf-cli-wrapper.sh
post-install:
@${MKDIR} ${STAGEDIR}${PREFIX}/${SEABIN} ${STAGEDIR}${PREFIX}/${SEALIB}\
${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/seafile/share/doc/seafile \
${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/upgrade
.for SERVPROG in seaf-fsck seafserv-gc seaf-fuse seaf-migrate \
- seaf-server seaf-server-init seafile-controller
+ seaf-server seaf-server-init seafile-controller
if [ -e "${STAGEDIR}${PREFIX}/bin/${SERVPROG}" ]; then \
${INSTALL_PROGRAM} ${STAGEDIR}${PREFIX}/bin/${SERVPROG} ${STAGEDIR}${PREFIX}/${SEABIN}; \
${RM} ${STAGEDIR}${PREFIX}/bin/${SERVPROG}; \
fi
.endfor
+.for SERVPROG in seafile-controller seaf-server
+ ${LN} -s ${PREFIX}/${SEABIN}/${SERVPROG} ${STAGEDIR}${PREFIX}/bin/
+.endfor
+
+ ${INSTALL_SCRIPT} ${STAGEDIR}${PREFIX}/bin/seaf-cli ${STAGEDIR}${PREFIX}/${SEABIN}/seaf-cli.py
+ ${INSTALL_SCRIPT} ${WRKSRC}/scripts/seaf-cli-wrapper.sh ${STAGEDIR}${PREFIX}/bin/seaf-cli
(cd ${STAGEDIR}${PREFIX}/lib && \
${COPYTREE_SHARE} ${PYTHON_VERSION} ${STAGEDIR}${PREFIX}/${SEALIB})
- @${RM} -rf ${STAGEDIR}${PREFIX}/lib/${PYTHON_VERSION}
+ @${RM} -rf ${STAGEDIR}${PREFIX}/lib/${PYTHON_VERSION} \
+ ${WRKSRC}/scripts/seaf-cli-wrapper.sh \
+ ${STAGEDIR}${PREFIX}/bin/seafile-admin
${INSTALL_SCRIPT} ${WRKSRC}/scripts/*.[ps][yh] ${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}
${INSTALL_SCRIPT} ${WRKSRC}/scripts/upgrade/*.[ps][yh] \
${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/upgrade
Index: net-mgmt/seafile/distinfo
===================================================================
--- net-mgmt/seafile/distinfo
+++ net-mgmt/seafile/distinfo
@@ -1,2 +1,2 @@
-SHA256 (haiwen-seafile-v4.0.6-server_GH0.tar.gz) = 3f9aacc53c67aa165c66a4546a6f8c7ad3a002f741578a538b0c0965a73317bf
-SIZE (haiwen-seafile-v4.0.6-server_GH0.tar.gz) = 1082453
+SHA256 (haiwen-seafile-v5.0.2-server_GH0.tar.gz) = 6ba9b99b688c132ac654016febcb2af05d903f6d024d4be2fda156c1047cc463
+SIZE (haiwen-seafile-v5.0.2-server_GH0.tar.gz) = 1161402
Index: net-mgmt/seafile/files/patch-configure.ac
===================================================================
--- net-mgmt/seafile/files/patch-configure.ac
+++ net-mgmt/seafile/files/patch-configure.ac
@@ -1,6 +1,6 @@
---- configure.ac.orig 2015-01-21 22:45:28.000000000 -0500
-+++ configure.ac 2015-01-28 14:01:20.000000000 -0500
-@@ -50,8 +50,16 @@
+--- configure.ac.orig 2015-09-21 03:42:11 UTC
++++ configure.ac
+@@ -50,8 +50,16 @@ else
AC_MSG_RESULT(no)
fi
@@ -18,7 +18,7 @@
blinux=true
AC_MSG_RESULT(compile in linux)
else
-@@ -93,6 +101,11 @@
+@@ -93,6 +101,11 @@ if test "$bwin32" != true; then
[compile_fuse=$enableval],[compile_fuse="yes"])
fi
@@ -30,7 +30,7 @@
AC_ARG_ENABLE(client, AC_HELP_STRING([--enable-client], [enable client]),
[compile_client=$enableval],[compile_client="yes"])
-@@ -148,6 +161,7 @@
+@@ -148,6 +161,7 @@ AM_CONDITIONAL([COMPILE_FUSE], [test "${
AM_CONDITIONAL([WIN32], [test "$bwin32" = "true"])
AM_CONDITIONAL([MACOS], [test "$bmac" = "true"])
@@ -38,10 +38,10 @@
AM_CONDITIONAL([LINUX], [test "$blinux" = "true"])
-@@ -192,6 +206,9 @@
- LIB_PSAPI=-lpsapi
+@@ -193,6 +207,9 @@ if test "$bwin32" = true; then
LIB_MAC=
MSVC_CFLAGS="-D__MSVCRT__ -D__MSVCRT_VERSION__=0x0601"
+ LIB_CRYPT32=-lcrypt32
+ ZLIB_LIBS=
+ LIB_INOTIFY=
+ LIB_KVM=
@@ -48,10 +48,10 @@
elif test "$bmac" = true ; then
LIB_WS32=
LIB_GDI32=
-@@ -204,6 +221,24 @@
- LIB_PSAPI=
+@@ -206,6 +223,25 @@ elif test "$bmac" = true ; then
MSVC_CFLAGS=
LIB_MAC="-framework CoreServices"
+ LIB_CRYPT32=
+ ZLIB_LIBS=
+ LIB_INOTIFY=
+ LIB_KVM=
@@ -59,7 +59,7 @@
+ LIB_WS32=
+ LIB_GDI32=
+ LIB_RT=
-+ LIB_INTL=
++ LIB_INTL=
+ LIB_RESOLV=
+ LIB_UUID=-luuid
+ LIB_IPHLPAPI=
@@ -67,6 +67,7 @@
+ LIB_PSAPI=
+ LIB_MAC=
+ MSVC_CFLAGS=
++ LIB_CRYPT32=
+ ZLIB_LIBS=-lz
+ LIB_INOTIFY=-linotify
+ LIB_KVM=-lkvm
@@ -73,10 +74,10 @@
else
LIB_WS32=
LIB_GDI32=
-@@ -216,6 +251,9 @@
- LIB_PSAPI=
+@@ -219,6 +255,9 @@ else
LIB_MAC=
MSVC_CFLAGS=
+ LIB_CRYPT32=
+ ZLIB_LIBS=-lz
+ LIB_INOTIFY=-linotify
+ LIB_KVM=
@@ -83,7 +84,7 @@
fi
AC_SUBST(LIB_WS32)
-@@ -228,6 +266,9 @@
+@@ -231,6 +270,9 @@ AC_SUBST(LIB_IPHLPAPI)
AC_SUBST(LIB_SHELL32)
AC_SUBST(LIB_PSAPI)
AC_SUBST(LIB_MAC)
@@ -91,9 +92,9 @@
+AC_SUBST(LIB_INOTIFY)
+AC_SUBST(LIB_KVM)
AC_SUBST(MSVC_CFLAGS)
+ AC_SUBST(LIB_CRYPT32)
-
-@@ -240,7 +281,9 @@
+@@ -244,7 +286,9 @@ ZDB_REQUIRED=2.10
#LIBNAUTILUS_EXTENSION_REQUIRED=2.30.1
CURL_REQUIRED=7.17
FUSE_REQUIRED=2.7.3
@@ -103,7 +104,7 @@
PKG_CHECK_MODULES(SSL, [openssl])
AC_SUBST(SSL_CFLAGS)
-@@ -270,9 +313,11 @@
+@@ -274,9 +318,11 @@ PKG_CHECK_MODULES(LIBEVENT, [libevent >=
AC_SUBST(LIBEVENT_CFLAGS)
AC_SUBST(LIBEVENT_LIBS)
Index: net-mgmt/seafile/files/patch-daemon_Makefile.am
===================================================================
--- net-mgmt/seafile/files/patch-daemon_Makefile.am
+++ net-mgmt/seafile/files/patch-daemon_Makefile.am
@@ -1,6 +1,6 @@
---- daemon/Makefile.am.orig 2015-01-28 13:48:56.000000000 -0500
-+++ daemon/Makefile.am 2015-01-28 13:55:22.000000000 -0500
-@@ -65,6 +65,10 @@
+--- daemon/Makefile.am.orig 2015-10-12 04:12:33 UTC
++++ daemon/Makefile.am
+@@ -69,6 +69,10 @@ if LINUX
wt_monitor_src = wt-monitor.c wt-monitor-linux.c wt-monitor-structs.c
endif
@@ -11,10 +11,10 @@
if WIN32
wt_monitor_src = wt-monitor.c wt-monitor-win32.c wt-monitor-structs.c
endif
-@@ -127,7 +131,8 @@
+@@ -135,7 +139,8 @@ seaf_daemon_LDADD = $(top_builddir)/lib/
@GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ -lsqlite3 @LIBEVENT_LIBS@ \
$(top_builddir)/common/cdc/libcdc.la \
- $(top_builddir)/common/index/libindex.la ${LIB_WS32} \
+ $(top_builddir)/common/index/libindex.la @LIB_WS32@ @LIB_CRYPT32@ \
- @SEARPC_LIBS@ @CCNET_LIBS@ @GNOME_KEYRING_LIBS@ @JANSSON_LIBS@ @LIB_MAC@ @ZLIB_LIBS@ @CURL_LIBS@
+ @SEARPC_LIBS@ @CCNET_LIBS@ @GNOME_KEYRING_LIBS@ @JANSSON_LIBS@ @LIB_MAC@ @ZLIB_LIBS@ \
+ @CURL_LIBS@ @LIB_INOTIFY@
Index: net-mgmt/seafile/files/patch-daemon_http-tx-mgr.c
===================================================================
--- net-mgmt/seafile/files/patch-daemon_http-tx-mgr.c
+++ net-mgmt/seafile/files/patch-daemon_http-tx-mgr.c
@@ -0,0 +1,25 @@
+--- daemon/http-tx-mgr.c.orig 2015-09-21 03:42:11 UTC
++++ daemon/http-tx-mgr.c
+@@ -58,6 +58,22 @@
+ #define USER_AGENT_OS "Linux"
+ #endif
+
++#ifdef __FreeBSD__
++#define USER_AGENT_OS "FreeBSD"
++#endif
++
++#ifdef __DragonFly__
++#define USER_AGENT_OS "DragonFly"
++#endif
++
++#ifdef __NetBSD__
++#define USER_AGENT_OS "NetBSD"
++#endif
++
++#ifdef __OpenBSD__
++#define USER_AGENT_OS "OpenBSD"
++#endif
++
+ struct _Connection {
+ CURL *curl;
+ gint64 ctime; /* Used to clean up unused connection. */
Index: net-mgmt/seafile/files/patch-daemon_repo-mgr.c
===================================================================
--- net-mgmt/seafile/files/patch-daemon_repo-mgr.c
+++ net-mgmt/seafile/files/patch-daemon_repo-mgr.c
@@ -1,6 +1,6 @@
---- daemon/repo-mgr.c.orig 2015-01-28 02:18:05.000000000 -0500
-+++ daemon/repo-mgr.c 2015-01-28 02:22:10.000000000 -0500
-@@ -2514,13 +2514,13 @@
+--- daemon/repo-mgr.c.orig 2015-09-21 03:42:11 UTC
++++ daemon/repo-mgr.c
+@@ -4017,13 +4017,13 @@ checkout_file (const char *repo_id,
gboolean force_conflict = FALSE;
gboolean update_mode_only = FALSE;
@@ -17,7 +17,7 @@
#endif
if (!path)
-@@ -2675,13 +2675,13 @@
+@@ -4193,13 +4193,13 @@ checkout_empty_dir (const char *worktree
char *path;
gboolean case_conflict = FALSE;
@@ -34,7 +34,41 @@
#endif
if (!path)
-@@ -2839,13 +2839,13 @@
+@@ -4606,13 +4606,13 @@ schedule_file_fetch (GThreadPool *tpool,
+ new_ce = TRUE;
+ }
+
+-#ifndef __linux__
++#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
++ path = build_checkout_path (worktree, de->name, strlen(de->name));
++#else
+ path = build_case_conflict_free_path (worktree, de->name,
+ conflict_hash, no_conflict_hash,
+ &case_conflict,
+ FALSE);
+-#else
+- path = build_checkout_path (worktree, de->name, strlen(de->name));
+ #endif
+
+ if (!path) {
+@@ -4736,13 +4736,13 @@ checkout_file_http (FileTxData *data,
+ * A.txt to checkout, we can only detect case conflict after one file is checkecd
+ * out. So we need to generate a new one here.
+ */
+-#ifndef __linux__
++#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
++ path = build_checkout_path (worktree, de->name, strlen(de->name));
++#else
+ path = build_case_conflict_free_path (worktree, de->name,
+ conflict_hash, no_conflict_hash,
+ &case_conflict,
+ FALSE);
+-#else
+- path = build_checkout_path (worktree, de->name, strlen(de->name));
+ #endif
+
+ if (!path) {
+@@ -5110,13 +5110,13 @@ do_rename_in_worktree (DiffEntry *de, co
old_path = g_build_filename (worktree, de->name, NULL);
if (seaf_util_exists (old_path)) {
@@ -50,4 +84,4 @@
- new_path = build_checkout_path (worktree, de->new_name, strlen(de->new_name));
#endif
- if (seaf_util_rename (old_path, new_path) < 0) {
+ if (!new_path) {
Index: net-mgmt/seafile/files/patch-lib_Makefile.am
===================================================================
--- net-mgmt/seafile/files/patch-lib_Makefile.am
+++ net-mgmt/seafile/files/patch-lib_Makefile.am
@@ -0,0 +1,29 @@
+--- lib/Makefile.am.orig 2015-10-12 04:12:33 UTC
++++ lib/Makefile.am
+@@ -53,6 +53,7 @@ libseafile_common_la_SOURCES = ${seafile
+ libseafile_common_la_LDFLAGS = -no-undefined
+ libseafile_common_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ -lcrypto @LIB_GDI32@ \
+ @LIB_UUID@ @LIB_WS32@ @LIB_PSAPI@ -lsqlite3 \
++ @LIB_KVM@ \
+ @LIBEVENT_LIBS@ @SEARPC_LIBS@ @LIB_SHELL32@ \
+ @ZLIB_LIBS@
+
+@@ -74,7 +75,7 @@ vala.stamp: ${seafile_object_define}
+ rm -f ${seafile_object_gen}
+ @rm -f vala.tmp
+ @touch vala.tmp
+- valac -C --pkg posix $^
++ valac -C --pkg posix ${seafile_object_define}
+ @mv -f vala.tmp $@
+
+ ${seafile_object_gen}: vala.stamp
+@@ -90,5 +91,9 @@ install-data-local:
+ if MACOS
+ sed -i '' -e "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
+ else
++if BSD
++ sed -i '' "s|(DESTDIR)|${PREFIX}|g" $(pcfiles)
++else
+ ${SED} -i "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
+ endif
++endif
Index: net-mgmt/seafile/files/patch-lib_Makfile.am
===================================================================
--- net-mgmt/seafile/files/patch-lib_Makfile.am
+++ net-mgmt/seafile/files/patch-lib_Makfile.am
@@ -1,29 +0,0 @@
---- lib/Makefile.am.orig 2015-01-28 13:44:26.000000000 -0500
-+++ lib/Makefile.am 2015-01-28 13:48:00.000000000 -0500
-@@ -53,6 +53,7 @@
- libseafile_common_la_LDFLAGS = -no-undefined
- libseafile_common_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ -lcrypto @LIB_GDI32@ \
- @LIB_UUID@ @LIB_WS32@ @LIB_PSAPI@ -lsqlite3 \
-+ @LIB_KVM@ \
- @LIBEVENT_LIBS@ @SEARPC_LIBS@ @LIB_SHELL32@ \
- @ZLIB_LIBS@
-
-@@ -74,7 +75,7 @@
- rm -f ${seafile_object_gen}
- @rm -f vala.tmp
- @touch vala.tmp
-- valac -C --pkg posix $^
-+ valac -C --pkg posix ${seafile_object_define}
- @mv -f vala.tmp $@
-
- ${seafile_object_gen}: vala.stamp
-@@ -90,5 +91,9 @@
- if MACOS
- sed -i '' -e "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
- else
-+if BSD
-+ sed -i '' "s|(DESTDIR)|${PREFIX}|g" $(pcfiles)
-+else
- ${SED} -i "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
- endif
-+endif
Index: net-mgmt/seafile/files/patch-scripts_upgrade_regenerate__secret__key.sh
===================================================================
--- net-mgmt/seafile/files/patch-scripts_upgrade_regenerate__secret__key.sh
+++ net-mgmt/seafile/files/patch-scripts_upgrade_regenerate__secret__key.sh
@@ -0,0 +1,13 @@
+--- scripts/upgrade/regenerate_secret_key.sh.orig 2015-10-21 04:01:24 UTC
++++ scripts/upgrade/regenerate_secret_key.sh
+@@ -8,6 +8,8 @@ TOPDIR=$(dirname "${INSTALLPATH}")
+ seahub_secret_keygen=${INSTALLPATH}/seahub/tools/secret_key_generator.py
+ seahub_settings_py=${TOPDIR}/seahub_settings.py
+
+-line="SECRET_KEY = \"$(python $seahub_secret_keygen)\""
++line="SECRET_KEY = \"$(python2.7 $seahub_secret_keygen)\""
+
+-sed -i -e "/SECRET_KEY/c\\$line" $seahub_settings_py
++sed -i.bak -e "/SECRET_KEY/c\\
++$line
++" $seahub_settings_py
Index: net-mgmt/seafile/files/patch-server_access-file.c
===================================================================
--- net-mgmt/seafile/files/patch-server_access-file.c
+++ net-mgmt/seafile/files/patch-server_access-file.c
@@ -0,0 +1,54 @@
+--- server/access-file.c.orig 2015-11-12 02:40:40 UTC
++++ server/access-file.c
+@@ -221,10 +221,10 @@ write_block_data_cb (struct bufferevent
+ bev->cbarg = data->saved_cb_arg;
+
+ /* Resume reading incomming requests. */
+- evhtp_request_resume (data->req);
+-
+ evhtp_send_reply_end (data->req);
+
++ evhtp_request_resume (data->req);
++
+ free_sendblock_data (data);
+ return;
+ }
+@@ -306,10 +306,10 @@ next:
+ bev->cbarg = data->saved_cb_arg;
+
+ /* Resume reading incomming requests. */
+- evhtp_request_resume (data->req);
+-
+ evhtp_send_reply_end (data->req);
+
++ evhtp_request_resume (data->req);
++
+ free_sendfile_data (data);
+ return;
+ }
+@@ -403,10 +403,10 @@ write_dir_data_cb (struct bufferevent *b
+ bev->cbarg = data->saved_cb_arg;
+
+ /* Resume reading incomming requests. */
+- evhtp_request_resume (data->req);
+-
+ evhtp_send_reply_end (data->req);
+
++ evhtp_request_resume (data->req);
++
+ free_senddir_data (data);
+ return;
+ }
+@@ -710,10 +710,10 @@ finish_file_range_request (struct buffer
+ bev->cbarg = data->saved_cb_arg;
+
+ /* Resume reading incomming requests. */
+- evhtp_request_resume (data->req);
+-
+ evhtp_send_reply_end (data->req);
+
++ evhtp_request_resume (data->req);
++
+ free_send_file_range_data (data);
+ }
+
Index: net-mgmt/seafile/files/pkg-message.in
===================================================================
--- net-mgmt/seafile/files/pkg-message.in
+++ net-mgmt/seafile/files/pkg-message.in
@@ -0,0 +1,7 @@
+For an existing config, or creating a new one, fix the UID/GID.
+Do not change %%PREFIX%%/%%SEAFILE_SERVER%% unless your front
+end is using the seafile UID/GID as well.
+
+chown -R seafile:seafile %%PREFIX%%/%%HAIWENDIR%%/conf \
+ %%PREFIX%%/%%HAIWENDIR%%/ccnet %%PREFIX%%/%%HAIWENDIR%%/seafile-data \
+ %%PREFIX%%/%%HAIWENDIR%%/pids %%PREFIX%%/%%HAIWENDIR%%/logs
Index: net-mgmt/seafile/files/seafile.in
===================================================================
--- net-mgmt/seafile/files/seafile.in
+++ net-mgmt/seafile/files/seafile.in
@@ -4,7 +4,7 @@
#
# PROVIDE: seafile
-# REQUIRE: LOGIN cleanvar
+# REQUIRE: LOGIN cleanvar mysql
# KEYWORD: shutdown
#
@@ -13,47 +13,138 @@
#
# seafile_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable seafile.
+# seafile_user (str): User to run seafile as
+# Default to "%%SEAFILE_USERNAME%%" created by the port
+# seafile_group (str): Group to run seafile as
+# Default to "%%SEAFILE_GROUPNAME%%" created by the port
# seafile_path (str): Set to "" by default will use the path
-# /usr/local/www/haiwen/seafile-server.
-# Set it to a different path.
+# %%PREFIX%%/%%SEAFILE_SERVER%%.
+# Set it to a different path.
+# seafile_ccnet (str): Set to "" by default will use the path
+# %%PREFIX%%/%%HAIWENDIR%%/ccnet.
+# Set it to a different path.
+# seafile_conf (str): Set to "" by default will use the path
+# %%PREFIX%%/%%HAIWENDIR%%/conf.
+# Set it to a different path.
+# seafile_datadir (str): Set to "" by default will use the path
+# in file %%PREFIX%%/%%HAIWENDIR%%/ccnet/seafile.ini.
+# Set it to a different path.
+# seafile_logdir (str): Set to "" by default will use the path
+# %%PREFIX%%/%%HAIWENDIR%%/logs
+# Set it to a different path.
+# seafile_ccnet_debug (str): Set to "info" by default.
+# Possible values are debug, warning, info.
+# seafile_seafile_debug (str): Set to "info" by default.
+# Possible values are debug, warning, info.
. /etc/rc.subr
name="seafile"
-rcvar=seafile_enable
+rcvar="seafile_enable"
load_rc_config $name
-start_cmd="${name}_start"
-restart_cmd="${name}_restart"
-stop_cmd="${name}_stop"
+start_cmd="seafile_start"
+restart_cmd="seafile_restart"
+stop_cmd="seafile_stop"
-: ${seafile_path:=%%PREFIX%%/www/haiwen/seafile-server}
+: ${seafile_enable="NO"}
+: ${seafile_user:=%%SEAFILE_USERNAME%%}
+: ${seafile_group:=%%SEAFILE_GROUPNAME%%}
+: ${seafile_path:=%%PREFIX%%/%%SEAFILE_SERVER%%}
+: ${seafile_ccnet:=%%PREFIX%%/%%HAIWENDIR%%/ccnet}
+: ${seafile_conf:=%%PREFIX%%/%%HAIWENDIR%%/conf}
+: ${seafile_datadir:=`cat ${seafile_ccnet}/seafile.ini`}
+: ${seafile_logdir:=%%PREFIX%%/%%HAIWENDIR%%/logs}
+: ${seafile_ccnet_debug:=info}
+: ${seafile_seafile_debug:=info}
-command="$seafile_path/seafile.sh"
+command="%%PREFIX%%/%%SEAFILE_SERVER%%/seafile/bin/seafile-controller"
+command_args="-c \"${seafile_ccnet}\" -d \"${seafile_datadir}\" -F \"${seafile_conf}\" -L \"${seafile_logdir}\" -g \"${seafile_ccnet_debug}\" -G \"${seafile_seafile_debug}\""
-seafile_start()
-{
- if checkyesno ${name}_enable; then
- start_script="${seafile_path}/seafile.sh"
- echo "Starting seafile service"
- $command start
- else
- return 0
+required_dirs="${seafile_ccnet} ${seafile_conf} ${seafile_datadir}"
+required_files="${seafile_ccnet}/seafile.ini"
+
+test_config() {
+ if ! su -m ${seafile_user} -c "${command} -t ${command_args}" ; then
+ exit 1;
fi
}
-seafile_stop()
-{
- echo "Stoping seafile service"
- $command stop
+check_component_running() {
+ name=$1
+ cmd=$2
+ if pid=$(pgrep -f "$cmd" 2>/dev/null); then
+ echo "{$name} is running, pid $pid. You can stop it by: "
+ echo
+ echo " kill $pid"
+ echo
+ echo "Stop it and try again."
+ echo
+ exit
+ fi
}
-seafile_restart()
-{
- echo "Restart seafile service"
- $command restart
+validate_already_running() {
+ if pid=$(pgrep -f "seafile-controller -c ${seafile_ccnet}" 2>/dev/null); then
+ echo "Seafile controller is already running, pid $pid"
+ echo
+ exit 1;
+ fi
+
+ check_component_running "ccnet-server" "ccnet-server -c ${seafile_ccnet}"
+ check_component_running "seaf-server" "seaf-server -c ${seafile_ccnet}"
+ check_component_running "fileserver" "fileserver -c ${seafile_ccnet}"
+ check_component_running "seafdav" "wsgidav.server.run_server"
}
-load_rc_config $name
+prepare_env() {
+export PATH=${seafile_path}/seafile/bin:$PATH
+export LD_LIBRARY_PATH=${seafile_path}/seafile/lib/:${seafile_path}/seafile/lib64:${LD_LIBRARY_PATH}
+}
+
+seafile_start() {
+ check_required_before;
+ validate_already_running;
+ test_config;
+
+ echo "Starting seafile server, please wait ..."
+
+ su -m "${seafile_user}" -c "mkdir -p $seafile_logdir"
+ su -m "${seafile_user}" -c "$command $command_args"
+
+ sleep 3
+
+ # check if seafile server started successfully
+ if ! pgrep -f "seafile-controller -c ${seafile_ccnet}" 2>/dev/null 1>&2; then
+ echo "Failed to start seafile server"
+ exit 1;
+ fi
+
+ echo "Seafile server started"
+ echo
+}
+
+seafile_stop() {
+ if ! pgrep -f "seafile-controller -c ${seafile_ccnet}" 2>/dev/null 1>&2; then
+ echo "Seafile is not running"
+ return 1;
+ fi
+
+ echo "Stopping ${name}."
+ pkill -SIGTERM -f "seafile-controller -c ${seafile_ccnet}"
+ pkill -f "ccnet-server -c ${seafile_ccnet}"
+ pkill -f "seaf-server -c ${seafile_ccnet}"
+ pkill -f "fileserver -c ${seafile_ccnet}"
+ pkill -f "soffice.*--invisible --nocrashreport"
+ pkill -f "wsgidav.server.run_server"
+ return 0
+}
+
+seafile_restart() {
+ seafile_stop;
+ sleep 2
+ seafile_start;
+}
+
run_rc_command "$1"
Index: net-mgmt/seafile/pkg-plist
===================================================================
--- net-mgmt/seafile/pkg-plist
+++ net-mgmt/seafile/pkg-plist
@@ -1,6 +1,7 @@
bin/seaf-cli
bin/seaf-daemon
-bin/seafile-admin
+bin/seafile-controller
+bin/seaf-server
include/seafile/monitor-rpc.h
include/seafile/seafile-object.h
include/seafile/seafile-rpc.h
@@ -14,12 +15,12 @@
man/man1/seaf-daemon.1.gz
%%SEAFILE_SERVER%%/check_init_admin.py
%%SEAFILE_SERVER%%/reset-admin.sh
-%%SEAFILE_SERVER%%/seaf-cli-wrapper.sh
%%SEAFILE_SERVER%%/seaf-fuse.sh
%%SEAFILE_SERVER%%/seaf-gc.sh
%%SEAFILE_SERVER%%/seafile.sh
%%SEAFILE_SERVER%%/seafile/bin/seaf-fsck
-%%SEAFILE_SERVER%%/seafile/bin/seaf-fuse
+%%FUSE%%%%SEAFILE_SERVER%%/seafile/bin/seaf-fuse
+%%SEAFILE_SERVER%%/seafile/bin/seaf-cli.py
%%SEAFILE_SERVER%%/seafile/bin/seaf-migrate
%%SEAFILE_SERVER%%/seafile/bin/seaf-server
%%SEAFILE_SERVER%%/seafile/bin/seaf-server-init
@@ -51,6 +52,9 @@
%%SEAFILE_SERVER%%/upgrade/db_update_1.3_1.4.py
%%SEAFILE_SERVER%%/upgrade/db_update_helper.py
%%SEAFILE_SERVER%%/upgrade/minor-upgrade.sh
+%%SEAFILE_SERVER%%/seaf-fsck.sh
+%%SEAFILE_SERVER%%/upgrade/fix_mysql_user.py
+%%SEAFILE_SERVER%%/upgrade/regenerate_secret_key.sh
%%SEAFILE_SERVER%%/upgrade/sql/1.6.0/mysql/seahub.sql
%%SEAFILE_SERVER%%/upgrade/sql/1.6.0/sqlite3/seahub.sql
%%SEAFILE_SERVER%%/upgrade/sql/1.7.0/mysql/seafile.sql
@@ -69,6 +73,18 @@
%%SEAFILE_SERVER%%/upgrade/sql/3.0.0/sqlite3/seahub.sql
%%SEAFILE_SERVER%%/upgrade/sql/3.1.0/mysql/seahub.sql
%%SEAFILE_SERVER%%/upgrade/sql/3.1.0/sqlite3/seahub.sql
+%%SEAFILE_SERVER%%/upgrade/sql/4.1.0/mysql/ccnet.sql
+%%SEAFILE_SERVER%%/upgrade/sql/4.1.0/mysql/seafile.sql
+%%SEAFILE_SERVER%%/upgrade/sql/4.1.0/sqlite3/ccnet/groupmgr.sql
+%%SEAFILE_SERVER%%/upgrade/sql/4.1.0/sqlite3/seafile.sql
+%%SEAFILE_SERVER%%/upgrade/sql/4.2.0/mysql/seafile.sql
+%%SEAFILE_SERVER%%/upgrade/sql/4.2.0/mysql/seahub.sql
+%%SEAFILE_SERVER%%/upgrade/sql/4.2.0/sqlite3/seafile.sql
+%%SEAFILE_SERVER%%/upgrade/sql/4.2.0/sqlite3/seahub.sql
+%%SEAFILE_SERVER%%/upgrade/sql/4.3.0/mysql/.gitkeep
+%%SEAFILE_SERVER%%/upgrade/sql/4.3.0/sqlite3/.gitkeep
+%%SEAFILE_SERVER%%/upgrade/sql/4.4.0/mysql/.gitkeep
+%%SEAFILE_SERVER%%/upgrade/sql/4.4.0/sqlite3/.gitkeep
%%SEAFILE_SERVER%%/upgrade/upgrade_1.2_1.3.sh
%%SEAFILE_SERVER%%/upgrade/upgrade_1.3_1.4.sh
%%SEAFILE_SERVER%%/upgrade/upgrade_1.4_1.5.sh
@@ -81,4 +97,11 @@
%%SEAFILE_SERVER%%/upgrade/upgrade_2.2_3.0.sh
%%SEAFILE_SERVER%%/upgrade/upgrade_3.0_3.1.sh
%%SEAFILE_SERVER%%/upgrade/upgrade_3.1_4.0.sh
+%%SEAFILE_SERVER%%/upgrade/upgrade_4.0_4.1.sh
+%%SEAFILE_SERVER%%/upgrade/upgrade_4.1_4.2.sh
+%%SEAFILE_SERVER%%/upgrade/upgrade_4.2_4.3.sh
+%%SEAFILE_SERVER%%/upgrade/upgrade_4.3_4.4.sh
+%%SEAFILE_SERVER%%/upgrade/sql/5.0.0/mysql/seahub.sql
+%%SEAFILE_SERVER%%/upgrade/sql/5.0.0/sqlite3/seahub.sql
+%%SEAFILE_SERVER%%/upgrade/upgrade_4.4_5.0.sh
@dir(%%SEAFILE_USERNAME%%,%%SEAFILE_GROUPNAME%%,755) %%HAIWENDIR%%

File Metadata

Mime Type
text/plain
Expires
Sat, Feb 14, 5:50 AM (27 m, 54 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28689689
Default Alt Text
D3947.id11782.diff (25 KB)

Event Timeline