View | Details | Raw Unified | Return to bug 215360 | Differences between
and this patch

Collapse All | Expand All

(-)current/net-mgmt/seafile/Makefile (-133 lines)
Lines 1-133 Link Here
1
# $FreeBSD$
2
3
PORTNAME=	seafile
4
PORTVERSION=	6.0.0
5
DISTVERSIONPREFIX=	v
6
DISTVERSIONSUFFIX=	-server
7
CATEGORIES=	net-mgmt
8
9
MAINTAINER=	ultima1252@gmail.com
10
COMMENT=	Open Source Cloud Storage (Server)
11
12
LICENSE=	GPLv3
13
LICENSE_FILE=	${WRKSRC}/LICENSE.txt
14
15
BUILD_DEPENDS=	valac:lang/vala
16
LIB_DEPENDS=	libsearpc.so:devel/libsearpc \
17
		libevhtp.so:www/libevhtp \
18
		libzdb.so:databases/libzdb \
19
		libcurl.so:ftp/curl \
20
		libinotify.so:devel/libinotify \
21
		libccnet.so:net-mgmt/ccnet \
22
		libevent.so:devel/libevent2 \
23
		libuuid.so:misc/e2fsprogs-libuuid \
24
		libjansson.so:devel/jansson
25
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3 \
26
		${PYTHON_PKGNAMEPREFIX}urllib3>0:net/py-urllib3 \
27
		bash:shells/bash
28
29
CONFLICTS=	seafile-server-[0-9]*
30
31
USE_GITHUB=	yes
32
GH_ACCOUNT=	haiwen
33
34
USES=		autoreconf gettext iconv libarchive libtool mysql pathfix \
35
		pkgconfig python:-2.7 shebangfix sqlite ssl
36
USE_GNOME=	glib20
37
SHEBANG_FILES=	scripts/*.sh scripts/upgrade/*.sh  tests/*.py tests/basic/*.sh \
38
		tests/sync-auto-test/*.template *.sh scripts/build/*.py \
39
		scripts/*.py *.py scripts/upgrade/*.py app/seaf-cli \
40
		tools/seafile-admin
41
GNU_CONFIGURE=	yes
42
USE_LDCONFIG=	yes
43
CONFIGURE_ENV=	SSL_CFLAGS="${OPENSSLINC}" SSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto"
44
45
CONFIGURE_ARGS=	--enable-server
46
INSTALL_TARGET=	install-strip
47
CPPFLAGS+=	-I${LOCALBASE}/include -I${LOCALBASE}/include/evhtp
48
LDFLAGS+=	-L${LOCALBASE}/lib
49
50
HAIWENDIR=	www/haiwen
51
SEAFILE_SERVER=	${HAIWENDIR}/seafile-server
52
SEABIN=		${SEAFILE_SERVER}/seafile/bin
53
SEALIB=		${SEAFILE_SERVER}/seafile/lib
54
55
USERS=		seafile
56
GROUPS=		${USERS}
57
58
USE_RC_SUBR=	${PORTNAME}
59
PLIST_SUB=	USERS=${USERS} \
60
		GROUPS=${GROUPS} \
61
		SEAFILE_SERVER=${SEAFILE_SERVER} \
62
		HAIWENDIR=${HAIWENDIR}
63
64
SUB_FILES=	pkg-message
65
66
SUB_LIST+=	USERS=${USERS} \
67
		GROUPS=${GROUPS} \
68
		SEAFILE_SERVER=${SEAFILE_SERVER} \
69
		HAIWENDIR=${HAIWENDIR}
70
71
MAKE_JOBS_UNSAFE=	yes
72
73
OPTIONS_DEFINE=		FUSE RIAK
74
OPTIONS_SUB=		yes
75
76
FUSE_DESC=		Use file system in userspace
77
RIAK_DESC=		Use distributed noSQL database
78
79
FUSE_CONFIGURE_ENABLE=	fuse
80
FUSE_LIB_DEPENDS=	libfuse.so:sysutils/fusefs-libs
81
82
RIAK_CONFIGURE_ENABLE=	riak
83
RIAK_RUN_DEPENDS=	riak:databases/riak
84
85
OPTIONS_DEFAULT=	FUSE
86
OPTIONS_EXCLUDE_DragonFly=	FUSE
87
88
.include <bsd.port.options.mk>
89
90
post-patch:
91
# Fix P_KTHREAD r295435
92
.if ${OSVERSION} >= 1100097
93
	${REINPLACE_CMD} 's/P_KTHREAD/P_KPROC/' ${WRKSRC}/lib/utils.c
94
.endif
95
	${REINPLACE_CMD} 's/python/${PYTHON_VERSION}/' \
96
		${WRKSRC}/scripts/upgrade/regenerate_secret_key.sh
97
	${REINPLACE_CMD} -e 's|^INSTALL.*|INSTALLPATH="${PREFIX}/${SEAFILE_SERVER}/seafile"|' \
98
			${WRKSRC}/scripts/seaf-cli-wrapper.sh
99
	${REINPLACE_CMD} 's/<evhtp.h>/<evhtp\/evhtp.h>/' ${WRKSRC}/server/upload-file.c \
100
			${WRKSRC}/server/access-file.c ${WRKSRC}/server/http-server.c
101
post-install:
102
	@${MKDIR} ${STAGEDIR}${PREFIX}/${SEABIN} ${STAGEDIR}${PREFIX}/${SEALIB} \
103
		${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/seafile/share/doc/seafile \
104
		${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/upgrade
105
.for SERVPROG in seaf-fsck seafserv-gc seaf-fuse seaf-migrate \
106
		seaf-server seaf-server-init seafile-controller
107
	if [ -e "${STAGEDIR}${PREFIX}/bin/${SERVPROG}" ]; then \
108
		${INSTALL_PROGRAM} ${STAGEDIR}${PREFIX}/bin/${SERVPROG} ${STAGEDIR}${PREFIX}/${SEABIN}; \
109
		${RM} ${STAGEDIR}${PREFIX}/bin/${SERVPROG}; \
110
	fi
111
.endfor
112
.for SERVPROG in seafile-controller seaf-server
113
	${LN} -s ${PREFIX}/${SEABIN}/${SERVPROG} ${STAGEDIR}${PREFIX}/bin/
114
.endfor
115
116
	${INSTALL_SCRIPT} ${STAGEDIR}${PREFIX}/bin/seaf-cli ${STAGEDIR}${PREFIX}/${SEABIN}/seaf-cli.py
117
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/seaf-cli-wrapper.sh ${STAGEDIR}${PREFIX}/bin/seaf-cli
118
	(cd ${STAGEDIR}${PREFIX}/lib && \
119
		${COPYTREE_SHARE} ${PYTHON_VERSION} ${STAGEDIR}${PREFIX}/${SEALIB})
120
	@${RM} -r ${STAGEDIR}${PREFIX}/lib/${PYTHON_VERSION} \
121
		${WRKSRC}/scripts/seaf-cli-wrapper.sh \
122
		${WRKSRC}/scripts/sqlite2mysql.[ps][yh] \
123
		${WRKSRC}/scripts/setup-seafile.sh \
124
		${STAGEDIR}${PREFIX}/bin/seafile-admin
125
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/*.[ps][yh] ${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}
126
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/upgrade/*.[ps][yh] \
127
		${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/upgrade
128
	${INSTALL_DATA} ${WRKSRC}/doc/seafile-tutorial.doc \
129
		${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/seafile/share/doc/seafile/
130
	(cd ${WRKSRC}/scripts/upgrade && \
131
		${COPYTREE_SHARE} sql ${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/upgrade)
132
133
.include <bsd.port.mk>
(-)current/net-mgmt/seafile/distinfo (-3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1470238743
2
SHA256 (haiwen-seafile-v6.0.0-server_GH0.tar.gz) = 778b4248c6596f25d337ea18b9422eeb6950c9b86456ac535c0f7c2fd5e8148f
3
SIZE (haiwen-seafile-v6.0.0-server_GH0.tar.gz) = 1149598
(-)current/net-mgmt/seafile/files/patch-common_obj-backend-fs.c (-20 lines)
Lines 1-20 Link Here
1
--- common/obj-backend-fs.c.orig	2015-09-21 03:42:11 UTC
2
+++ common/obj-backend-fs.c
3
@@ -101,7 +101,7 @@ obj_backend_fs_read (ObjBackend *bend,
4
 static int
5
 fsync_obj_contents (int fd)
6
 {
7
-#ifdef __linux__
8
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
9
     /* Some file systems may not support fsync().
10
      * In this case, just skip the error.
11
      */
12
@@ -153,7 +153,7 @@ fsync_obj_contents (int fd)
13
 static int
14
 rename_and_sync (const char *tmp_path, const char *obj_path)
15
 {
16
-#ifdef __linux__
17
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
18
     char *parent_dir;
19
     int ret = 0;
20
 
(-)current/net-mgmt/seafile/files/patch-configure.ac (-119 lines)
Lines 1-119 Link Here
1
--- configure.ac.orig	2016-05-10 12:25:35 UTC
2
+++ configure.ac
3
@@ -50,8 +50,16 @@ else
4
   AC_MSG_RESULT(no)
5
 fi
6
 
7
+AC_MSG_CHECKING(for BSD)
8
+if test `uname | grep -e BSD -e DragonFly | wc -l` = "1"; then
9
+  bbsd=true
10
+  AC_MSG_RESULT(compile in BSD)
11
+else
12
+  AC_MSG_RESULT(no)
13
+fi
14
+
15
 AC_MSG_CHECKING(for Linux)
16
-if test "$bmac" != "true" -a "$bwin32" != "true"; then
17
+if test "$bmac" != "true" -a "$bwin32" != "true" -a "$bbsd" != "true"; then
18
   blinux=true
19
   AC_MSG_RESULT(compile in linux)
20
 else
21
@@ -93,6 +101,11 @@ if test "$bwin32" != true; then
22
       [compile_fuse=$enableval],[compile_fuse="yes"])
23
 fi
24
 
25
+if test "$bbsd" = true; then
26
+   AC_ARG_ENABLE(fuse, AC_HELP_STRING([--enable-fuse], [enable fuse virtual file system]),
27
+      [compile_fuse=$enableval],[compile_fuse="no"])
28
+fi
29
+
30
 AC_ARG_ENABLE(client, AC_HELP_STRING([--enable-client], [enable client]),
31
    [compile_client=$enableval],[compile_client="yes"])
32
 
33
@@ -148,6 +161,7 @@ AM_CONDITIONAL([COMPILE_FUSE], [test "${
34
 
35
 AM_CONDITIONAL([WIN32], [test "$bwin32" = "true"])
36
 AM_CONDITIONAL([MACOS], [test "$bmac" = "true"])
37
+AM_CONDITIONAL([BSD], [test "$bbsd" = "true"])
38
 AM_CONDITIONAL([LINUX], [test "$blinux" = "true"])
39
 
40
 
41
@@ -193,6 +207,9 @@ if test "$bwin32" = true; then
42
   LIB_MAC=
43
   MSVC_CFLAGS="-D__MSVCRT__ -D__MSVCRT_VERSION__=0x0601"
44
   LIB_CRYPT32=-lcrypt32
45
+  ZLIB_LIBS=
46
+  LIB_INOTIFY=
47
+  LIB_KVM=
48
 elif test "$bmac" = true ; then
49
   LIB_WS32=
50
   LIB_GDI32=
51
@@ -207,6 +224,26 @@ elif test "$bmac" = true ; then
52
   LIB_MAC="-framework CoreServices"
53
   LIB_CRYPT32=
54
   LIB_ICONV=-liconv
55
+  ZLIB_LIBS=
56
+  LIB_INOTIFY=
57
+  LIB_KVM=
58
+elif test "$bbsd" = true ; then
59
+  LIB_WS32=
60
+  LIB_GDI32=
61
+  LIB_RT=
62
+  LIB_INTL=
63
+  LIB_RESOLV=
64
+  LIB_UUID=-luuid
65
+  LIB_IPHLPAPI=
66
+  LIB_SHELL32=
67
+  LIB_PSAPI=
68
+  LIB_MAC=
69
+  MSVC_CFLAGS=
70
+  LIB_CRYPT32=
71
+  LIB_ICONV=-liconv
72
+  ZLIB_LIBS=-lz
73
+  LIB_INOTIFY=-linotify
74
+  LIB_KVM=-lkvm
75
 else
76
   LIB_WS32=
77
   LIB_GDI32=
78
@@ -220,6 +257,9 @@ else
79
   LIB_MAC=
80
   MSVC_CFLAGS=
81
   LIB_CRYPT32=
82
+  ZLIB_LIBS=-lz
83
+  LIB_INOTIFY=-linotify
84
+  LIB_KVM=
85
 fi
86
 
87
 AC_SUBST(LIB_WS32)
88
@@ -232,6 +272,9 @@ AC_SUBST(LIB_IPHLPAPI)
89
 AC_SUBST(LIB_SHELL32)
90
 AC_SUBST(LIB_PSAPI)
91
 AC_SUBST(LIB_MAC)
92
+AC_SUBST(ZLIB_LIBS)
93
+AC_SUBST(LIB_INOTIFY)
94
+AC_SUBST(LIB_KVM)
95
 AC_SUBST(MSVC_CFLAGS)
96
 AC_SUBST(LIB_CRYPT32)
97
 AC_SUBST(LIB_ICONV)
98
@@ -246,7 +289,9 @@ ZDB_REQUIRED=2.10
99
 #LIBNAUTILUS_EXTENSION_REQUIRED=2.30.1
100
 CURL_REQUIRED=7.17
101
 FUSE_REQUIRED=2.7.3
102
+if test "$blinux" = true ; then
103
 ZLIB_REQUIRED=1.2.0
104
+fi
105
 
106
 PKG_CHECK_MODULES(SSL, [openssl])
107
 AC_SUBST(SSL_CFLAGS)
108
@@ -276,9 +321,11 @@ PKG_CHECK_MODULES(LIBEVENT, [libevent >=
109
 AC_SUBST(LIBEVENT_CFLAGS)
110
 AC_SUBST(LIBEVENT_LIBS)
111
 
112
+if test "$blinux" = true ; then
113
 PKG_CHECK_MODULES(ZLIB, [zlib >= $ZLIB_REQUIRED])
114
 AC_SUBST(ZLIB_CFLAGS)
115
 AC_SUBST(ZLIB_LIBS)
116
+fi
117
 
118
 if test x${compile_python} = xyes; then
119
    AM_PATH_PYTHON([2.6])
(-)current/net-mgmt/seafile/files/patch-controller_seafile-controller.c (-104 lines)
Lines 1-104 Link Here
1
--- controller/seafile-controller.c.orig	2015-09-21 03:42:11 UTC
2
+++ controller/seafile-controller.c
3
@@ -17,6 +17,19 @@
4
 #include "log.h"
5
 #include "seafile-controller.h"
6
 
7
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
8
+#include <sys/sysctl.h>
9
+#include <sys/types.h>
10
+#include <sys/user.h>
11
+#include <limits.h>
12
+
13
+#ifndef WITH_PROC_FS
14
+#define WITH_PROC_FS g_file_test("/proc/curproc", G_FILE_TEST_EXISTS)
15
+#endif
16
+
17
+static char *command_name = NULL;
18
+#endif
19
+
20
 #define CHECK_PROCESS_INTERVAL 10        /* every 10 seconds */
21
 
22
 SeafileController *ctl;
23
@@ -247,7 +260,20 @@ static void
24
 init_seafile_path ()
25
 {
26
     GError *error = NULL;
27
+#if defined(__linux__)
28
     char *executable = g_file_read_link ("/proc/self/exe", &error);
29
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
30
+    /*
31
+     * seafile.sh starts the process using abs path
32
+     */
33
+    char executable[_POSIX_PATH_MAX];
34
+    memset(executable, 0, _POSIX_PATH_MAX);
35
+    char * rc = realpath(command_name, executable);
36
+    if (!rc) {
37
+        seaf_warning ("failed to readpath: %s\n", executable);
38
+        return;
39
+    }
40
+#endif
41
     char *tmp = NULL;
42
     if (error != NULL) {
43
         seaf_warning ("failed to readlink: %s\n", error->message);
44
@@ -261,7 +287,9 @@ init_seafile_path ()
45
 
46
     topdir = g_path_get_dirname (installpath);
47
 
48
+#if defined(__linux__)
49
     g_free (executable);
50
+#endif
51
     g_free (tmp);
52
 }
53
 
54
@@ -402,11 +430,40 @@ need_restart (int which)
55
         return FALSE;
56
     } else {
57
         char buf[256];
58
+	gboolean with_procfs;
59
+#if defined(__linux__)
60
+	with_procfs = g_file_test("/proc/self", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR);
61
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
62
+	with_procfs = g_file_test("/proc/curproc", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR);
63
+#else
64
+	with_procfs = FALSE;
65
+#endif
66
+	if (with_procfs) {
67
         snprintf (buf, sizeof(buf), "/proc/%d", pid);
68
         if (g_file_test (buf, G_FILE_TEST_IS_DIR)) {
69
             return FALSE;
70
         } else {
71
             return TRUE;
72
+	}
73
+
74
+	} else {
75
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
76
+#ifdef __OpenBSD__
77
+            int min[6] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), 1};
78
+#else
79
+            int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};
80
+#endif
81
+            size_t len = sizeof(struct kinfo_proc);
82
+            struct kinfo_proc kp;
83
+            if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &kp, &len, NULL, 0) != -1 && 
84
+	        len == sizeof(struct kinfo_proc)) {
85
+                return FALSE;        
86
+            } else {
87
+                return TRUE;
88
+            }
89
+#else
90
+	return FALSE;
91
+#endif
92
         }
93
     }
94
 }
95
@@ -877,6 +934,9 @@ int main (int argc, char **argv)
96
         exit (1);
97
     }
98
 
99
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
100
+    command_name = argv[0];
101
+#endif
102
     char *config_dir = DEFAULT_CONFIG_DIR;
103
     char *seafile_dir = NULL;
104
     char *logdir = NULL;
(-)current/net-mgmt/seafile/files/patch-daemon_Makefile.am (-22 lines)
Lines 1-22 Link Here
1
--- daemon/Makefile.am.orig	2016-04-15 23:08:45 UTC
2
+++ daemon/Makefile.am
3
@@ -63,6 +63,10 @@ if LINUX
4
 wt_monitor_src = wt-monitor.c wt-monitor-linux.c wt-monitor-structs.c
5
 endif
6
 
7
+if BSD
8
+wt_monitor_src = wt-monitor.c wt-monitor-linux.c wt-monitor-structs.c
9
+endif
10
+
11
 if WIN32
12
 wt_monitor_src = wt-monitor.c wt-monitor-win32.c wt-monitor-structs.c
13
 endif
14
@@ -126,6 +130,7 @@ seaf_daemon_LDADD = $(top_builddir)/lib/
15
 	@GLIB2_LIBS@  @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ -lsqlite3 @LIBEVENT_LIBS@ \
16
 	$(top_builddir)/common/cdc/libcdc.la \
17
 	$(top_builddir)/common/index/libindex.la @LIB_WS32@ @LIB_CRYPT32@ \
18
-	@SEARPC_LIBS@ @CCNET_LIBS@ @GNOME_KEYRING_LIBS@ @JANSSON_LIBS@ @LIB_MAC@ @ZLIB_LIBS@ @CURL_LIBS@ @BPWRAPPER_LIBS@
19
+	@SEARPC_LIBS@ @CCNET_LIBS@ @GNOME_KEYRING_LIBS@ @JANSSON_LIBS@ \
20
+	@LIB_MAC@ @ZLIB_LIBS@ @CURL_LIBS@ @LIB_INOTIFY@ @BPWRAPPER_LIBS@
21
 
22
 seaf_daemon_LDFLAGS = @STATIC_COMPILE@ @CONSOLE@
(-)current/net-mgmt/seafile/files/patch-daemon_http-tx-mgr.c (-25 lines)
Lines 1-25 Link Here
1
--- daemon/http-tx-mgr.c.orig	2015-09-21 03:42:11 UTC
2
+++ daemon/http-tx-mgr.c
3
@@ -58,6 +58,22 @@
4
 #define USER_AGENT_OS "Linux"
5
 #endif
6
 
7
+#ifdef __FreeBSD__
8
+#define USER_AGENT_OS "FreeBSD"
9
+#endif
10
+
11
+#ifdef __DragonFly__
12
+#define USER_AGENT_OS "DragonFly"
13
+#endif
14
+
15
+#ifdef __NetBSD__
16
+#define USER_AGENT_OS "NetBSD"
17
+#endif
18
+
19
+#ifdef __OpenBSD__
20
+#define USER_AGENT_OS "OpenBSD"
21
+#endif
22
+
23
 struct _Connection {
24
     CURL *curl;
25
     gint64 ctime;               /* Used to clean up unused connection. */
(-)current/net-mgmt/seafile/files/patch-daemon_repo-mgr.c (-47 lines)
Lines 1-47 Link Here
1
--- daemon/repo-mgr.c.orig	2016-05-10 12:25:35 UTC
2
+++ daemon/repo-mgr.c
3
@@ -4441,7 +4441,7 @@ checkout_file (const char *repo_id,
4
     gboolean force_conflict = FALSE;
5
     gboolean update_mode_only = FALSE;
6
 
7
-#ifndef __linux__
8
+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
9
     path = build_case_conflict_free_path (worktree, name,
10
                                           conflict_hash, no_conflict_hash,
11
                                           &case_conflict,
12
@@ -4617,7 +4617,7 @@ checkout_empty_dir (const char *worktree
13
     char *path;
14
     gboolean case_conflict = FALSE;
15
 
16
-#ifndef __linux__
17
+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
18
     path = build_case_conflict_free_path (worktree, name,
19
                                           conflict_hash, no_conflict_hash,
20
                                           &case_conflict,
21
@@ -5038,7 +5038,7 @@ schedule_file_fetch (GThreadPool *tpool,
22
     }
23
 
24
     if (!skip_fetch) {
25
-#ifndef __linux__
26
+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
27
         gboolean case_conflict = FALSE;
28
         path = build_case_conflict_free_path (worktree, de->name,
29
                                               conflict_hash, no_conflict_hash,
30
@@ -5185,7 +5185,7 @@ checkout_file_http (FileTxData *data,
31
      * A.txt to checkout, we can only detect case conflict after one file is checkecd
32
      * out. So we need to generate a new one here.
33
      */
34
-#ifndef __linux__
35
+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
36
     path = build_case_conflict_free_path (worktree, de->name,
37
                                           conflict_hash, no_conflict_hash,
38
                                           &case_conflict,
39
@@ -5567,7 +5567,7 @@ do_rename_in_worktree (DiffEntry *de, co
40
     old_path = g_build_filename (worktree, de->name, NULL);
41
 
42
     if (seaf_util_exists (old_path)) {
43
-#ifndef __linux__
44
+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
45
         gboolean case_conflict;
46
         new_path = build_case_conflict_free_path (worktree, de->new_name,
47
                                                   conflict_hash, no_conflict_hash,
(-)current/net-mgmt/seafile/files/patch-daemon_vc-utils.c (-20 lines)
Lines 1-20 Link Here
1
--- daemon/vc-utils.c.orig	2016-04-05 08:38:26 UTC
2
+++ daemon/vc-utils.c
3
@@ -664,7 +664,7 @@ error:
4
 
5
 #endif  /* defined WIN32 || defined __APPLE__ */
6
 
7
-#ifdef __linux__
8
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
9
 
10
 char *
11
 build_checkout_path (const char *worktree, const char *ce_name, int len)
12
@@ -724,7 +724,7 @@ checkout_entry (struct cache_entry *ce,
13
     gboolean force_conflict = FALSE;
14
 
15
     path_in = g_build_path ("/", o->base, ce->name, NULL);
16
-#ifndef __linux__
17
+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
18
     path = build_case_conflict_free_path (o->base, ce->name,
19
                                           conflict_hash, no_conflict_hash,
20
                                           &case_conflict,
(-)current/net-mgmt/seafile/files/patch-lib_Makefile.am (-29 lines)
Lines 1-29 Link Here
1
--- lib/Makefile.am.orig	2015-10-12 04:12:33 UTC
2
+++ lib/Makefile.am
3
@@ -53,6 +53,7 @@ libseafile_common_la_SOURCES = ${seafile
4
 libseafile_common_la_LDFLAGS = -no-undefined
5
 libseafile_common_la_LIBADD = @GLIB2_LIBS@  @GOBJECT_LIBS@ @SSL_LIBS@ -lcrypto @LIB_GDI32@ \
6
 				     @LIB_UUID@ @LIB_WS32@ @LIB_PSAPI@ -lsqlite3 \
7
+				@LIB_KVM@ \
8
 					 @LIBEVENT_LIBS@ @SEARPC_LIBS@ @LIB_SHELL32@ \
9
 	@ZLIB_LIBS@
10
 
11
@@ -74,7 +75,7 @@ vala.stamp: ${seafile_object_define}
12
 	rm -f ${seafile_object_gen}
13
 	@rm -f vala.tmp
14
 	@touch vala.tmp
15
-	valac -C --pkg posix $^
16
+	valac -C --pkg posix ${seafile_object_define}
17
 	@mv -f vala.tmp $@
18
 
19
 ${seafile_object_gen}: vala.stamp
20
@@ -90,5 +91,9 @@ install-data-local:
21
 if MACOS
22
 	sed -i '' -e "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
23
 else
24
+if BSD
25
+	sed -i '' "s|(DESTDIR)|${PREFIX}|g" $(pcfiles)
26
+else
27
 	${SED} -i "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
28
 endif
29
+endif
(-)current/net-mgmt/seafile/files/patch-lib_net.c (-14 lines)
Lines 1-14 Link Here
1
--- lib/net.c.orig	2015-09-21 03:42:11 UTC
2
+++ lib/net.c
3
@@ -157,7 +157,11 @@ ccnet_net_bind_tcp (int port, int nonblo
4
 
5
     snprintf (buf, sizeof(buf), "%d", port);
6
 
7
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
8
+    if ( (n = getaddrinfo("0.0.0.0", buf, &hints, &res) ) != 0) {
9
+#else
10
     if ( (n = getaddrinfo(NULL, buf, &hints, &res) ) != 0) {
11
+#endif
12
         ccnet_warning ("getaddrinfo fails: %s\n", gai_strerror(n));
13
         return -1;
14
     }
(-)current/net-mgmt/seafile/files/patch-lib_utils.c (-195 lines)
Lines 1-195 Link Here
1
--- lib/utils.c.orig	2015-09-21 03:42:11 UTC
2
+++ lib/utils.c
3
@@ -56,6 +56,16 @@
4
 
5
 #include <zlib.h>
6
 
7
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
8
+#include <netinet/in.h>
9
+#include <stdlib.h>
10
+#include <kvm.h>
11
+#include <paths.h>
12
+#include <sys/param.h>
13
+#include <sys/sysctl.h>
14
+#include <sys/user.h>
15
+#endif
16
+
17
 extern int inet_pton(int af, const char *src, void *dst);
18
 
19
 
20
@@ -2112,14 +2122,19 @@ wchar_from_utf8 (const char *utf8)
21
 
22
 #endif  /* ifdef WIN32 */
23
 
24
-#ifdef __linux__
25
 /* read the link of /proc/123/exe and compare with `process_name' */
26
 static int
27
 find_process_in_dirent(struct dirent *dir, const char *process_name)
28
 {
29
     char path[512];
30
     /* fisrst construct a path like /proc/123/exe */
31
+#if defined(__linux__)
32
     if (sprintf (path, "/proc/%s/exe", dir->d_name) < 0) {
33
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
34
+    if (sprintf (path, "/proc/%s/file", dir->d_name) < 0) {
35
+#else
36
+    if (1) {
37
+#endif
38
         return -1;
39
     }
40
 
41
@@ -2143,7 +2158,8 @@ find_process_in_dirent(struct dirent *di
42
 }
43
 
44
 /* read the /proc fs to determine whether some process is running */
45
-gboolean process_is_running (const char *process_name)
46
+static gboolean 
47
+process_is_running_procfs (const char *process_name)
48
 {
49
     DIR *proc_dir = opendir("/proc");
50
     if (!proc_dir) {
51
@@ -2168,7 +2184,8 @@ gboolean process_is_running (const char 
52
     return FALSE;
53
 }
54
 
55
-int count_process(const char *process_name)
56
+static int 
57
+count_process_procfs(const char *process_name)
58
 {
59
     int count = 0;
60
     DIR *proc_dir = opendir("/proc");
61
@@ -2192,6 +2209,14 @@ int count_process(const char *process_na
62
     return count;
63
 }
64
 
65
+#ifdef __linux__
66
+gboolean process_is_running(const char *process_name) {
67
+    return process_is_running_procfs(process_name);
68
+}
69
+
70
+int count_process(const char *process_name) {
71
+    return count_process_procfs(process_name);
72
+}
73
 #endif
74
 
75
 #ifdef __APPLE__
76
@@ -2202,6 +2227,119 @@ gboolean process_is_running (const char 
77
 }
78
 #endif
79
 
80
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
81
+#if defined(__FreeBSD__)
82
+#define PSKIP(kp) ((kp)->ki_pid == mypid ||               \
83
+                   (!kthreads && ((kp)->ki_flag & P_KTHREAD) != 0))
84
+#define KVM_OPENFILES(exec, coref, buf) \
85
+		kvm_openfiles(exec, coref, NULL, O_RDONLY, buf)
86
+#define KVM_GETPROCS(kd, plist, nproc) \
87
+       		kvm_getprocs(kd, KERN_PROC_PROC, 0, &nproc)
88
+
89
+#elif defined(__DragonFly__)
90
+#define	PSKIP(kp) ((kp)->kp_pid == mypid ||			\
91
+		   (!kthreads && ((kp)->kp_flags & P_SYSTEM) != 0))
92
+#define KVM_OPENFILES(exec, coref, buf) \
93
+		kvm_openfiles(exec, coref, NULL, O_RDONLY, buf)
94
+#define KVM_GETPROCS(kd, plist, nproc) \
95
+		kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc)
96
+
97
+#elif defined(__NetBSD__)
98
+#define	PSKIP(kp) ((kp)->kp_pid == mypid ||			\
99
+		   ((kp)->p_flag & P_SYSTEM) != 0)
100
+#define KVM_OPENFILES(exec, coref, buf) \
101
+		kvm_openfiles(exec, coref, NULL, KVM_NO_FILES, buf)
102
+#define KVM_GETPROCS(kd, plist, nproc) \
103
+		kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*plist), &nproc)
104
+
105
+#elif defined(__OpenBSD__)
106
+#define	PSKIP(kp) ((kp)->kp_pid == mypid ||			\
107
+		   ((kp)->p_flag & (P_SYSTEM | P_THREAD)) != 0)
108
+#define KVM_OPENFILES(exec, coref, buf) \
109
+		kvm_openfiles(exec, coref, NULL, KVM_NO_FILES, buf)
110
+#define KVM_GETPROCS(kd, plist, nproc) \
111
+		kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*plist), &nproc)
112
+
113
+#else
114
+#define PSKIP(kp) 0
115
+#define KVM_OPENFILES(exec, coref, buf) 0
116
+#define KVM_GETPROCS(kd, plist, nproc) 0
117
+#endif
118
+
119
+#ifndef WITH_PROC_FS
120
+#define WITH_PROC_FS g_file_test("/proc/curproc", G_FILE_TEST_EXISTS)
121
+#endif
122
+
123
+static int 
124
+count_running_process_kvm(const char *process_name) {
125
+    
126
+    
127
+    static kvm_t    *kd;
128
+    static struct    kinfo_proc *plist;
129
+    static int    nproc;
130
+    static pid_t    mypid;
131
+    static int      kthreads;
132
+
133
+    char buf[_POSIX2_LINE_MAX]; 
134
+    const char * execf, *coref;
135
+    char **pargv;
136
+    int i, selected_nproc;
137
+    struct kinfo_proc *kp;
138
+
139
+    selected_nproc = 0;
140
+    execf = NULL;
141
+    coref = _PATH_DEVNULL;
142
+    
143
+    mypid = getpid();
144
+    kd = KVM_OPENFILES(execf, coref, buf);
145
+    if (kd == NULL) {
146
+        fprintf(stderr, "Error: Cannot open kernel files (%s)", buf);
147
+        exit(1);
148
+    }
149
+
150
+    plist = KVM_GETPROCS(kd, plist, nproc);
151
+    if (plist == NULL) {
152
+        fprintf(stderr, "Error: Cannot get process list (%s)", kvm_geterr(kd));
153
+        exit(1);
154
+    }
155
+
156
+    for(i = 0, kp = plist; i < nproc; i++, kp++) {
157
+        if (PSKIP(kp)) {
158
+            continue;
159
+        }
160
+        if ((pargv = kvm_getargv(kd, kp, 0)) != NULL) {
161
+            if (strstr(pargv[0], process_name) != NULL) {
162
+                selected_nproc += 1;
163
+            }
164
+        }
165
+    }
166
+    kvm_close(kd);
167
+    kvm_close(kd);
168
+
169
+    return selected_nproc;
170
+}
171
+
172
+gboolean
173
+process_is_running(const char * process_name) {
174
+    if (WITH_PROC_FS) { 
175
+        return process_is_running_procfs(process_name);
176
+    }
177
+    if (count_running_process_kvm(process_name) > 0) {
178
+        return TRUE;
179
+    } else {
180
+        return FALSE;
181
+    }
182
+}
183
+
184
+int
185
+count_process(const char * process_name) {
186
+   if (WITH_PROC_FS) {
187
+       return count_process_procfs(process_name);
188
+   }
189
+   return count_running_process_kvm(process_name);
190
+}
191
+#endif
192
+
193
 char*
194
 ccnet_object_type_from_id (const char *object_id)
195
 {
(-)current/net-mgmt/seafile/files/patch-lib_utils.h (-23 lines)
Lines 1-23 Link Here
1
--- lib/utils.h.orig	2015-09-21 03:42:11 UTC
2
+++ lib/utils.h
3
@@ -3,6 +3,9 @@
4
 #ifndef CCNET_UTILS_H
5
 #define CCNET_UTILS_H
6
 
7
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
8
+#include <netinet/in.h>
9
+#endif
10
 #include <sys/time.h>
11
 #include <time.h>
12
 #include <stdint.h>
13
@@ -13,7 +16,9 @@
14
 #include <stdlib.h>
15
 #include <sys/stat.h>
16
 
17
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
18
+#if defined(__FreeBSD__) || defined(__DragonFly__)
19
+#include <evutil.h>
20
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
21
 #include <event2/util.h>
22
 #else
23
 #include <evutil.h>
(-)current/net-mgmt/seafile/files/patch-scripts_setup-seafile.sh (-15 lines)
Lines 1-15 Link Here
1
--- scripts/setup-seafile.sh.orig	2015-10-12 04:12:33 UTC
2
+++ scripts/setup-seafile.sh
3
@@ -340,7 +340,11 @@ fi
4
 }
5
 
6
 function copy_user_manuals() {
7
-    src_docs_dir=${INSTALLPATH}/seafile/docs/
8
+    if [ $(uname | grep -e BSD -e DragonFly | wc -l) == "1" ]; then
9
+        src_docs_dir=${INSTALLPATH}/seafile/share/doc/seafile/
10
+    else
11
+    	src_docs_dir=${INSTALLPATH}/seafile/docs/
12
+    fi
13
     library_template_dir=${seafile_data_dir}/library-template
14
     mkdir -p ${library_template_dir}
15
     cp -f ${src_docs_dir}/*.doc ${library_template_dir}
(-)current/net-mgmt/seafile/files/patch-scripts_upgrade_regenerate__secret__key.sh (-10 lines)
Lines 1-10 Link Here
1
--- scripts/upgrade/regenerate_secret_key.sh.orig	2016-01-29 17:25:05 UTC
2
+++ scripts/upgrade/regenerate_secret_key.sh
3
@@ -10,4 +10,6 @@ seahub_settings_py=${TOPDIR}/seahub_sett
4
 
5
 line="SECRET_KEY = \"$(python $seahub_secret_keygen)\""
6
 
7
-sed -i -e "/SECRET_KEY/c\\$line" $seahub_settings_py
8
+sed -i.bak -e "/SECRET_KEY/c\\
9
+$line
10
+" $seahub_settings_py
(-)current/net-mgmt/seafile/files/patch-server_access-file.c (-54 lines)
Lines 1-54 Link Here
1
--- server/access-file.c.orig	2015-11-12 02:40:40 UTC
2
+++ server/access-file.c
3
@@ -221,10 +221,10 @@ write_block_data_cb (struct bufferevent 
4
         bev->cbarg = data->saved_cb_arg;
5
 
6
         /* Resume reading incomming requests. */
7
-        evhtp_request_resume (data->req);
8
-
9
         evhtp_send_reply_end (data->req);
10
 
11
+	evhtp_request_resume (data->req);
12
+
13
         free_sendblock_data (data);
14
         return;
15
     }
16
@@ -306,10 +306,10 @@ next:
17
             bev->cbarg = data->saved_cb_arg;
18
 
19
             /* Resume reading incomming requests. */
20
-            evhtp_request_resume (data->req);
21
-
22
             evhtp_send_reply_end (data->req);
23
 
24
+	    evhtp_request_resume (data->req);
25
+
26
             free_sendfile_data (data);
27
             return;
28
         }
29
@@ -403,10 +403,10 @@ write_dir_data_cb (struct bufferevent *b
30
             bev->cbarg = data->saved_cb_arg;
31
 
32
             /* Resume reading incomming requests. */
33
-            evhtp_request_resume (data->req);
34
-
35
             evhtp_send_reply_end (data->req);
36
 
37
+	    evhtp_request_resume (data->req);
38
+
39
             free_senddir_data (data);
40
             return;
41
         }
42
@@ -710,10 +710,10 @@ finish_file_range_request (struct buffer
43
     bev->cbarg = data->saved_cb_arg;
44
 
45
     /* Resume reading incomming requests. */
46
-    evhtp_request_resume (data->req);
47
-
48
     evhtp_send_reply_end (data->req);
49
 
50
+    evhtp_request_resume (data->req);
51
+
52
     free_send_file_range_data (data);
53
 }
54
 
(-)current/net-mgmt/seafile/files/pkg-message.in (-12 lines)
Lines 1-12 Link Here
1
For an existing config, or creating a new one, fix the UID/GID.
2
Do not change %%PREFIX%%/%%SEAFILE_SERVER%% unless your front
3
end is using the seafile UID/GID as well.
4
5
chown -R seafile:seafile %%PREFIX%%/%%HAIWENDIR%%/conf \
6
	%%PREFIX%%/%%HAIWENDIR%%/ccnet %%PREFIX%%/%%HAIWENDIR%%/seafile-data \
7
	%%PREFIX%%/%%HAIWENDIR%%/pids %%PREFIX%%/%%HAIWENDIR%%/logs
8
9
Don't forget to run update scripts after every minor and major update located in
10
	%%PREFIX%%/%%SEAFILE_SERVER%%/upgrade
11
12
Patch updates (5.1.x) don't require these scripts, however do required a restarted.
(-)current/net-mgmt/seafile/files/seafile.in (-147 lines)
Lines 1-147 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD$
4
#
5
6
# PROVIDE: seafile
7
# REQUIRE: LOGIN cleanvar mysql
8
# KEYWORD: shutdown
9
#
10
11
#
12
# Add the following lines to /etc/rc.conf to enable seafile:
13
#
14
# seafile_enable (bool):	Set to "NO" by default.
15
#				Set it to "YES" to enable seafile.
16
# seafile_user (str):		User to run seafile as
17
#				Default to "%%USERS%%" created by the port
18
# seafile_group (str):		Group to run seafile as
19
#				Default to "%%GROUPS%%" created by the port
20
# seafile_path (str):		Set to "" by default will use the path
21
#				%%PREFIX%%/%%SEAFILE_SERVER%%.
22
#				Set it to a different path.
23
# seafile_ccnet (str):		Set to "" by default will use the path
24
#				%%PREFIX%%/%%HAIWENDIR%%/ccnet.
25
#				Set it to a different path.
26
# seafile_conf (str):		Set to "" by default will use the path
27
#				%%PREFIX%%/%%HAIWENDIR%%/conf.
28
#				Set it to a different path.
29
# seafile_datadir (str):	Set to "" by default will use the path
30
#				in file %%PREFIX%%/%%HAIWENDIR%%/ccnet/seafile.ini.
31
#				Set it to a different path.
32
# seafile_logdir (str):		Set to "" by default will use the path
33
#				%%PREFIX%%/%%HAIWENDIR%%/logs
34
#				Set it to a different path.
35
# seafile_loglevel (str):	Set to "info" by default.
36
#				Possible values are debug, warning, info.
37
38
. /etc/rc.subr
39
40
name="seafile"
41
rcvar="seafile_enable"
42
43
load_rc_config $name
44
45
start_cmd="seafile_start"
46
restart_cmd="seafile_restart"
47
stop_cmd="seafile_stop"
48
49
: ${seafile_enable="NO"}
50
: ${seafile_user:="%%USERS%%"}
51
: ${seafile_group:="%%GROUPS%%"}
52
: ${seafile_path:="%%PREFIX%%/%%SEAFILE_SERVER%%"}
53
: ${seafile_ccnet:="%%PREFIX%%/%%HAIWENDIR%%/ccnet"}
54
: ${seafile_conf:="%%PREFIX%%/%%HAIWENDIR%%/conf"}
55
: ${seafile_datadir:="`cat ${seafile_ccnet}/seafile.ini 2>/dev/null`"}
56
: ${seafile_logdir:="%%PREFIX%%/%%HAIWENDIR%%/logs"}
57
: ${seafile_loglevel:="info"}
58
59
command="%%PREFIX%%/%%SEAFILE_SERVER%%/seafile/bin/seafile-controller"
60
command_args="-c \"${seafile_ccnet}\" -d \"${seafile_datadir}\" -F \"${seafile_conf}\" -L \"${seafile_logdir}\" -g \"${seafile_loglevel}\" -G \"${seafile_loglevel}\""
61
62
required_dirs="${seafile_ccnet} ${seafile_conf} ${seafile_datadir}"
63
required_files="${seafile_ccnet}/seafile.ini"
64
65
test_config() {
66
	if ! su -m ${seafile_user} -c "${command} -t ${command_args}" ; then
67
		exit 1;
68
	fi
69
}
70
71
check_component_running() {
72
	name=$1
73
	cmd=$2
74
	if pid=$(pgrep -f "$cmd" 2>/dev/null); then
75
		echo "{$name} is running, pid $pid. You can stop it by: "
76
		echo
77
		echo "        kill $pid"
78
		echo 
79
		echo "Stop it and try again."
80
		echo 
81
		exit 
82
	fi
83
}
84
85
validate_already_running() {
86
	if pid=$(pgrep -f "seafile-controller -c ${seafile_ccnet}" 2>/dev/null); then
87
		echo "Seafile controller is already running, pid $pid"
88
		echo
89
		exit 1;
90
	fi
91
92
	check_component_running "ccnet-server" "ccnet-server -c ${seafile_ccnet}"
93
	check_component_running "seaf-server" "seaf-server -c ${seafile_ccnet}"
94
	check_component_running "fileserver" "fileserver -c ${seafile_ccnet}"
95
	check_component_running "seafdav" "wsgidav.server.run_server"
96
}
97
98
prepare_env() {
99
export PATH=${seafile_path}/seafile/bin:$PATH
100
export LD_LIBRARY_PATH=${seafile_path}/seafile/lib/:${seafile_path}/seafile/lib64:${LD_LIBRARY_PATH}
101
}
102
103
seafile_start() {
104
	check_required_before;
105
	validate_already_running;
106
	test_config;
107
108
	echo "Starting seafile server, please wait ..."
109
110
	su -m "${seafile_user}" -c "mkdir -p $seafile_logdir"
111
	su -m "${seafile_user}" -c "$command $command_args"
112
113
	sleep 3
114
115
	# check if seafile server started successfully
116
	if ! pgrep -f "seafile-controller -c ${seafile_ccnet}" 2>/dev/null 1>&2; then
117
	echo "Failed to start seafile server"
118
	exit 1;
119
	fi
120
121
	echo "Seafile server started"
122
	echo
123
}
124
        
125
seafile_stop() {
126
	if ! pgrep -f "seafile-controller -c ${seafile_ccnet}" 2>/dev/null 1>&2; then
127
		echo "Seafile is not running"
128
	return 1;
129
	fi
130
 
131
	echo "Stopping ${name}."
132
	pkill -SIGTERM -f "seafile-controller -c ${seafile_ccnet}"
133
	pkill -f "ccnet-server -c ${seafile_ccnet}"
134
	pkill -f "seaf-server -c ${seafile_ccnet}"
135
	pkill -f "fileserver -c ${seafile_ccnet}"
136
	pkill -f "soffice.*--invisible --nocrashreport"
137
	pkill -f  "wsgidav.server.run_server"
138
	return 0
139
}
140
141
seafile_restart() {
142
	seafile_stop;
143
	sleep 2
144
	seafile_start;
145
}
146
147
run_rc_command "$1"
(-)current/net-mgmt/seafile/pkg-descr (-11 lines)
Lines 1-11 Link Here
1
Seafile is a next-generation open source cloud storage system with
2
advanced support for file syncing, privacy protection and teamwork.
3
Collections of files are called libraries, and each library can be synced
4
separately. A library can be encrypted with a user chosen password. This
5
password is not stored on the server, so even the server admin cannot
6
view a file's contents.
7
8
Seafile allows users to create groups with file syncing, wiki, and
9
discussion to enable easy collaboration around documents within a team.
10
11
WWW: https://github.com/haiwen/seafile
(-)current/net-mgmt/seafile/pkg-plist (-113 lines)
Lines 1-113 Link Here
1
bin/seaf-cli
2
bin/seaf-daemon
3
bin/seafile-controller
4
bin/seaf-server
5
include/seafile/monitor-rpc.h
6
include/seafile/seafile-object.h
7
include/seafile/seafile-rpc.h
8
include/seafile/seafile.h
9
lib/libseafile.a
10
lib/libseafile.so
11
lib/libseafile.so.0
12
lib/libseafile.so.0.0.0
13
libdata/pkgconfig/libseafile.pc
14
man/man1/seaf-cli.1.gz
15
man/man1/seaf-daemon.1.gz
16
%%SEAFILE_SERVER%%/check_init_admin.py
17
%%SEAFILE_SERVER%%/reset-admin.sh
18
%%SEAFILE_SERVER%%/seaf-fuse.sh
19
%%SEAFILE_SERVER%%/seaf-gc.sh
20
%%SEAFILE_SERVER%%/seafile.sh
21
%%SEAFILE_SERVER%%/seafile/bin/seaf-fsck
22
%%FUSE%%%%SEAFILE_SERVER%%/seafile/bin/seaf-fuse
23
%%SEAFILE_SERVER%%/seafile/bin/seaf-cli.py
24
%%SEAFILE_SERVER%%/seafile/bin/seaf-migrate
25
%%SEAFILE_SERVER%%/seafile/bin/seaf-server
26
%%SEAFILE_SERVER%%/seafile/bin/seaf-server-init
27
%%SEAFILE_SERVER%%/seafile/bin/seafile-controller
28
%%SEAFILE_SERVER%%/seafile/bin/seafserv-gc
29
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seafile/__init__.py
30
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seafile/__init__.pyc
31
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seafile/__init__.pyo
32
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seafile/rpcclient.py
33
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seafile/rpcclient.pyc
34
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seafile/rpcclient.pyo
35
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seaserv/__init__.py
36
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seaserv/__init__.pyc
37
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seaserv/__init__.pyo
38
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seaserv/api.py
39
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seaserv/api.pyc
40
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seaserv/api.pyo
41
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seaserv/service.py
42
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seaserv/service.pyc
43
%%SEAFILE_SERVER%%/seafile/%%PYTHON_SITELIBDIR%%/seaserv/service.pyo
44
%%PORTDOCS%%%%SEAFILE_SERVER%%/seafile/%%DOCSDIR%%/seafile-tutorial.doc
45
%%SEAFILE_SERVER%%/breakpad.py
46
%%SEAFILE_SERVER%%/seahub.sh
47
%%SEAFILE_SERVER%%/setup-seafile-mysql.py
48
%%SEAFILE_SERVER%%/setup-seafile-mysql.sh
49
%%SEAFILE_SERVER%%/upgrade/add_collate.sh
50
%%SEAFILE_SERVER%%/upgrade/db_update_1.3_1.4.py
51
%%SEAFILE_SERVER%%/upgrade/db_update_helper.py
52
%%SEAFILE_SERVER%%/upgrade/minor-upgrade.sh
53
%%SEAFILE_SERVER%%/seaf-fsck.sh
54
%%SEAFILE_SERVER%%/upgrade/fix_mysql_user.py
55
%%SEAFILE_SERVER%%/upgrade/regenerate_secret_key.sh
56
%%SEAFILE_SERVER%%/upgrade/sql/1.6.0/mysql/seahub.sql
57
%%SEAFILE_SERVER%%/upgrade/sql/1.6.0/sqlite3/seahub.sql
58
%%SEAFILE_SERVER%%/upgrade/sql/1.7.0/mysql/seafile.sql
59
%%SEAFILE_SERVER%%/upgrade/sql/1.7.0/mysql/seahub.sql
60
%%SEAFILE_SERVER%%/upgrade/sql/1.7.0/sqlite3/seafile.sql
61
%%SEAFILE_SERVER%%/upgrade/sql/1.7.0/sqlite3/seahub.sql
62
%%SEAFILE_SERVER%%/upgrade/sql/1.8.0/mysql/ccnet.sql
63
%%SEAFILE_SERVER%%/upgrade/sql/1.8.0/mysql/seahub.sql
64
%%SEAFILE_SERVER%%/upgrade/sql/1.8.0/sqlite3/seahub.sql
65
%%SEAFILE_SERVER%%/upgrade/sql/2.0.0/mysql/seahub.sql
66
%%SEAFILE_SERVER%%/upgrade/sql/2.0.0/sqlite3/seahub.sql
67
%%SEAFILE_SERVER%%/upgrade/sql/2.1.0/mysql/seahub.sql
68
%%SEAFILE_SERVER%%/upgrade/sql/2.1.0/sqlite3/seahub.sql
69
%%SEAFILE_SERVER%%/upgrade/sql/2.2.0/mysql/ccnet.sql
70
%%SEAFILE_SERVER%%/upgrade/sql/3.0.0/mysql/seahub.sql
71
%%SEAFILE_SERVER%%/upgrade/sql/3.0.0/sqlite3/seahub.sql
72
%%SEAFILE_SERVER%%/upgrade/sql/3.1.0/mysql/seahub.sql
73
%%SEAFILE_SERVER%%/upgrade/sql/3.1.0/sqlite3/seahub.sql
74
%%SEAFILE_SERVER%%/upgrade/sql/4.1.0/mysql/ccnet.sql
75
%%SEAFILE_SERVER%%/upgrade/sql/4.1.0/mysql/seafile.sql
76
%%SEAFILE_SERVER%%/upgrade/sql/4.1.0/sqlite3/ccnet/groupmgr.sql
77
%%SEAFILE_SERVER%%/upgrade/sql/4.1.0/sqlite3/seafile.sql
78
%%SEAFILE_SERVER%%/upgrade/sql/4.2.0/mysql/seafile.sql
79
%%SEAFILE_SERVER%%/upgrade/sql/4.2.0/mysql/seahub.sql
80
%%SEAFILE_SERVER%%/upgrade/sql/4.2.0/sqlite3/seafile.sql
81
%%SEAFILE_SERVER%%/upgrade/sql/4.2.0/sqlite3/seahub.sql
82
%%SEAFILE_SERVER%%/upgrade/sql/4.3.0/mysql/.gitkeep
83
%%SEAFILE_SERVER%%/upgrade/sql/4.3.0/sqlite3/.gitkeep
84
%%SEAFILE_SERVER%%/upgrade/sql/4.4.0/mysql/.gitkeep
85
%%SEAFILE_SERVER%%/upgrade/sql/4.4.0/sqlite3/.gitkeep
86
%%SEAFILE_SERVER%%/upgrade/upgrade_1.2_1.3.sh
87
%%SEAFILE_SERVER%%/upgrade/upgrade_1.3_1.4.sh
88
%%SEAFILE_SERVER%%/upgrade/upgrade_1.4_1.5.sh
89
%%SEAFILE_SERVER%%/upgrade/upgrade_1.5_1.6.sh
90
%%SEAFILE_SERVER%%/upgrade/upgrade_1.6_1.7.sh
91
%%SEAFILE_SERVER%%/upgrade/upgrade_1.7_1.8.sh
92
%%SEAFILE_SERVER%%/upgrade/upgrade_1.8_2.0.sh
93
%%SEAFILE_SERVER%%/upgrade/upgrade_2.0_2.1.sh
94
%%SEAFILE_SERVER%%/upgrade/upgrade_2.1_2.2.sh
95
%%SEAFILE_SERVER%%/upgrade/upgrade_2.2_3.0.sh
96
%%SEAFILE_SERVER%%/upgrade/upgrade_3.0_3.1.sh
97
%%SEAFILE_SERVER%%/upgrade/upgrade_3.1_4.0.sh
98
%%SEAFILE_SERVER%%/upgrade/upgrade_4.0_4.1.sh
99
%%SEAFILE_SERVER%%/upgrade/upgrade_4.1_4.2.sh
100
%%SEAFILE_SERVER%%/upgrade/upgrade_4.2_4.3.sh
101
%%SEAFILE_SERVER%%/upgrade/upgrade_4.3_4.4.sh
102
%%SEAFILE_SERVER%%/upgrade/sql/5.0.0/mysql/seahub.sql
103
%%SEAFILE_SERVER%%/upgrade/sql/5.0.0/sqlite3/seahub.sql
104
%%SEAFILE_SERVER%%/upgrade/sql/5.1.0/mysql/seafile.sql
105
%%SEAFILE_SERVER%%/upgrade/sql/5.1.0/mysql/seahub.sql
106
%%SEAFILE_SERVER%%/upgrade/sql/5.1.0/sqlite3/seafile.sql
107
%%SEAFILE_SERVER%%/upgrade/sql/5.1.0/sqlite3/seahub.sql
108
%%SEAFILE_SERVER%%/upgrade/sql/6.0.0/mysql/seahub.sql
109
%%SEAFILE_SERVER%%/upgrade/sql/6.0.0/sqlite3/seahub.sql
110
%%SEAFILE_SERVER%%/upgrade/upgrade_5.1_6.0.sh
111
%%SEAFILE_SERVER%%/upgrade/upgrade_5.0_5.1.sh
112
%%SEAFILE_SERVER%%/upgrade/upgrade_4.4_5.0.sh
113
@dir(%%USERS%%,%%GROUPS%%,755) %%HAIWENDIR%%
(-)current/net-mgmt/seafile-client/Makefile (+78 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
PORTNAME=	seafile-client
4
PORTVERSION=	6.0.1
5
DISTVERSIONPREFIX=	v
6
CATEGORIES=	net-mgmt
7
8
MAINTAINER=	ultima1252@gmail.com
9
COMMENT=	Open Source Cloud Storage (Client)
10
11
LICENSE=	GPLv3
12
LICENSE_FILE=	${WRKSRC}/LICENSE.txt
13
14
BUILD_DEPENDS=	valac:lang/vala
15
LIB_DEPENDS=	libsearpc.so:devel/libsearpc \
16
		libevhtp.so:www/libevhtp \
17
		libzdb.so:databases/libzdb \
18
		libcurl.so:ftp/curl \
19
		libinotify.so:devel/libinotify \
20
		libccnet.so:net-mgmt/ccnet-client \
21
		libevent.so:devel/libevent2 \
22
		libuuid.so:misc/e2fsprogs-libuuid \
23
		libjansson.so:devel/jansson
24
RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3 \
25
		${PYTHON_PKGNAMEPREFIX}urllib3>0:net/py-urllib3 \
26
		bash:shells/bash
27
28
CONFLICTS=	seafile-server-[0-9]*
29
30
USE_GITHUB=	yes
31
GH_ACCOUNT=	haiwen
32
GH_PROJECT=	seafile
33
34
USES=		autoreconf gettext iconv libarchive libtool mysql pathfix \
35
		pkgconfig python:-2.7 shebangfix sqlite ssl
36
USE_GNOME=	glib20
37
SHEBANG_FILES=	scripts/*.sh scripts/upgrade/*.sh  tests/*.py tests/basic/*.sh \
38
		tests/sync-auto-test/*.template *.sh scripts/build/*.py \
39
		scripts/*.py *.py scripts/upgrade/*.py app/seaf-cli \
40
		tools/seafile-admin
41
GNU_CONFIGURE=	yes
42
USE_LDCONFIG=	yes
43
CONFIGURE_ENV=	SSL_CFLAGS="${OPENSSLINC}" SSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto"
44
45
INSTALL_TARGET=	install-strip
46
CPPFLAGS+=	-I${LOCALBASE}/include -I${LOCALBASE}/include/evhtp
47
LDFLAGS+=	-L${LOCALBASE}/lib
48
49
OPTIONS_DEFINE=		FUSE RIAK
50
OPTIONS_SUB=		yes
51
52
FUSE_DESC=		Use file system in userspace
53
RIAK_DESC=		Use distributed noSQL database
54
55
FUSE_CONFIGURE_ENABLE=	fuse
56
FUSE_LIB_DEPENDS=	libfuse.so:sysutils/fusefs-libs
57
58
RIAK_CONFIGURE_ENABLE=	riak
59
RIAK_RUN_DEPENDS=	riak:databases/riak
60
61
OPTIONS_DEFAULT=	FUSE
62
OPTIONS_EXCLUDE_DragonFly=	FUSE
63
64
.include <bsd.port.options.mk>
65
66
post-patch:
67
# Fix P_KTHREAD r295435
68
.if ${OSVERSION} >= 1100097
69
	${REINPLACE_CMD} 's/P_KTHREAD/P_KPROC/' ${WRKSRC}/lib/utils.c
70
.endif
71
	${REINPLACE_CMD} 's/python/${PYTHON_VERSION}/' \
72
		${WRKSRC}/scripts/upgrade/regenerate_secret_key.sh
73
	${REINPLACE_CMD} -e 's|^INSTALL.*|INSTALLPATH="${PREFIX}/${SEAFILE_SERVER}/seafile"|' \
74
			${WRKSRC}/scripts/seaf-cli-wrapper.sh
75
	${REINPLACE_CMD} 's/<evhtp.h>/<evhtp\/evhtp.h>/' ${WRKSRC}/server/upload-file.c \
76
			${WRKSRC}/server/access-file.c ${WRKSRC}/server/http-server.c
77
78
.include <bsd.port.mk>
(-)current/net-mgmt/seafile-client/distinfo (+3 lines)
Line 0 Link Here
1
TIMESTAMP = 1481772891
2
SHA256 (haiwen-seafile-v6.0.1_GH0.tar.gz) = c212833ff21af19554d216ab3f5c01c3a5878d4bd30b4f71c67ec9b71416a095
3
SIZE (haiwen-seafile-v6.0.1_GH0.tar.gz) = 1154256
(-)current/net-mgmt/seafile-client/files/patch-common_obj-backend-fs.c (+20 lines)
Line 0 Link Here
1
--- common/obj-backend-fs.c.orig	2015-09-21 03:42:11 UTC
2
+++ common/obj-backend-fs.c
3
@@ -101,7 +101,7 @@ obj_backend_fs_read (ObjBackend *bend,
4
 static int
5
 fsync_obj_contents (int fd)
6
 {
7
-#ifdef __linux__
8
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
9
     /* Some file systems may not support fsync().
10
      * In this case, just skip the error.
11
      */
12
@@ -153,7 +153,7 @@ fsync_obj_contents (int fd)
13
 static int
14
 rename_and_sync (const char *tmp_path, const char *obj_path)
15
 {
16
-#ifdef __linux__
17
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
18
     char *parent_dir;
19
     int ret = 0;
20
 
(-)current/net-mgmt/seafile-client/files/patch-configure.ac (+119 lines)
Line 0 Link Here
1
--- configure.ac.orig	2016-05-10 12:25:35 UTC
2
+++ configure.ac
3
@@ -50,8 +50,16 @@ else
4
   AC_MSG_RESULT(no)
5
 fi
6
 
7
+AC_MSG_CHECKING(for BSD)
8
+if test `uname | grep -e BSD -e DragonFly | wc -l` = "1"; then
9
+  bbsd=true
10
+  AC_MSG_RESULT(compile in BSD)
11
+else
12
+  AC_MSG_RESULT(no)
13
+fi
14
+
15
 AC_MSG_CHECKING(for Linux)
16
-if test "$bmac" != "true" -a "$bwin32" != "true"; then
17
+if test "$bmac" != "true" -a "$bwin32" != "true" -a "$bbsd" != "true"; then
18
   blinux=true
19
   AC_MSG_RESULT(compile in linux)
20
 else
21
@@ -93,6 +101,11 @@ if test "$bwin32" != true; then
22
       [compile_fuse=$enableval],[compile_fuse="yes"])
23
 fi
24
 
25
+if test "$bbsd" = true; then
26
+   AC_ARG_ENABLE(fuse, AC_HELP_STRING([--enable-fuse], [enable fuse virtual file system]),
27
+      [compile_fuse=$enableval],[compile_fuse="no"])
28
+fi
29
+
30
 AC_ARG_ENABLE(client, AC_HELP_STRING([--enable-client], [enable client]),
31
    [compile_client=$enableval],[compile_client="yes"])
32
 
33
@@ -148,6 +161,7 @@ AM_CONDITIONAL([COMPILE_FUSE], [test "${
34
 
35
 AM_CONDITIONAL([WIN32], [test "$bwin32" = "true"])
36
 AM_CONDITIONAL([MACOS], [test "$bmac" = "true"])
37
+AM_CONDITIONAL([BSD], [test "$bbsd" = "true"])
38
 AM_CONDITIONAL([LINUX], [test "$blinux" = "true"])
39
 
40
 
41
@@ -193,6 +207,9 @@ if test "$bwin32" = true; then
42
   LIB_MAC=
43
   MSVC_CFLAGS="-D__MSVCRT__ -D__MSVCRT_VERSION__=0x0601"
44
   LIB_CRYPT32=-lcrypt32
45
+  ZLIB_LIBS=
46
+  LIB_INOTIFY=
47
+  LIB_KVM=
48
 elif test "$bmac" = true ; then
49
   LIB_WS32=
50
   LIB_GDI32=
51
@@ -207,6 +224,26 @@ elif test "$bmac" = true ; then
52
   LIB_MAC="-framework CoreServices"
53
   LIB_CRYPT32=
54
   LIB_ICONV=-liconv
55
+  ZLIB_LIBS=
56
+  LIB_INOTIFY=
57
+  LIB_KVM=
58
+elif test "$bbsd" = true ; then
59
+  LIB_WS32=
60
+  LIB_GDI32=
61
+  LIB_RT=
62
+  LIB_INTL=
63
+  LIB_RESOLV=
64
+  LIB_UUID=-luuid
65
+  LIB_IPHLPAPI=
66
+  LIB_SHELL32=
67
+  LIB_PSAPI=
68
+  LIB_MAC=
69
+  MSVC_CFLAGS=
70
+  LIB_CRYPT32=
71
+  LIB_ICONV=-liconv
72
+  ZLIB_LIBS=-lz
73
+  LIB_INOTIFY=-linotify
74
+  LIB_KVM=-lkvm
75
 else
76
   LIB_WS32=
77
   LIB_GDI32=
78
@@ -220,6 +257,9 @@ else
79
   LIB_MAC=
80
   MSVC_CFLAGS=
81
   LIB_CRYPT32=
82
+  ZLIB_LIBS=-lz
83
+  LIB_INOTIFY=-linotify
84
+  LIB_KVM=
85
 fi
86
 
87
 AC_SUBST(LIB_WS32)
88
@@ -232,6 +272,9 @@ AC_SUBST(LIB_IPHLPAPI)
89
 AC_SUBST(LIB_SHELL32)
90
 AC_SUBST(LIB_PSAPI)
91
 AC_SUBST(LIB_MAC)
92
+AC_SUBST(ZLIB_LIBS)
93
+AC_SUBST(LIB_INOTIFY)
94
+AC_SUBST(LIB_KVM)
95
 AC_SUBST(MSVC_CFLAGS)
96
 AC_SUBST(LIB_CRYPT32)
97
 AC_SUBST(LIB_ICONV)
98
@@ -246,7 +289,9 @@ ZDB_REQUIRED=2.10
99
 #LIBNAUTILUS_EXTENSION_REQUIRED=2.30.1
100
 CURL_REQUIRED=7.17
101
 FUSE_REQUIRED=2.7.3
102
+if test "$blinux" = true ; then
103
 ZLIB_REQUIRED=1.2.0
104
+fi
105
 
106
 PKG_CHECK_MODULES(SSL, [openssl])
107
 AC_SUBST(SSL_CFLAGS)
108
@@ -276,9 +321,11 @@ PKG_CHECK_MODULES(LIBEVENT, [libevent >=
109
 AC_SUBST(LIBEVENT_CFLAGS)
110
 AC_SUBST(LIBEVENT_LIBS)
111
 
112
+if test "$blinux" = true ; then
113
 PKG_CHECK_MODULES(ZLIB, [zlib >= $ZLIB_REQUIRED])
114
 AC_SUBST(ZLIB_CFLAGS)
115
 AC_SUBST(ZLIB_LIBS)
116
+fi
117
 
118
 if test x${compile_python} = xyes; then
119
    AM_PATH_PYTHON([2.6])
(-)current/net-mgmt/seafile-client/files/patch-controller_seafile-controller.c (+104 lines)
Line 0 Link Here
1
--- controller/seafile-controller.c.orig	2015-09-21 03:42:11 UTC
2
+++ controller/seafile-controller.c
3
@@ -17,6 +17,19 @@
4
 #include "log.h"
5
 #include "seafile-controller.h"
6
 
7
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
8
+#include <sys/sysctl.h>
9
+#include <sys/types.h>
10
+#include <sys/user.h>
11
+#include <limits.h>
12
+
13
+#ifndef WITH_PROC_FS
14
+#define WITH_PROC_FS g_file_test("/proc/curproc", G_FILE_TEST_EXISTS)
15
+#endif
16
+
17
+static char *command_name = NULL;
18
+#endif
19
+
20
 #define CHECK_PROCESS_INTERVAL 10        /* every 10 seconds */
21
 
22
 SeafileController *ctl;
23
@@ -247,7 +260,20 @@ static void
24
 init_seafile_path ()
25
 {
26
     GError *error = NULL;
27
+#if defined(__linux__)
28
     char *executable = g_file_read_link ("/proc/self/exe", &error);
29
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
30
+    /*
31
+     * seafile.sh starts the process using abs path
32
+     */
33
+    char executable[_POSIX_PATH_MAX];
34
+    memset(executable, 0, _POSIX_PATH_MAX);
35
+    char * rc = realpath(command_name, executable);
36
+    if (!rc) {
37
+        seaf_warning ("failed to readpath: %s\n", executable);
38
+        return;
39
+    }
40
+#endif
41
     char *tmp = NULL;
42
     if (error != NULL) {
43
         seaf_warning ("failed to readlink: %s\n", error->message);
44
@@ -261,7 +287,9 @@ init_seafile_path ()
45
 
46
     topdir = g_path_get_dirname (installpath);
47
 
48
+#if defined(__linux__)
49
     g_free (executable);
50
+#endif
51
     g_free (tmp);
52
 }
53
 
54
@@ -402,11 +430,40 @@ need_restart (int which)
55
         return FALSE;
56
     } else {
57
         char buf[256];
58
+	gboolean with_procfs;
59
+#if defined(__linux__)
60
+	with_procfs = g_file_test("/proc/self", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR);
61
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
62
+	with_procfs = g_file_test("/proc/curproc", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR);
63
+#else
64
+	with_procfs = FALSE;
65
+#endif
66
+	if (with_procfs) {
67
         snprintf (buf, sizeof(buf), "/proc/%d", pid);
68
         if (g_file_test (buf, G_FILE_TEST_IS_DIR)) {
69
             return FALSE;
70
         } else {
71
             return TRUE;
72
+	}
73
+
74
+	} else {
75
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
76
+#ifdef __OpenBSD__
77
+            int min[6] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), 1};
78
+#else
79
+            int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};
80
+#endif
81
+            size_t len = sizeof(struct kinfo_proc);
82
+            struct kinfo_proc kp;
83
+            if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &kp, &len, NULL, 0) != -1 && 
84
+	        len == sizeof(struct kinfo_proc)) {
85
+                return FALSE;        
86
+            } else {
87
+                return TRUE;
88
+            }
89
+#else
90
+	return FALSE;
91
+#endif
92
         }
93
     }
94
 }
95
@@ -877,6 +934,9 @@ int main (int argc, char **argv)
96
         exit (1);
97
     }
98
 
99
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
100
+    command_name = argv[0];
101
+#endif
102
     char *config_dir = DEFAULT_CONFIG_DIR;
103
     char *seafile_dir = NULL;
104
     char *logdir = NULL;
(-)current/net-mgmt/seafile-client/files/patch-daemon_Makefile.am (+22 lines)
Line 0 Link Here
1
--- daemon/Makefile.am.orig	2016-04-15 23:08:45 UTC
2
+++ daemon/Makefile.am
3
@@ -63,6 +63,10 @@ if LINUX
4
 wt_monitor_src = wt-monitor.c wt-monitor-linux.c wt-monitor-structs.c
5
 endif
6
 
7
+if BSD
8
+wt_monitor_src = wt-monitor.c wt-monitor-linux.c wt-monitor-structs.c
9
+endif
10
+
11
 if WIN32
12
 wt_monitor_src = wt-monitor.c wt-monitor-win32.c wt-monitor-structs.c
13
 endif
14
@@ -126,6 +130,7 @@ seaf_daemon_LDADD = $(top_builddir)/lib/
15
 	@GLIB2_LIBS@  @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ -lsqlite3 @LIBEVENT_LIBS@ \
16
 	$(top_builddir)/common/cdc/libcdc.la \
17
 	$(top_builddir)/common/index/libindex.la @LIB_WS32@ @LIB_CRYPT32@ \
18
-	@SEARPC_LIBS@ @CCNET_LIBS@ @GNOME_KEYRING_LIBS@ @JANSSON_LIBS@ @LIB_MAC@ @ZLIB_LIBS@ @CURL_LIBS@ @BPWRAPPER_LIBS@
19
+	@SEARPC_LIBS@ @CCNET_LIBS@ @GNOME_KEYRING_LIBS@ @JANSSON_LIBS@ \
20
+	@LIB_MAC@ @ZLIB_LIBS@ @CURL_LIBS@ @LIB_INOTIFY@ @BPWRAPPER_LIBS@
21
 
22
 seaf_daemon_LDFLAGS = @STATIC_COMPILE@ @CONSOLE@
(-)current/net-mgmt/seafile-client/files/patch-daemon_http-tx-mgr.c (+25 lines)
Line 0 Link Here
1
--- daemon/http-tx-mgr.c.orig	2015-09-21 03:42:11 UTC
2
+++ daemon/http-tx-mgr.c
3
@@ -58,6 +58,22 @@
4
 #define USER_AGENT_OS "Linux"
5
 #endif
6
 
7
+#ifdef __FreeBSD__
8
+#define USER_AGENT_OS "FreeBSD"
9
+#endif
10
+
11
+#ifdef __DragonFly__
12
+#define USER_AGENT_OS "DragonFly"
13
+#endif
14
+
15
+#ifdef __NetBSD__
16
+#define USER_AGENT_OS "NetBSD"
17
+#endif
18
+
19
+#ifdef __OpenBSD__
20
+#define USER_AGENT_OS "OpenBSD"
21
+#endif
22
+
23
 struct _Connection {
24
     CURL *curl;
25
     gint64 ctime;               /* Used to clean up unused connection. */
(-)current/net-mgmt/seafile-client/files/patch-daemon_vc-utils.c (+11 lines)
Line 0 Link Here
1
--- daemon/vc-utils.c.orig	2016-12-03 06:02:47 UTC
2
+++ daemon/vc-utils.c
3
@@ -736,7 +736,7 @@ checkout_entry (struct cache_entry *ce,
4
     gboolean force_conflict = FALSE;
5
 
6
     path_in = g_build_path ("/", o->base, ce->name, NULL);
7
-#ifndef __linux__
8
+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
9
     path = build_case_conflict_free_path (o->base, ce->name,
10
                                           conflict_hash, no_conflict_hash,
11
                                           &case_conflict,
(-)current/net-mgmt/seafile-client/files/patch-lib_Makefile.am (+29 lines)
Line 0 Link Here
1
--- lib/Makefile.am.orig	2015-10-12 04:12:33 UTC
2
+++ lib/Makefile.am
3
@@ -53,6 +53,7 @@ libseafile_common_la_SOURCES = ${seafile
4
 libseafile_common_la_LDFLAGS = -no-undefined
5
 libseafile_common_la_LIBADD = @GLIB2_LIBS@  @GOBJECT_LIBS@ @SSL_LIBS@ -lcrypto @LIB_GDI32@ \
6
 				     @LIB_UUID@ @LIB_WS32@ @LIB_PSAPI@ -lsqlite3 \
7
+				@LIB_KVM@ \
8
 					 @LIBEVENT_LIBS@ @SEARPC_LIBS@ @LIB_SHELL32@ \
9
 	@ZLIB_LIBS@
10
 
11
@@ -74,7 +75,7 @@ vala.stamp: ${seafile_object_define}
12
 	rm -f ${seafile_object_gen}
13
 	@rm -f vala.tmp
14
 	@touch vala.tmp
15
-	valac -C --pkg posix $^
16
+	valac -C --pkg posix ${seafile_object_define}
17
 	@mv -f vala.tmp $@
18
 
19
 ${seafile_object_gen}: vala.stamp
20
@@ -90,5 +91,9 @@ install-data-local:
21
 if MACOS
22
 	sed -i '' -e "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
23
 else
24
+if BSD
25
+	sed -i '' "s|(DESTDIR)|${PREFIX}|g" $(pcfiles)
26
+else
27
 	${SED} -i "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
28
 endif
29
+endif
(-)current/net-mgmt/seafile-client/files/patch-lib_net.c (+14 lines)
Line 0 Link Here
1
--- lib/net.c.orig	2015-09-21 03:42:11 UTC
2
+++ lib/net.c
3
@@ -157,7 +157,11 @@ ccnet_net_bind_tcp (int port, int nonblo
4
 
5
     snprintf (buf, sizeof(buf), "%d", port);
6
 
7
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
8
+    if ( (n = getaddrinfo("0.0.0.0", buf, &hints, &res) ) != 0) {
9
+#else
10
     if ( (n = getaddrinfo(NULL, buf, &hints, &res) ) != 0) {
11
+#endif
12
         ccnet_warning ("getaddrinfo fails: %s\n", gai_strerror(n));
13
         return -1;
14
     }
(-)current/net-mgmt/seafile-client/files/patch-lib_utils.c (+195 lines)
Line 0 Link Here
1
--- lib/utils.c.orig	2015-09-21 03:42:11 UTC
2
+++ lib/utils.c
3
@@ -56,6 +56,16 @@
4
 
5
 #include <zlib.h>
6
 
7
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
8
+#include <netinet/in.h>
9
+#include <stdlib.h>
10
+#include <kvm.h>
11
+#include <paths.h>
12
+#include <sys/param.h>
13
+#include <sys/sysctl.h>
14
+#include <sys/user.h>
15
+#endif
16
+
17
 extern int inet_pton(int af, const char *src, void *dst);
18
 
19
 
20
@@ -2112,14 +2122,19 @@ wchar_from_utf8 (const char *utf8)
21
 
22
 #endif  /* ifdef WIN32 */
23
 
24
-#ifdef __linux__
25
 /* read the link of /proc/123/exe and compare with `process_name' */
26
 static int
27
 find_process_in_dirent(struct dirent *dir, const char *process_name)
28
 {
29
     char path[512];
30
     /* fisrst construct a path like /proc/123/exe */
31
+#if defined(__linux__)
32
     if (sprintf (path, "/proc/%s/exe", dir->d_name) < 0) {
33
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
34
+    if (sprintf (path, "/proc/%s/file", dir->d_name) < 0) {
35
+#else
36
+    if (1) {
37
+#endif
38
         return -1;
39
     }
40
 
41
@@ -2143,7 +2158,8 @@ find_process_in_dirent(struct dirent *di
42
 }
43
 
44
 /* read the /proc fs to determine whether some process is running */
45
-gboolean process_is_running (const char *process_name)
46
+static gboolean 
47
+process_is_running_procfs (const char *process_name)
48
 {
49
     DIR *proc_dir = opendir("/proc");
50
     if (!proc_dir) {
51
@@ -2168,7 +2184,8 @@ gboolean process_is_running (const char 
52
     return FALSE;
53
 }
54
 
55
-int count_process(const char *process_name)
56
+static int 
57
+count_process_procfs(const char *process_name)
58
 {
59
     int count = 0;
60
     DIR *proc_dir = opendir("/proc");
61
@@ -2192,6 +2209,14 @@ int count_process(const char *process_na
62
     return count;
63
 }
64
 
65
+#ifdef __linux__
66
+gboolean process_is_running(const char *process_name) {
67
+    return process_is_running_procfs(process_name);
68
+}
69
+
70
+int count_process(const char *process_name) {
71
+    return count_process_procfs(process_name);
72
+}
73
 #endif
74
 
75
 #ifdef __APPLE__
76
@@ -2202,6 +2227,119 @@ gboolean process_is_running (const char 
77
 }
78
 #endif
79
 
80
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
81
+#if defined(__FreeBSD__)
82
+#define PSKIP(kp) ((kp)->ki_pid == mypid ||               \
83
+                   (!kthreads && ((kp)->ki_flag & P_KTHREAD) != 0))
84
+#define KVM_OPENFILES(exec, coref, buf) \
85
+		kvm_openfiles(exec, coref, NULL, O_RDONLY, buf)
86
+#define KVM_GETPROCS(kd, plist, nproc) \
87
+       		kvm_getprocs(kd, KERN_PROC_PROC, 0, &nproc)
88
+
89
+#elif defined(__DragonFly__)
90
+#define	PSKIP(kp) ((kp)->kp_pid == mypid ||			\
91
+		   (!kthreads && ((kp)->kp_flags & P_SYSTEM) != 0))
92
+#define KVM_OPENFILES(exec, coref, buf) \
93
+		kvm_openfiles(exec, coref, NULL, O_RDONLY, buf)
94
+#define KVM_GETPROCS(kd, plist, nproc) \
95
+		kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc)
96
+
97
+#elif defined(__NetBSD__)
98
+#define	PSKIP(kp) ((kp)->kp_pid == mypid ||			\
99
+		   ((kp)->p_flag & P_SYSTEM) != 0)
100
+#define KVM_OPENFILES(exec, coref, buf) \
101
+		kvm_openfiles(exec, coref, NULL, KVM_NO_FILES, buf)
102
+#define KVM_GETPROCS(kd, plist, nproc) \
103
+		kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*plist), &nproc)
104
+
105
+#elif defined(__OpenBSD__)
106
+#define	PSKIP(kp) ((kp)->kp_pid == mypid ||			\
107
+		   ((kp)->p_flag & (P_SYSTEM | P_THREAD)) != 0)
108
+#define KVM_OPENFILES(exec, coref, buf) \
109
+		kvm_openfiles(exec, coref, NULL, KVM_NO_FILES, buf)
110
+#define KVM_GETPROCS(kd, plist, nproc) \
111
+		kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*plist), &nproc)
112
+
113
+#else
114
+#define PSKIP(kp) 0
115
+#define KVM_OPENFILES(exec, coref, buf) 0
116
+#define KVM_GETPROCS(kd, plist, nproc) 0
117
+#endif
118
+
119
+#ifndef WITH_PROC_FS
120
+#define WITH_PROC_FS g_file_test("/proc/curproc", G_FILE_TEST_EXISTS)
121
+#endif
122
+
123
+static int 
124
+count_running_process_kvm(const char *process_name) {
125
+    
126
+    
127
+    static kvm_t    *kd;
128
+    static struct    kinfo_proc *plist;
129
+    static int    nproc;
130
+    static pid_t    mypid;
131
+    static int      kthreads;
132
+
133
+    char buf[_POSIX2_LINE_MAX]; 
134
+    const char * execf, *coref;
135
+    char **pargv;
136
+    int i, selected_nproc;
137
+    struct kinfo_proc *kp;
138
+
139
+    selected_nproc = 0;
140
+    execf = NULL;
141
+    coref = _PATH_DEVNULL;
142
+    
143
+    mypid = getpid();
144
+    kd = KVM_OPENFILES(execf, coref, buf);
145
+    if (kd == NULL) {
146
+        fprintf(stderr, "Error: Cannot open kernel files (%s)", buf);
147
+        exit(1);
148
+    }
149
+
150
+    plist = KVM_GETPROCS(kd, plist, nproc);
151
+    if (plist == NULL) {
152
+        fprintf(stderr, "Error: Cannot get process list (%s)", kvm_geterr(kd));
153
+        exit(1);
154
+    }
155
+
156
+    for(i = 0, kp = plist; i < nproc; i++, kp++) {
157
+        if (PSKIP(kp)) {
158
+            continue;
159
+        }
160
+        if ((pargv = kvm_getargv(kd, kp, 0)) != NULL) {
161
+            if (strstr(pargv[0], process_name) != NULL) {
162
+                selected_nproc += 1;
163
+            }
164
+        }
165
+    }
166
+    kvm_close(kd);
167
+    kvm_close(kd);
168
+
169
+    return selected_nproc;
170
+}
171
+
172
+gboolean
173
+process_is_running(const char * process_name) {
174
+    if (WITH_PROC_FS) { 
175
+        return process_is_running_procfs(process_name);
176
+    }
177
+    if (count_running_process_kvm(process_name) > 0) {
178
+        return TRUE;
179
+    } else {
180
+        return FALSE;
181
+    }
182
+}
183
+
184
+int
185
+count_process(const char * process_name) {
186
+   if (WITH_PROC_FS) {
187
+       return count_process_procfs(process_name);
188
+   }
189
+   return count_running_process_kvm(process_name);
190
+}
191
+#endif
192
+
193
 char*
194
 ccnet_object_type_from_id (const char *object_id)
195
 {
(-)current/net-mgmt/seafile-client/files/patch-lib_utils.h (+23 lines)
Line 0 Link Here
1
--- lib/utils.h.orig	2015-09-21 03:42:11 UTC
2
+++ lib/utils.h
3
@@ -3,6 +3,9 @@
4
 #ifndef CCNET_UTILS_H
5
 #define CCNET_UTILS_H
6
 
7
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
8
+#include <netinet/in.h>
9
+#endif
10
 #include <sys/time.h>
11
 #include <time.h>
12
 #include <stdint.h>
13
@@ -13,7 +16,9 @@
14
 #include <stdlib.h>
15
 #include <sys/stat.h>
16
 
17
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
18
+#if defined(__FreeBSD__) || defined(__DragonFly__)
19
+#include <evutil.h>
20
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
21
 #include <event2/util.h>
22
 #else
23
 #include <evutil.h>
(-)current/net-mgmt/seafile-client/files/patch-scripts_setup-seafile.sh (+15 lines)
Line 0 Link Here
1
--- scripts/setup-seafile.sh.orig	2015-10-12 04:12:33 UTC
2
+++ scripts/setup-seafile.sh
3
@@ -340,7 +340,11 @@ fi
4
 }
5
 
6
 function copy_user_manuals() {
7
-    src_docs_dir=${INSTALLPATH}/seafile/docs/
8
+    if [ $(uname | grep -e BSD -e DragonFly | wc -l) == "1" ]; then
9
+        src_docs_dir=${INSTALLPATH}/seafile/share/doc/seafile/
10
+    else
11
+    	src_docs_dir=${INSTALLPATH}/seafile/docs/
12
+    fi
13
     library_template_dir=${seafile_data_dir}/library-template
14
     mkdir -p ${library_template_dir}
15
     cp -f ${src_docs_dir}/*.doc ${library_template_dir}
(-)current/net-mgmt/seafile-client/files/patch-scripts_upgrade_regenerate__secret__key.sh (+10 lines)
Line 0 Link Here
1
--- scripts/upgrade/regenerate_secret_key.sh.orig	2016-01-29 17:25:05 UTC
2
+++ scripts/upgrade/regenerate_secret_key.sh
3
@@ -10,4 +10,6 @@ seahub_settings_py=${TOPDIR}/seahub_sett
4
 
5
 line="SECRET_KEY = \"$(python $seahub_secret_keygen)\""
6
 
7
-sed -i -e "/SECRET_KEY/c\\$line" $seahub_settings_py
8
+sed -i.bak -e "/SECRET_KEY/c\\
9
+$line
10
+" $seahub_settings_py
(-)current/net-mgmt/seafile-client/files/patch-server_access-file.c (+54 lines)
Line 0 Link Here
1
--- server/access-file.c.orig	2015-11-12 02:40:40 UTC
2
+++ server/access-file.c
3
@@ -221,10 +221,10 @@ write_block_data_cb (struct bufferevent 
4
         bev->cbarg = data->saved_cb_arg;
5
 
6
         /* Resume reading incomming requests. */
7
-        evhtp_request_resume (data->req);
8
-
9
         evhtp_send_reply_end (data->req);
10
 
11
+	evhtp_request_resume (data->req);
12
+
13
         free_sendblock_data (data);
14
         return;
15
     }
16
@@ -306,10 +306,10 @@ next:
17
             bev->cbarg = data->saved_cb_arg;
18
 
19
             /* Resume reading incomming requests. */
20
-            evhtp_request_resume (data->req);
21
-
22
             evhtp_send_reply_end (data->req);
23
 
24
+	    evhtp_request_resume (data->req);
25
+
26
             free_sendfile_data (data);
27
             return;
28
         }
29
@@ -403,10 +403,10 @@ write_dir_data_cb (struct bufferevent *b
30
             bev->cbarg = data->saved_cb_arg;
31
 
32
             /* Resume reading incomming requests. */
33
-            evhtp_request_resume (data->req);
34
-
35
             evhtp_send_reply_end (data->req);
36
 
37
+	    evhtp_request_resume (data->req);
38
+
39
             free_senddir_data (data);
40
             return;
41
         }
42
@@ -710,10 +710,10 @@ finish_file_range_request (struct buffer
43
     bev->cbarg = data->saved_cb_arg;
44
 
45
     /* Resume reading incomming requests. */
46
-    evhtp_request_resume (data->req);
47
-
48
     evhtp_send_reply_end (data->req);
49
 
50
+    evhtp_request_resume (data->req);
51
+
52
     free_send_file_range_data (data);
53
 }
54
 
(-)current/net-mgmt/seafile-client/pkg-descr (+11 lines)
Line 0 Link Here
1
Seafile is a next-generation open source cloud storage system with
2
advanced support for file syncing, privacy protection and teamwork.
3
Collections of files are called libraries, and each library can be synced
4
separately. A library can be encrypted with a user chosen password. This
5
password is not stored on the server, so even the server admin cannot
6
view a file's contents.
7
8
Seafile allows users to create groups with file syncing, wiki, and
9
discussion to enable easy collaboration around documents within a team.
10
11
WWW: https://github.com/haiwen/seafile
(-)current/net-mgmt/seafile-client/pkg-plist (+28 lines)
Line 0 Link Here
1
bin/seaf-cli
2
bin/seaf-daemon
3
include/seafile/monitor-rpc.h
4
include/seafile/seafile-object.h
5
include/seafile/seafile-rpc.h
6
include/seafile/seafile.h
7
lib/libseafile.a
8
lib/libseafile.so
9
lib/libseafile.so.0
10
lib/libseafile.so.0.0.0
11
%%PYTHON_SITELIBDIR%%/seafile/__init__.py
12
%%PYTHON_SITELIBDIR%%/seafile/__init__.pyc
13
%%PYTHON_SITELIBDIR%%/seafile/__init__.pyo
14
%%PYTHON_SITELIBDIR%%/seafile/rpcclient.py
15
%%PYTHON_SITELIBDIR%%/seafile/rpcclient.pyc
16
%%PYTHON_SITELIBDIR%%/seafile/rpcclient.pyo
17
%%PYTHON_SITELIBDIR%%/seaserv/__init__.py
18
%%PYTHON_SITELIBDIR%%/seaserv/__init__.pyc
19
%%PYTHON_SITELIBDIR%%/seaserv/__init__.pyo
20
%%PYTHON_SITELIBDIR%%/seaserv/api.py
21
%%PYTHON_SITELIBDIR%%/seaserv/api.pyc
22
%%PYTHON_SITELIBDIR%%/seaserv/api.pyo
23
%%PYTHON_SITELIBDIR%%/seaserv/service.py
24
%%PYTHON_SITELIBDIR%%/seaserv/service.pyc
25
%%PYTHON_SITELIBDIR%%/seaserv/service.pyo
26
libdata/pkgconfig/libseafile.pc
27
man/man1/seaf-cli.1.gz
28
man/man1/seaf-daemon.1.gz
(-)current/net-mgmt/seafile-gui/Makefile (-1 / +1 lines)
Lines 13-19 LICENSE_FILE= ${WRKSRC}/LICENSE Link Here
13
13
14
LIB_DEPENDS=	libglib-2.0.so:devel/glib20 \
14
LIB_DEPENDS=	libglib-2.0.so:devel/glib20 \
15
		libsearpc.so:devel/libsearpc \
15
		libsearpc.so:devel/libsearpc \
16
		libseafile.so:net-mgmt/seafile \
16
		libseafile.so:net-mgmt/seafile-client \
17
		libsqlite3.so:databases/sqlite3 \
17
		libsqlite3.so:databases/sqlite3 \
18
		libccnet.so:net-mgmt/ccnet-client \
18
		libccnet.so:net-mgmt/ccnet-client \
19
		libjansson.so:devel/jansson \
19
		libjansson.so:devel/jansson \

Return to bug 215360