seafile: remove the whole think due to lack of any support by the upstream, https://github.com/haiwen/seafile-server/issues/236

This commit is contained in:
blshkv 2019-07-26 10:00:28 +08:00
parent a97ce40d19
commit 67c700da95
No known key found for this signature in database
GPG key ID: 273E3E90D1A6294F
41 changed files with 0 additions and 3011 deletions

View file

@ -1 +0,0 @@
DIST libevhtp-haiwen-20140819.zip 458401 BLAKE2B ee8e33a985db5f20880dcb6f2fc64f98266b9b524ac5bb97ed64e2aa4f2f24904a926bbf458ce13c5a4d51e1702c7e1d5bb81d8d5cc27989c5c4fba54a5a7252 SHA512 bd0e3ee37fdb0b1efed8a76c38aa292be4c55b870554fa5ca73f2b26c305533a21b2be1f81339608b27a14a9bcb502b0417c478cd819bb63ec205b2c2b413911

View file

@ -1,49 +0,0 @@
diff -rupN libevhtp-1.2.9.orig/htparse/htparse.c libevhtp-1.2.9/htparse/htparse.c
--- libevhtp-1.2.9.orig/htparse/htparse.c 2014-03-23 12:50:50.000000000 +0100
+++ libevhtp-1.2.9/htparse/htparse.c 2014-12-09 01:12:22.242001241 +0100
@@ -197,6 +197,7 @@ static const char * method_strmap[] = {
#define _MIN_READ(a, b) ((a) < (b) ? (a) : (b))
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define _str3_cmp(m, c0, c1, c2, c3) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
@@ -226,6 +227,37 @@ static const char * method_strmap[] = {
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& ((uint32_t *)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4) \
&& m[8] == c8
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#define _str3_cmp(m, c0, c1, c2, c3) \
+ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
+
+#define _str3Ocmp(m, c0, c1, c2, c3) \
+ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
+
+#define _str4cmp(m, c0, c1, c2, c3) \
+ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
+
+#define _str5cmp(m, c0, c1, c2, c3, c4) \
+ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
+ && m[4] == c4
+
+#define _str6cmp(m, c0, c1, c2, c3, c4, c5) \
+ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
+ && (((uint32_t *)m)[1] & 0xffff0000) == ((c4 << 24) | c5 << 16)
+
+#define _str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
+ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
+ && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7)
+
+#define _str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
+ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
+ && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7)
+
+#define _str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8) \
+ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
+ && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7) \
+ && m[8] == c8
+#endif
#define __HTPARSE_GENHOOK(__n) \
static inline int hook_ ## __n ## _run(htparser * p, htparse_hooks * hooks) { \

View file

@ -1,132 +0,0 @@
--- a/evhtp.c
+++ b/evhtp.c
@@ -1686,16 +1686,15 @@ _evhtp_ssl_thread_lock(int mode, int typ
#endif
static void
_evhtp_ssl_delete_scache_ent(evhtp_ssl_ctx_t * ctx, evhtp_ssl_sess_t * sess) {
- evhtp_t * htp;
- evhtp_ssl_cfg_t * cfg;
- unsigned char * sid;
- unsigned int slen;
+ evhtp_t * htp;
+ evhtp_ssl_cfg_t * cfg;
+ evhtp_ssl_data_t * sid;
+ unsigned int slen;
htp = (evhtp_t *)SSL_CTX_get_app_data(ctx);
cfg = htp->ssl_cfg;
- sid = sess->session_id;
- slen = sess->session_id_length;
+ sid = (evhtp_ssl_data_t *)SSL_SESSION_get_id(sess, &slen);
if (cfg->scache_del) {
(cfg->scache_del)(htp, sid, slen);
@@ -1706,14 +1705,17 @@ static int
_evhtp_ssl_add_scache_ent(evhtp_ssl_t * ssl, evhtp_ssl_sess_t * sess) {
evhtp_connection_t * connection;
evhtp_ssl_cfg_t * cfg;
- unsigned char * sid;
+ evhtp_ssl_data_t * sid;
int slen;
connection = (evhtp_connection_t *)SSL_get_app_data(ssl);
- cfg = connection->htp->ssl_cfg;
+ if (connection->htp == NULL)
+ {
+ return 0; /* We cannot get the ssl_cfg */
+ }
- sid = sess->session_id;
- slen = sess->session_id_length;
+ cfg = connection->htp->ssl_cfg;
+ sid = (evhtp_ssl_data_t *)SSL_SESSION_get_id(sess, &slen);
SSL_set_timeout(sess, cfg->scache_timeout);
@@ -1725,7 +1727,7 @@ _evhtp_ssl_add_scache_ent(evhtp_ssl_t *
}
static evhtp_ssl_sess_t *
-_evhtp_ssl_get_scache_ent(evhtp_ssl_t * ssl, unsigned char * sid, int sid_len, int * copy) {
+_evhtp_ssl_get_scache_ent(evhtp_ssl_t * ssl, evhtp_ssl_data_t * sid, int sid_len, int * copy) {
evhtp_connection_t * connection;
evhtp_ssl_cfg_t * cfg;
evhtp_ssl_sess_t * sess;
@@ -1767,12 +1769,12 @@ _evhtp_ssl_servername(evhtp_ssl_t * ssl,
connection->vhost_via_sni = 1;
SSL_set_SSL_CTX(ssl, evhtp_vhost->ssl_ctx);
- SSL_set_options(ssl, SSL_CTX_get_options(ssl->ctx));
+ SSL_set_options(ssl, SSL_CTX_get_options(SSL_get_SSL_CTX(ssl)));
if ((SSL_get_verify_mode(ssl) == SSL_VERIFY_NONE) ||
(SSL_num_renegotiations(ssl) == 0)) {
- SSL_set_verify(ssl, SSL_CTX_get_verify_mode(ssl->ctx),
- SSL_CTX_get_verify_callback(ssl->ctx));
+ SSL_set_verify(ssl, SSL_CTX_get_verify_mode(SSL_get_SSL_CTX(ssl)),
+ SSL_CTX_get_verify_callback(SSL_get_SSL_CTX(ssl)));
}
return SSL_TLSEXT_ERR_OK;
@@ -3017,15 +3019,21 @@ evhtp_ssl_init(evhtp_t * htp, evhtp_ssl_
return -1;
}
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_library_init();
SSL_load_error_strings();
+#endif
RAND_poll();
STACK_OF(SSL_COMP) * comp_methods = SSL_COMP_get_compression_methods();
sk_SSL_COMP_zero(comp_methods);
htp->ssl_cfg = cfg;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
htp->ssl_ctx = SSL_CTX_new(SSLv23_server_method());
+#else
+ htp->ssl_ctx = SSL_CTX_new(TLS_server_method());
+#endif
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
SSL_CTX_set_options(htp->ssl_ctx, SSL_MODE_RELEASE_BUFFERS);
@@ -3062,7 +3070,11 @@ evhtp_ssl_init(evhtp_t * htp, evhtp_ssl_
SSL_CTX_set_verify(htp->ssl_ctx, cfg->verify_peer, cfg->x509_verify_cb);
if (cfg->x509_chk_issued_cb != NULL) {
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
htp->ssl_ctx->cert_store->check_issued = cfg->x509_chk_issued_cb;
+#else
+ X509_STORE_set_check_issued(SSL_CTX_get_cert_store(htp->ssl_ctx), cfg->x509_chk_issued_cb);
+#endif
}
if (cfg->verify_depth) {
--- a/evhtp.h
+++ b/evhtp.h
@@ -34,6 +34,11 @@ typedef SSL evhtp_
typedef SSL_CTX evhtp_ssl_ctx_t;
typedef X509 evhtp_x509_t;
typedef X509_STORE_CTX evhtp_x509_store_ctx_t;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+typedef unsigned char evhtp_ssl_data_t;
+#else
+typedef const unsigned char evhtp_ssl_data_t;
+#endif
#else
typedef void evhtp_ssl_sess_t;
typedef void evhtp_ssl_t;
@@ -154,9 +159,9 @@ typedef int (*evhtp_headers_iterator)(ev
typedef int (*evhtp_ssl_verify_cb)(int pre_verify, evhtp_x509_store_ctx_t * ctx);
typedef int (*evhtp_ssl_chk_issued_cb)(evhtp_x509_store_ctx_t * ctx, evhtp_x509_t * x, evhtp_x509_t * issuer);
-typedef int (*evhtp_ssl_scache_add)(evhtp_connection_t * connection, unsigned char * sid, int sid_len, evhtp_ssl_sess_t * sess);
-typedef void (*evhtp_ssl_scache_del)(evhtp_t * htp, unsigned char * sid, int sid_len);
-typedef evhtp_ssl_sess_t * (*evhtp_ssl_scache_get)(evhtp_connection_t * connection, unsigned char * sid, int sid_len);
+typedef int (*evhtp_ssl_scache_add)(evhtp_connection_t * connection, evhtp_ssl_data_t * sid, int sid_len, evhtp_ssl_sess_t * sess);
+typedef void (*evhtp_ssl_scache_del)(evhtp_t * htp, evhtp_ssl_data_t * sid, int sid_len);
+typedef evhtp_ssl_sess_t * (*evhtp_ssl_scache_get)(evhtp_connection_t * connection, evhtp_ssl_data_t * sid, int sid_len);
typedef void * (*evhtp_ssl_scache_init)(evhtp_t *);
#define EVHTP_VERSION "1.1.6"

View file

@ -1,65 +0,0 @@
From d24ad5d0542c14dce3790bb6d08589ae4019caa9 Mon Sep 17 00:00:00 2001
From: Moritz Lipp <mlq@pwmt.org>
Date: Tue, 23 Jul 2013 21:42:36 +0200
Subject: [PATCH 1/2] Include signal.h for SIGTERM declaration
---
test_proxy.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/test_proxy.c b/test_proxy.c
index 2b391613..4adafdeb 100644
--- a/test_proxy.c
+++ b/test_proxy.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
+#include <signal.h>
#include <errno.h>
#include <evhtp.h>
From bb238f6f802707eb147129de481a8c55c32b06b8 Mon Sep 17 00:00:00 2001
From: Moritz Lipp <mlq@pwmt.org>
Date: Tue, 23 Jul 2013 21:44:50 +0200
Subject: [PATCH 2/2] Resolve memory leaks in evhtp.c
This patch resolves memory leaks of the variable key_s in
_evhtp_request_parser_header_key by adding proper calls to free the previously
allocated memory upon failure and return. In addition it checks if the initial
allocation of the memory succeeded and acts accordingly.
---
evhtp.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/evhtp.c b/evhtp.c
index 2cde1da0..ca10a6c0 100644
--- a/evhtp.c
+++ b/evhtp.c
@@ -902,16 +902,24 @@ _evhtp_request_parser_header_key(htparser * p, const char * data, size_t len) {
char * key_s; /* = strndup(data, len); */
evhtp_header_t * hdr;
- key_s = malloc(len + 1);
+ key_s = malloc(len + 1);
+ if (key_s == NULL) {
+ return -1;
+ }
+
key_s[len] = '\0';
memcpy(key_s, data, len);
if ((hdr = evhtp_header_key_add(c->request->headers_in, key_s, 0)) == NULL) {
c->request->status = EVHTP_RES_FATAL;
+ free(key_s);
return -1;
}
hdr->k_heaped = 1;
+
+ free(key_s);
+
return 0;
}

View file

@ -1,47 +0,0 @@
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit cmake-utils
HASH_COMMIT=18c649203f009ef1d77d6f8301eba09af3777adf
DESCRIPTION="Create extremely-fast and secure embedded HTTP servers with ease"
HOMEPAGE="https://github.com/criticalstack/libevhtp"
SRC_URI="https://github.com/haiwen/libevhtp/archive/${HASH_COMMIT}.zip -> ${P}.zip"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+oniguruma"
RDEPEND="oniguruma? ( dev-libs/oniguruma )"
DEPEND="${RDEPEND}"
S="${WORKDIR}/libevhtp-${HASH_COMMIT}"
src_prepare() {
# eapply "${FILESDIR}/010-strcmp-endianness-fix.patch"
# eapply "${FILESDIR}/020-openssl-1.1-compatibility.patch"
eapply "${FILESDIR}/pull-1.patch"
sed -i -e "s|lib/pkgconfig|$(get_libdir)/pkgconfig|" \
-e "s|lib/cmake|$(get_libdir)/cmake|" \
-e "s|DESTINATION \"lib|DESTINATION \"$(get_libdir)|" \
-e "s|DESTINATION lib|DESTINATION $(get_libdir)|" \
"${S}/CMakeLists.txt"
cmake-utils_src_prepare
eapply_user
}
src_configure() {
local mycmakeargs=(
# #libevent issue
# -DEVHTP_DISABLE_MEMFUNCTIONS=ON
# #https://manual.seafile.com/build_seafile/server.html
-DEVHTP_DISABLE_SSL=ON
-DEVHTP_BUILD_SHARED=ON
#must be OFF for seafile
$(usex oniguruma -DEVHTP_DISABLE_REGEX=OFF)
)
cmake-utils_src_configure
}

View file

@ -1 +0,0 @@
DIST libevhtp-1.2.18.tar.gz 208153 BLAKE2B 8e7b482e90062d08b4f94039f0b295e5dcc49942742de5cc3de97f994ad644abfb347f329bbcd9f2e5a362011ccbf2e0fe9c65c16f59c50567e14f818fc1f36e SHA512 e01d771a9358fcf912578f34acd235711a3231029b453781f2992cf51cea26aa3f1eb170d3a834f15d4f9b3f37235fb006853eeee509945e2c18e3a7fbb06ae4

View file

@ -1,39 +0,0 @@
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit cmake-utils
DESCRIPTION="Create extremely-fast and secure embedded HTTP servers with ease"
HOMEPAGE="https://github.com/criticalstack/libevhtp"
SRC_URI="https://github.com/criticalstack/libevhtp/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+oniguruma"
RDEPEND="oniguruma? ( dev-libs/oniguruma )"
DEPEND="${RDEPEND}"
src_prepare() {
sed -i -e "s|lib/pkgconfig|$(get_libdir)/pkgconfig|" \
-e "s|lib/cmake|$(get_libdir)/cmake|" \
-e "s|DESTINATION \"lib|DESTINATION \"$(get_libdir)|" \
"${S}/CMakeLists.txt"
cmake-utils_src_prepare
eapply_user
}
src_configure() {
local mycmakeargs=(
# #libevent issue
-DEVHTP_DISABLE_MEMFUNCTIONS=ON
# #https://manual.seafile.com/build_seafile/server.html
# -DEVHTP_DISABLE_SSL=ON
# -DEVHTP_BUILD_SHARED=OFF
#must be OFF for seafile
$(usex oniguruma -DEVHTP_DISABLE_REGEX=OFF)
)
cmake-utils_src_configure
}

View file

@ -1 +0,0 @@
DIST libsearpc-3.1_p20190712.tar.gz 51785 BLAKE2B f7b9a8629d2fa5ce7a5866ee49934176fb12cb3c1fec6fd0a684cc65ed933d5731f3eaedcfb35e0da4587c382d4cbc6ca607aaefcbe5c9f25fdc48930019795d SHA512 2af83cf5436cbf6acef7388efa322e71a0dc2f2f006eb2df6307b39e405b604cbac4e9399b681c792e98573c59466ca3e057afa3b8634c1883c27359c72c10fb

View file

@ -1,45 +0,0 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python2_7 )
inherit autotools python-single-r1
DESCRIPTION="A simple C language RPC framework"
HOMEPAGE="https://github.com/haiwen/libsearpc/ http://seafile.com/"
HASH_COMMIT="c161cb90a5cb494947b1bda63f8664619dd3ca94" # 20190712
SRC_URI="https://github.com/haiwen/libsearpc/archive/${HASH_COMMIT}.tar.gz -> ${P}.tar.gz"
LICENSE="Apache-2.0"
SLOT=0
KEYWORDS="~amd64 ~x86"
IUSE=""
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
DEPEND="${PYTHON_DEPS}
dev-libs/jansson"
RDEPEND="${DEPEND}
dev-python/simplejson[${PYTHON_USEDEP}]"
S="${WORKDIR}/${PN}-${HASH_COMMIT}"
src_prepare() {
sed -e "s/(DESTDIR)//" \
-i ${PN}.pc.in || die
python_fix_shebang "${S}"
eautoreconf
default
}
src_install() {
default
# Remove unnecessary .la files, as recommended by ltprune.eclass
find "${ED}" -name '*.la' -delete || die
}

View file

@ -1,14 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>moschlar@metalabs.de</email>
</maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<upstream>
<remote-id type="github">haiwen/libsearpc</remote-id>
</upstream>
</pkgmetadata>

View file

@ -1 +0,0 @@
DIST ccnet-server-7.0.2.tar.gz 218034 BLAKE2B 7c5ff727b2620e0f56889376c817f5c01b5a3bcbe2dfba2e3b961608da27af9dce15fd80759b60e98a586bb2ede49cc9e39e479ea0a127446d6cceddf0f28f25 SHA512 b4115e6d98179027184845f47348ea7ec5c91cbc5d3a4ec7b47b45f6b0dab2566f8b41baf7913dd02175dbfc864cf7f9903c88b38e33ef0dc560e1aa06557376

View file

@ -1,48 +0,0 @@
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python2_7 )
inherit autotools python-single-r1 vala
DESCRIPTION="Internal communication framework and user/group management for Seafile server"
HOMEPAGE="https://github.com/haiwen/ccnet-server/ http://www.seafile.com/"
SRC_URI="https://github.com/haiwen/${PN}/archive/v${PV}-server.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2+-with-openssl-exception"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
RDEPEND="${PYTHON_DEPS}
!net-libs/ccnet
dev-libs/libevent
net-libs/libsearpc
dev-libs/glib"
#openssl... yes
#gobject-2.0 >= 2.16.0... yes
DEPEND="${RDEPEND}
$(vala_depend)"
S="${WORKDIR}/${P}-server"
src_prepare() {
sed -i -e 's/valac /${VALAC} /' lib/Makefile.am || die
#remove data-local
sed -i -e 's|${DESTDIR}|${DESTDIR2}|' Makefile.am
eautoreconf
vala_src_prepare
eapply_user
}
src_configure() {
econf \
--without-mysql \
--without-postgresql
# --enable-python=no
}

View file

@ -1 +0,0 @@
DIST seafile-client-7.0.1.tar.gz 2363581 BLAKE2B aba90b88f469a580264319f4cbaa4303ba55d778caec26cd7c2d6fbe96e3bf293b718038bbee1ff3988040d1829ba7105019dc7f50cd79447226aec214fbe051 SHA512 4b91e64e71a9e503b80bd040400bfe69e5d78153d93fb991b3ee58947e4f8c632aaeb5e802b8357e4f2411124c34a08e80c220a10da102ecce9d2ff2a06ac19e

View file

@ -1,18 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4261fba..24fbbda 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -158,11 +158,8 @@ SET(QT_VERSION_MAJOR 5)
# have to keep using QtWebKit on windows because QtWebEngine can't be
# compiled in msys2/mingw (QtWebEnigne is based on chrome, which has to be
# compiled with MSVC.)
-FIND_PROGRAM(qmake_executable NAMES qmake qmake.exe)
-EXECUTE_PROCESS(COMMAND
- bash -c "${qmake_executable} --version | grep -iE '^using qt version [0-9.]+' | awk '{print $4}'"
- OUTPUT_VARIABLE DETECTED_QT_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE)
+FIND_PACKAGE(Qt5Core)
+SET(DETECTED_QT_VERSION ${Qt5Core_VERSION})
MESSAGE("qt5 version: ${DETECTED_QT_VERSION}")
IF(WIN32 OR DETECTED_QT_VERSION VERSION_LESS 5.6.0)
ADD_DEFINITIONS(-DSEAFILE_USE_WEBKIT)

View file

@ -1,17 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>moschlar@metalabs.de</email>
</maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<use>
<flag name="shibboleth">Build support for Shibboleth single sign-on</flag>
</use>
<upstream>
<remote-id type="github">haiwen/seafile-client</remote-id>
</upstream>
</pkgmetadata>

View file

@ -1,57 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit cmake-utils gnome2-utils
DESCRIPTION="Seafile desktop client"
HOMEPAGE="https://github.com/haiwen/seafile-client/ http://www.seafile.com/"
SRC_URI="https://github.com/haiwen/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="shibboleth test"
RDEPEND="net-libs/libsearpc
net-misc/ccnet-server
net-misc/seafile
dev-libs/libevent
dev-libs/jansson
dev-libs/openssl:0
dev-db/sqlite:3
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtwidgets:5
dev-qt/qtnetwork:5
dev-qt/qtdbus:5
shibboleth? ( || ( dev-qt/qtwebengine:5[widgets] dev-qt/qtwebkit:5 ) )"
DEPEND="${RDEPEND}
dev-qt/linguist-tools:5
test? ( dev-qt/qttest:5 )"
src_prepare() {
eapply "${FILESDIR}/${PN}-select-qt5.patch"
cmake-utils_src_prepare
if use shibboleth ; then
if ! has_version "dev-qt/qtwebengine:5[widgets]" ; then
sed -i -e 's/IF(WIN32 OR DETECTED_QT_VERSION VERSION_LESS 5.6.0)/IF(TRUE)/' CMakeLists.txt || die
fi
fi
}
src_configure() {
local mycmakeargs=(
-DBUILD_SHIBBOLETH_SUPPORT="$(usex shibboleth)"
-DBUILD_TESTING="$(usex test)"
)
cmake-utils_src_configure
}
pkg_postinst() {
gnome2_icon_cache_update
}
pkg_postrm() {
gnome2_icon_cache_update
}

View file

@ -1 +0,0 @@
DIST seafile-server-7.0.2.tar.gz 747863 BLAKE2B 24fa5bd6d2b8ebb19b520e6685c242df8066d8d731fd6586dfd8cad711526b32167db92f50f1cf9e95e8c114648c1afa66bfc6743b47fe8f602eb2fc9388ea4d SHA512 46068d452976274bd773e5888179ee40b70a56bcf27f1fa0a7cb0c62705354eeb040bc1af12c7510be307d6b70ec96de7cd31af1b9a6ffd2e07a51895f4a891c

View file

@ -1,73 +0,0 @@
--- a/scripts/seaf-fsck.sh
+++ b/scripts/seaf-fsck.sh
@@ -7,7 +7,7 @@ INSTALLPATH=$(dirname "${SCRIPT}")
TOPDIR=$(dirname "${INSTALLPATH}")
default_ccnet_conf_dir=${TOPDIR}/ccnet
default_conf_dir=${TOPDIR}/conf
-seaf_fsck=${INSTALLPATH}/seafile/bin/seaf-fsck
+seaf_fsck=/usr/bin/seaf-fsck
export PATH=${INSTALLPATH}/seafile/bin:$PATH
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
--- a/scripts/seaf-gc.sh
+++ b/scripts/seaf-gc.sh
@@ -7,7 +7,7 @@ INSTALLPATH=$(dirname "${SCRIPT}")
TOPDIR=$(dirname "${INSTALLPATH}")
default_ccnet_conf_dir=${TOPDIR}/ccnet
default_conf_dir=${TOPDIR}/conf
-seaf_gc=${INSTALLPATH}/seafile/bin/seafserv-gc
+seaf_gc=/usr/bin/seafserv-gc
seaf_gc_opts=""
export PATH=${INSTALLPATH}/seafile/bin:$PATH
--- a/scripts/setup-seafile-mysql.sh
+++ b/scripts/setup-seafile-mysql.sh
@@ -40,15 +40,10 @@ function check_python_executable() {
function check_python_module () {
module=$1
name=$2
- hint=$3
printf " Checking python module: ${name} ... "
if ! $PYTHON -c "import ${module}" 2>/dev/null 1>&2; then
echo
printf "\033[33m ${name} \033[m is not installed, Please install it first.\n"
- if [[ "${hint}" != "" ]]; then
- printf "${hint}"
- echo
- fi
err_and_quit;
fi
echo -e "Done."
@@ -70,14 +65,10 @@ function check_python () {
if [[ $PYTHON == "python2.6" ]]; then
py26="2.6"
fi
- hint="\nOn Debian/Ubntu: apt-get install python-setuptools\nOn CentOS/RHEL: yum install python${py26}-distribute"
- check_python_module pkg_resources setuptools "${hint}"
-
- hint="\nOn Debian/Ubntu: apt-get install python-imaging\nOn CentOS/RHEL: yum install python${py26}-imaging"
- check_python_module PIL python-imaging "${hint}"
- hint='\nOn Debian/Ubuntu:\n\nsudo apt-get install python-mysqldb\n\nOn CentOS/RHEL:\n\nsudo yum install MySQL-python'
- check_python_module MySQLdb python-mysqldb "${hint}"
+ check_python_module pkg_resources setuptools
+ check_python_module PIL python-imaging
+ check_python_module MySQLdb python-mysqldb
fi
echo
}
@@ -85,5 +76,6 @@ function check_python () {
check_python;
export PYTHON=$PYTHON
+export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH"
exec $PYTHON "$python_script" "$@"
--- a/scripts/sqlite2mysql.sh
+++ b/scripts/sqlite2mysql.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# This shell script and corresponding sqlite2mysql.py are used to
# migrate Seafile data from SQLite to MySQL.

View file

@ -1,23 +0,0 @@
--- a/controller/seafile-controller.c
+++ b/controller/seafile-controller.c
@@ -21,7 +21,7 @@
SeafileController *ctl;
-static char *controller_pidfile = NULL;
+static char *controller_pidfile = "/var/run/seafile/seafile-controller.pid";
char *bin_dir = NULL;
char *installpath = NULL;
@@ -591,9 +591,9 @@ stop_ccnet_server ()
static void
init_pidfile_path (SeafileController *ctl)
{
- char *pid_dir = g_build_filename (topdir, "pids", NULL);
+ char *pid_dir = g_path_get_dirname (controller_pidfile);
if (!g_file_test(pid_dir, G_FILE_TEST_EXISTS)) {
- if (g_mkdir(pid_dir, 0777) < 0) {
+ if (g_mkdir(pid_dir, 0755) < 0) {
seaf_warning("failed to create pid dir %s: %s", pid_dir, strerror(errno));
controller_exit(1);
}

View file

@ -1,60 +0,0 @@
--- a/tools/seafile-admin
+++ b/tools/seafile-admin
@@ -449,9 +449,12 @@ workers = 3
# Logging
runtime_dir = os.path.dirname(__file__)
-pidfile = os.path.join(runtime_dir, 'seahub.pid')
+pidfile = '/var/run/seafile/seahub.pid'
errorlog = os.path.join(runtime_dir, 'error.log')
accesslog = os.path.join(runtime_dir, 'access.log')
+
+# for file upload, we need a longer timeout value (default is only 30s, too short)
+timeout = 1200
'''
try:
@@ -526,6 +529,7 @@ def check_django_version():
def check_python_module(import_name, package_name=None, silent=False):
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "seahub.settings")
package_name = package_name or import_name
if not silent:
info('checking %s' % package_name)
@@ -785,7 +789,7 @@ def check_layout(args):
conf[CONF_SEAFILE_DIR] = seafile_data_dir
conf[CONF_SEAHUB_DIR] = seahub_dir
conf[CONF_SEAHUB_CONF] = seahub_conf
- conf[CONF_SEAHUB_PIDFILE] = os.path.join(runtime_dir, 'seahub.pid')
+ conf[CONF_SEAHUB_PIDFILE] = '/var/run/seafile/seahub.pid'
conf[CONF_SEAHUB_OUTLOG] = os.path.join(runtime_dir, 'access.log')
conf[CONF_SEAHUB_ERRLOG] = os.path.join(runtime_dir, 'error.log')
@@ -836,10 +840,13 @@ def setup_seafile(args):
print '-----------------------------------------------------------------'
print '-----------------------------------------------------------------'
print
- print 'To start/stop seafile server:'
+ print 'To start, stop or restart seafile:'
+ print
+ print highlight(' # /etc/init.d/seafile { start | stop | restart }')
print
- print highlight(' $ cd %s' % cwd)
- print highlight(' $ %s { start | stop }' % SCRIPT_NAME)
+ print 'To start, stop or restart seahub:'
+ print
+ print highlight(' # /etc/init.d/seahub { start | stop | restart }')
print
print 'If you have any problem, refer to\n'
print
@@ -903,8 +910,7 @@ def start_seafile(args):
def stop_seafile(dummy):
info('Stopping seafile server')
pkill('seafile-controller')
- runtime_dir = os.path.join(cwd, 'seafile-server', 'runtime')
- pidfile = os.path.join(runtime_dir, 'seahub.pid')
+ pidfile = '/var/run/seafile/seahub.pid'
try:
with open(pidfile, 'r') as fp:
pid = fp.read().strip('\n ')

View file

@ -1,42 +0,0 @@
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,3 +1,5 @@
+include $(TOPDIR)/rules.mk
+
pcfiles = libseafile.pc
pkgconfig_DATA = $(pcfiles)
pkgconfigdir = $(libdir)/pkgconfig
@@ -33,7 +35,7 @@ seafile_HEADERS = seafile-object.h
seafile-object.h: ${seafile_object_define}
rm -f $@
- valac --pkg posix ${seafile_object_define} -C -H seafile-object.h
+ "$(STAGING_DIR_HOSTPKG)/bin/valac" --pkg posix ${seafile_object_define} -C -H seafile-object.h
DISTCLEANFILES = ${searpc_gen}
@@ -56,7 +58,7 @@ rpc_table.stamp: ${top_srcdir}/lib/rpc_table.py
@rm -f rpc_table.tmp
@touch rpc_table.tmp
@echo "[libsearpc]: generating rpc header files"
- @PYTHON@ `which searpc-codegen.py` ${top_srcdir}/lib/rpc_table.py
+ @PYTHON@ "$(STAGING_DIR)/usr/bin/searpc-codegen.py" ${top_srcdir}/lib/rpc_table.py
@echo "[libsearpc]: done"
@mv -f rpc_table.tmp $@
@@ -66,7 +68,7 @@ vala.stamp: ${seafile_object_define}
rm -f ${seafile_object_gen}
@rm -f vala.tmp
@touch vala.tmp
- valac -C --pkg posix $^
+ "$(STAGING_DIR_HOSTPKG)/bin/valac" -C --pkg posix $^
@mv -f vala.tmp $@
${seafile_object_gen}: vala.stamp
@@ -82,5 +84,5 @@ install-data-local:
if MACOS
sed -i '' -e "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
else
- ${SED} -i "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
+ ${SED} "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
endif

View file

@ -1,38 +0,0 @@
--- a/lib/repo.vala
+++ b/lib/repo.vala
@@ -34,7 +34,7 @@ public class Repo : Object {
// data format version
public int version { get; set; }
- public int last_modify { get; set; }
+ public int64 last_modify { get; set; }
public int64 size { get; set; }
public int64 file_count { get; set; }
public string last_modifier { get; set; }
@@ -45,7 +45,7 @@ public class Repo : Object {
public string repo_id { get; set; }
public string repo_name { get; set; }
public string repo_desc { get; set; }
- public int last_modified { get; set; }
+ public int64 last_modified { get; set; }
// Section 2: Encryption related
// Members in this section should be set for every Repo object
@@ -68,7 +68,7 @@ public class Repo : Object {
get { return _relay_id; }
set { _relay_id = value; }
}
- public int last_sync_time { get; set; }
+ public int64 last_sync_time { get; set; }
public bool auto_sync { get; set; }
public bool worktree_invalid { get; set; }
@@ -162,7 +162,7 @@ public class DeletedEntry : Object {
public string obj_name { get; set; }
public string basedir { get; set; }
public int mode { get; set; }
- public int delete_time { get; set; }
+ public int64 delete_time { get; set; }
public int64 file_size { get; set; }
public string scan_stat { get; set; }
}

View file

@ -1,20 +0,0 @@
--- a/scripts/seaf-fuse.sh
+++ b/scripts/seaf-fuse.sh
@@ -7,7 +7,7 @@ INSTALLPATH=$(dirname "${SCRIPT}")
TOPDIR=$(dirname "${INSTALLPATH}")
default_ccnet_conf_dir=${TOPDIR}/ccnet
default_conf_dir=${TOPDIR}/conf
-seaf_fuse=${INSTALLPATH}/seafile/bin/seaf-fuse
+seaf_fuse=/usr/bin/seaf-fuse
export PATH=${INSTALLPATH}/seafile/bin:$PATH
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
@@ -68,7 +68,7 @@ function validate_already_running () {
}
function warning_if_seafile_not_running () {
- if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
+ if ! pgrep -f "seafile-controller -F ${default_conf_dir}" 2>/dev/null 1>&2; then
echo
echo "Warning: seafile-controller not running. Have you run \"./seafile.sh start\" ?"
echo

View file

@ -1,35 +0,0 @@
From 13f95a28ce12216ba51cf0ca8d61c3d89689d02b Mon Sep 17 00:00:00 2001
From: Eneas U de Queiroz <cote2004-github@yahoo.com>
Date: Wed, 6 Jun 2018 18:11:47 -0300
Subject: [PATCH] Remove API deprecated in openssl 1.1
Openssl 1.1 has deprecated RAND_pseudo_bytes. It won't compile with
openssl built witout deprecated API.
Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
---
common/seafile-crypt.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/common/seafile-crypt.c b/common/seafile-crypt.c
index c7d1702..c3cebf5 100644
--- a/common/seafile-crypt.c
+++ b/common/seafile-crypt.c
@@ -81,9 +81,14 @@ seafile_generate_random_key (const char *passwd, char *random_key)
int rc = RAND_bytes (secret_key, sizeof(secret_key));
if (rc != 1) {
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || OPENSSL_API_COMPAT < 0x10100000L
seaf_warning ("Failed to generate secret key for repo encryption "
"with RAND_bytes(), use RAND_pseudo_bytes().\n");
RAND_pseudo_bytes (secret_key, sizeof(secret_key));
+#else
+ seaf_warning ("Failed to generate secret key for repo encryption "
+ "with RAND_bytes().\n");
+#endif
}
seafile_derive_key (passwd, strlen(passwd), 2, key, iv);
--
2.16.4

View file

@ -1,61 +0,0 @@
From 115a4583deb9ae11adbc419ea87c990d0b8572fe Mon Sep 17 00:00:00 2001
From: Joffrey Darcq <j-off@live.fr>
Date: Sat, 28 Apr 2018 22:27:28 +0200
Subject: [PATCH 1/2] fix django version 1.11
---
tools/seafile-admin | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/seafile-admin b/tools/seafile-admin
index 5e3658b..38e7288 100755
--- a/tools/seafile-admin
+++ b/tools/seafile-admin
@@ -518,10 +518,10 @@ def init_seahub():
def check_django_version():
- '''Requires django 1.8'''
+ '''Requires django 1.11'''
import django
- if django.VERSION[0] != 1 or django.VERSION[1] != 8:
- error('Django 1.8 is required')
+ if django.VERSION[0] != 1 or django.VERSION[1] != 11:
+ error('Django 1.11 is required')
del django
From bf69ff1cf1080081eae5d8115842c26468746736 Mon Sep 17 00:00:00 2001
From: Joffrey Darcq <j-off@live.fr>
Date: Sun, 3 Jun 2018 15:51:54 +0200
Subject: [PATCH 2/2] fix django version 1.11
---
tools/seafile-admin | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/seafile-admin b/tools/seafile-admin
index 38e7288..c16aab6 100755
--- a/tools/seafile-admin
+++ b/tools/seafile-admin
@@ -499,8 +499,8 @@ def init_seahub():
# create seahub_settings.py
create_seahub_settings_py()
- argv = [PYTHON, 'manage.py', 'syncdb']
- # Set proper PYTHONPATH before run django syncdb command
+ argv = [PYTHON, 'manage.py', 'migrate']
+ # Set proper PYTHONPATH before run django migrate command
env = get_seahub_env()
print
@@ -509,7 +509,7 @@ def init_seahub():
print
if run_argv(argv, cwd=seahub_dir, env=env) != 0:
- error('Seahub syncdb failed')
+ error('Seahub migrate failed')
info('done')

View file

@ -1,26 +0,0 @@
--- a/tools/seafile-admin
+++ b/tools/seafile-admin
@@ -831,7 +831,22 @@ def setup_seafile(args):
conf[CONF_SEAFILE_CENTRAL_CONF_DIR] = os.path.join(cwd, 'conf')
config_ccnet_seafile()
init_ccnet_seafile()
- init_seahub()
+
+ # make sure ccnet-server is running to avoid an error creating django superuser
+ if not is_running('ccnet-server'):
+ argv = [
+ 'ccnet-server',
+ '-F',
+ conf[CONF_SEAFILE_CENTRAL_CONF_DIR],
+ '-c',
+ conf[CONF_CCNET_DIR],
+ '-d'
+ ]
+ run_argv(argv)
+ init_seahub()
+ pkill('ccnet-server')
+ else:
+ init_seahub()
print
print '-----------------------------------------------------------------'

View file

@ -1,40 +0,0 @@
Author: David Barbion <davidb@230ruedubac.fr>
Description: Use shared object for libevhtp
Forwarded: https://github.com/haiwen/seafile-server/pull/12
Index: seafile-server/configure.ac
===================================================================
--- seafile-server.orig/configure.ac
+++ seafile-server/configure.ac
@@ -218,6 +218,10 @@ PKG_CHECK_MODULES(LIBEVENT, [libevent >=
AC_SUBST(LIBEVENT_CFLAGS)
AC_SUBST(LIBEVENT_LIBS)
+PKG_CHECK_MODULES(LIBEVHTP, [evhtp])
+AC_SUBST(LIBEVHTP_CFLAGS)
+AC_SUBST(LIBEVHTP_LIBS)
+
PKG_CHECK_MODULES(ZLIB, [zlib >= $ZLIB_REQUIRED])
AC_SUBST(ZLIB_CFLAGS)
AC_SUBST(ZLIB_LIBS)
Index: seafile-server/server/Makefile.am
===================================================================
--- seafile-server.orig/server/Makefile.am
+++ seafile-server/server/Makefile.am
@@ -13,6 +13,7 @@ AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir)
@GLIB2_CFLAGS@ \
@MSVC_CFLAGS@ \
@LIBARCHIVE_CFLAGS@ \
+ @LIBEVHTP_CFLAGS@ \
-Wall
bin_PROGRAMS = seaf-server
@@ -114,7 +115,7 @@ seaf_server_SOURCES = \
seaf_server_LDADD = @CCNET_LIBS@ \
$(top_builddir)/lib/libseafile_common.la \
- @GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ -lsqlite3 @LIBEVENT_LIBS@ -levhtp \
+ -lonig @GLIB2_LIBS@ @GOBJECT_LIBS@ @SSL_LIBS@ @LIB_RT@ @LIB_UUID@ -lsqlite3 @LIBEVENT_LIBS@ @LIBEVHTP_LIBS@ \
$(top_builddir)/common/cdc/libcdc.la \
$(top_builddir)/common/db-wrapper/libdbwrapper.la \
@SEARPC_LIBS@ @JANSSON_LIBS@ ${LIB_WS32} @ZLIB_LIBS@ \

View file

@ -1,69 +0,0 @@
Author: Alexandre Rossi <alexandre.rossi@gmail.com>
Description: Fix download stalling on recent libevhtp
A while ago[1], evhtp_request_pause() behavior changed: it now disables
both read and write events. seafile-server would then stall.
.
[1] https://github.com/criticalstack/libevhtp/commit/6cd89466fd6bd76c5b8624be65af5893afe3e40c
[2] https://github.com/haiwen/seafile/issues/1119
Forwarded: no
Index: seafile-server/server/access-file.c
===================================================================
--- seafile-server.orig/server/access-file.c 2018-02-01 12:23:53.209308343 +0100
+++ seafile-server/server/access-file.c 2018-02-01 12:23:53.205308288 +0100
@@ -618,7 +618,7 @@
/* Block any new request from this connection before finish
* handling this request.
*/
- evhtp_request_pause (req);
+ bufferevent_disable(bev, EV_READ);
/* Kick start data transfer by sending out http headers. */
evhtp_send_reply_start(req, EVHTP_RES_OK);
@@ -967,7 +967,7 @@
/* Block any new request from this connection before finish
* handling this request.
*/
- evhtp_request_pause (req);
+ bufferevent_disable(bev, EV_READ);
/* Kick start data transfer by sending out http headers. */
evhtp_send_reply_start(req, EVHTP_RES_PARTIAL);
@@ -1032,7 +1032,7 @@
/* Block any new request from this connection before finish
* handling this request.
*/
- evhtp_request_pause (req);
+ bufferevent_disable(bev, EV_READ);
/* Kick start data transfer by sending out http headers. */
evhtp_send_reply_start(req, EVHTP_RES_OK);
@@ -1365,7 +1365,7 @@
/* Block any new request from this connection before finish
* handling this request.
*/
- evhtp_request_pause (req);
+ bufferevent_disable(bev, EV_READ);
/* Kick start data transfer by sending out http headers. */
evhtp_send_reply_start(req, EVHTP_RES_OK);
Index: seafile-server/server/upload-file.c
===================================================================
--- seafile-server.orig/server/upload-file.c 2018-02-01 12:23:53.209308343 +0100
+++ seafile-server/server/upload-file.c 2018-02-01 12:25:14.542400155 +0100
@@ -2054,6 +2054,7 @@
if (res != EVHTP_RES_OK) {
/* Don't receive any data before the connection is closed. */
//evhtp_request_pause (req);
+ // or for later evhtp bufferevent_disable(evhtp_request_get_bev(req), EV_READ);
/* Set keepalive to 0. This will cause evhtp to close the
* connection after sending the reply.
@@ -2271,6 +2272,7 @@
err:
/* Don't receive any data before the connection is closed. */
//evhtp_request_pause (req);
+ // or for later evhtp bufferevent_disable(evhtp_request_get_bev(req), EV_READ);
/* Set keepalive to 0. This will cause evhtp to close the
* connection after sending the reply.

View file

@ -1,85 +0,0 @@
Author: Alexandre Rossi <alexandre.rossi@gmail.com>
Description: Take into account libevhtp API changes
Forwarded: no
Index: seafile-server/server/upload-file.c
===================================================================
--- seafile-server.orig/server/upload-file.c 2018-02-01 12:25:52.666911934 +0100
+++ seafile-server/server/upload-file.c 2018-02-01 12:27:37.812323399 +0100
@@ -2059,7 +2059,7 @@
/* Set keepalive to 0. This will cause evhtp to close the
* connection after sending the reply.
*/
- req->keepalive = 0;
+ req->flags &= ~EVHTP_REQ_FLAG_KEEPALIVE;
fsm->state = RECV_ERROR;
}
@@ -2260,8 +2260,8 @@
}
/* Set up per-request hooks, so that we can read file data piece by piece. */
- evhtp_set_hook (&req->hooks, evhtp_hook_on_read, upload_read_cb, fsm);
- evhtp_set_hook (&req->hooks, evhtp_hook_on_request_fini, upload_finish_cb, fsm);
+ evhtp_request_set_hook (req, evhtp_hook_on_read, upload_read_cb, fsm);
+ evhtp_request_set_hook (req, evhtp_hook_on_request_fini, upload_finish_cb, fsm);
/* Set arg for upload_cb or update_cb. */
req->cbarg = fsm;
@@ -2277,7 +2277,7 @@
/* Set keepalive to 0. This will cause evhtp to close the
* connection after sending the reply.
*/
- req->keepalive = 0;
+ req->flags &= ~EVHTP_REQ_FLAG_KEEPALIVE;
send_error_reply (req, EVHTP_RES_BADREQ, err_msg);
g_free (repo_id);
@@ -2346,38 +2346,32 @@
cb = evhtp_set_regex_cb (htp, "^/upload/.*", upload_cb, NULL);
/* upload_headers_cb() will be called after evhtp parsed all http headers. */
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
cb = evhtp_set_regex_cb (htp, "^/upload-api/.*", upload_api_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
cb = evhtp_set_regex_cb (htp, "^/upload-raw-blks-api/.*",
upload_raw_blks_api_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
cb = evhtp_set_regex_cb (htp, "^/upload-blks-api/.*", upload_blks_api_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
-
- /* cb = evhtp_set_regex_cb (htp, "^/upload-blks-aj/.*", upload_blks_ajax_cb, NULL); */
- /* evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL); */
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
cb = evhtp_set_regex_cb (htp, "^/upload-aj/.*", upload_ajax_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
cb = evhtp_set_regex_cb (htp, "^/update/.*", update_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
cb = evhtp_set_regex_cb (htp, "^/update-api/.*", update_api_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
cb = evhtp_set_regex_cb (htp, "^/update-blks-api/.*", update_blks_api_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
-
- /* cb = evhtp_set_regex_cb (htp, "^/update-blks-aj/.*", update_blks_ajax_cb, NULL); */
- /* evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL); */
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
cb = evhtp_set_regex_cb (htp, "^/update-aj/.*", update_ajax_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);
evhtp_set_regex_cb (htp, "^/upload_progress.*", upload_progress_cb, NULL);

View file

@ -1,30 +0,0 @@
--- a/lib/Makefile.am.orig 2019-05-30 20:37:43.000000000 +0800
+++ b/lib/Makefile.am 2019-06-15 23:22:15.800991293 +0800
@@ -1,7 +1,3 @@
-pcfiles = libseafile.pc
-pkgconfig_DATA = $(pcfiles)
-pkgconfigdir = $(libdir)/pkgconfig
-
AM_CPPFLAGS = @GLIB2_CFLAGS@ -I$(top_srcdir)/include \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/common \
@@ -20,7 +16,7 @@
valac_gen = ${seafile_object_gen} seafile-object.h
-EXTRA_DIST = ${seafile_object_define} rpc_table.py $(pcfiles) vala.stamp
+EXTRA_DIST = ${seafile_object_define} rpc_table.py vala.stamp
utils_headers = net.h bloom-filter.h utils.h db.h
@@ -77,10 +73,3 @@
rm -f rpc_table.stamp
rm -f rpc_table.tmp
rm -f vala.tmp vala.stamp ${valac_gen}
-
-install-data-local:
-if MACOS
- sed -i '' -e "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
-else
- ${SED} -i "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
-endif

View file

@ -1,76 +0,0 @@
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python2_7 )
inherit autotools python-single-r1 vala
DESCRIPTION="File syncing and sharing software with file encryption and group sharing"
HOMEPAGE="https://github.com/haiwen/seafile-server/ http://www.seafile.com/"
SRC_URI="https://github.com/haiwen/${PN}/archive/v${PV}-server.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2+-with-openssl-exception"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
#list of deps ./ci/requirements.txt
RDEPEND="${PYTHON_DEPS}
!net-libs/ccnet
net-misc/ccnet-server
net-libs/libevhtp-haiwen[oniguruma]
dev-libs/libevent
net-misc/curl
dev-libs/glib
virtual/libmysqlclient
app-arch/libarchive
dev-libs/jansson
sys-fs/fuse
dev-db/sqlite:3
dev-python/pillow[${PYTHON_USEDEP}]
>=dev-python/termcolor-1.1.0[${PYTHON_USEDEP}]
>=dev-python/requests-2.8.0[${PYTHON_USEDEP}]
>=dev-python/pytest-3.3.2[${PYTHON_USEDEP}]
>=dev-python/backports-functools-lru-cache-1.4[${PYTHON_USEDEP}]
>=dev-python/tenacity-4.8.0[${PYTHON_USEDEP}]"
#moviepy
DEPEND="${RDEPEND}
$(vala_depend)"
S="${WORKDIR}/${P}-server"
src_prepare() {
# eapply "${FILESDIR}/libevhtp-1.2.18.patch"
#https://github.com/openwrt/packages/tree/master/net/seafile-server/patches
## eapply "${FILESDIR}/020-script-patches.patch"
eapply "${FILESDIR}/030-pidfiles-in-same-directory.patch"
eapply "${FILESDIR}/040-seafile-admin.patch"
## eapply "${FILESDIR}/050-libseafile-makefile-fixes.patch"
eapply "${FILESDIR}/060-timestamps-as-int64.patch"
eapply "${FILESDIR}/070-fuse-mount.patch"
## eapply "${FILESDIR}/080-Remove-API-deprecated-in-openssl-1.1.patch"
eapply "${FILESDIR}/090-django-11-compat.patch"
eapply "${FILESDIR}/100-seafile-admin-Make-sure-ccnet-is-running.patch"
#libevhtp 1.2.18 (not forked) patches
#https://github.com/haiwen/seafile-server/issues/67#issuecomment-337904800
## eapply "${FILESDIR}/110-libevhtp-linking.patch"
# eapply "${FILESDIR}/120-recent-libevhtp.patch"
# eapply "${FILESDIR}/130-newer-libevhtp.patch"
#do not overlap files with seafile
#https://github.com/haiwen/seafile-server/issues/235
eapply "${FILESDIR}/remove_pc.patch"
sed -i '/seafile_HEADERS/d' lib/Makefile.am || die
sed -i -e 's/valac /${VALAC} /' lib/Makefile.am || die
python_fix_shebang tools/seafile-admin
eautoreconf
vala_src_prepare
eapply_user
}

View file

@ -1 +0,0 @@
DIST seafile-7.0.1.tar.gz 698043 BLAKE2B aea854df93f108c9c373a31257b2ad57015fea20ccd4db05e6a50174dda69d0179891d77572174b98cd48ceb3b425aebc41f4cb9ca91cbee54aae5021eacf332 SHA512 5afe22cfcc037cbdf2caf58969de6c8b9c9e883fb007c0d966e1b83724c6deb1413a4ebe7325b9d49b678a25fb9d59bfe1602751d70ec4acb38cb4c8c70553e2

View file

@ -1,14 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>moschlar@metalabs.de</email>
</maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<upstream>
<remote-id type="github">haiwen/seafile</remote-id>
</upstream>
</pkgmetadata>

View file

@ -1,55 +0,0 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python2_7 )
inherit autotools python-single-r1 vala
DESCRIPTION="File syncing and sharing software with file encryption and group sharing"
HOMEPAGE="https://github.com/haiwen/seafile/ http://www.seafile.com/"
SRC_URI="https://github.com/haiwen/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2+-with-openssl-exception"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RDEPEND="${PYTHON_DEPS}
!net-libs/ccnet
net-misc/ccnet-server
>=net-libs/libsearpc-3.1[${PYTHON_USEDEP}]
dev-libs/libevent:0
dev-libs/jansson
sys-libs/zlib:0
net-misc/curl
dev-libs/openssl:0
dev-db/sqlite:3"
DEPEND="${RDEPEND}
$(vala_depend)"
src_prepare() {
# similar with libsearpc
sed -i -e 's|(DESTDIR)||' lib/libseafile.pc.in
sed -i -e 's/valac /${VALAC} /' lib/Makefile.am || die
# seems not required, overlaps with server
sed -i -e 's/ python//' Makefile.am || die
python_fix_shebang "${S}"
eautoreconf
vala_src_prepare
default
}
src_install() {
default
# Remove unnecessary .la files, as recommended by ltprune.eclass
find "${ED}" -name '*.la' -delete || die
}

View file

@ -1 +0,0 @@
DIST seahub-7.0.2.tar.gz 29650519 BLAKE2B 11bac69bdd1bfcc2ebf64e3374f295d939990d99d9f154091d8c083d30046ce599b8d494868083a97d47ed65cf07d16739594409d31e1f2a7e77ad7824e529cd SHA512 d4e7d499130b8f138a1d347a13e64c6866c4eda29509c8c18c72e7c40fe4b04c87b076aa01e07691a13a87948bcca1ddc8de510eca4b8dfe09ef0fe72dc082fc

View file

@ -1,382 +0,0 @@
#coding: UTF-8
'''This script would check if there is admin, and prompt the user to create a new one if non exist'''
import json
import sys
import os
import time
import re
import shutil
import glob
import subprocess
import hashlib
import getpass
import uuid
import warnings
from ConfigParser import ConfigParser
try:
import readline # pylint: disable=W0611
except ImportError:
pass
SERVER_MANUAL_HTTP = 'https://github.com/haiwen/seafile/wiki'
class Utils(object):
'''Groups all helper functions here'''
@staticmethod
def welcome():
'''Show welcome message'''
welcome_msg = '''\
-----------------------------------------------------------------
This script will guide you to setup your seafile server using MySQL.
Make sure you have read seafile server manual at
%s
Press ENTER to continue
-----------------------------------------------------------------''' % SERVER_MANUAL_HTTP
print welcome_msg
raw_input()
@staticmethod
def highlight(content):
'''Add ANSI color to content to get it highlighted on terminal'''
return '\x1b[33m%s\x1b[m' % content
@staticmethod
def info(msg):
print msg
@staticmethod
def error(msg):
'''Print error and exit'''
print
print 'Error: ' + msg
sys.exit(1)
@staticmethod
def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_stderr=False):
'''Run a program and wait it to finish, and return its exit code. The
standard output of this program is supressed.
'''
with open(os.devnull, 'w') as devnull:
if suppress_stdout:
stdout = devnull
else:
stdout = sys.stdout
if suppress_stderr:
stderr = devnull
else:
stderr = sys.stderr
proc = subprocess.Popen(argv,
cwd=cwd,
stdout=stdout,
stderr=stderr,
env=env)
return proc.wait()
@staticmethod
def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_stderr=False):
'''Like run_argv but specify a command line string instead of argv'''
with open(os.devnull, 'w') as devnull:
if suppress_stdout:
stdout = devnull
else:
stdout = sys.stdout
if suppress_stderr:
stderr = devnull
else:
stderr = sys.stderr
proc = subprocess.Popen(cmdline,
cwd=cwd,
stdout=stdout,
stderr=stderr,
env=env,
shell=True)
return proc.wait()
@staticmethod
def prepend_env_value(name, value, env=None, seperator=':'):
'''prepend a new value to a list'''
if env is None:
env = os.environ
try:
current_value = env[name]
except KeyError:
current_value = ''
new_value = value
if current_value:
new_value += seperator + current_value
env[name] = new_value
@staticmethod
def must_mkdir(path):
'''Create a directory, exit on failure'''
try:
os.mkdir(path)
except OSError, e:
Utils.error('failed to create directory %s:%s' % (path, e))
@staticmethod
def must_copy(src, dst):
'''Copy src to dst, exit on failure'''
try:
shutil.copy(src, dst)
except Exception, e:
Utils.error('failed to copy %s to %s: %s' % (src, dst, e))
@staticmethod
def find_in_path(prog):
if 'win32' in sys.platform:
sep = ';'
else:
sep = ':'
dirs = os.environ['PATH'].split(sep)
for d in dirs:
d = d.strip()
if d == '':
continue
path = os.path.join(d, prog)
if os.path.exists(path):
return path
return None
@staticmethod
def get_python_executable():
'''Return the python executable. This should be the PYTHON environment
variable which is set in setup-seafile-mysql.sh
'''
return os.environ['PYTHON']
@staticmethod
def read_config(fn):
'''Return a case sensitive ConfigParser by reading the file "fn"'''
cp = ConfigParser()
cp.optionxform = str
cp.read(fn)
return cp
@staticmethod
def write_config(cp, fn):
'''Return a case sensitive ConfigParser by reading the file "fn"'''
with open(fn, 'w') as fp:
cp.write(fp)
@staticmethod
def ask_question(desc,
key=None,
note=None,
default=None,
validate=None,
yes_or_no=False,
password=False):
'''Ask a question, return the answer.
@desc description, e.g. "What is the port of ccnet?"
@key a name to represent the target of the question, e.g. "port for
ccnet server"
@note additional information for the question, e.g. "Must be a valid
port number"
@default the default value of the question. If the default value is
not None, when the user enter nothing and press [ENTER], the default
value would be returned
@validate a function that takes the user input as the only parameter
and validate it. It should return a validated value, or throws an
"InvalidAnswer" exception if the input is not valid.
@yes_or_no If true, the user must answer "yes" or "no", and a boolean
value would be returned
@password If true, the user input would not be echoed to the
console
'''
assert key or yes_or_no
# Format description
print
if note:
desc += '\n' + note
desc += '\n'
if yes_or_no:
desc += '[ yes or no ]'
else:
if default:
desc += '[ default "%s" ]' % default
else:
desc += '[ %s ]' % key
desc += ' '
while True:
# prompt for user input
if password:
answer = getpass.getpass(desc).strip()
else:
answer = raw_input(desc).strip()
# No user input: use default
if not answer:
if default:
answer = default
else:
continue
# Have user input: validate answer
if yes_or_no:
if answer not in ['yes', 'no']:
print Utils.highlight('\nPlease answer yes or no\n')
continue
else:
return answer == 'yes'
else:
if validate:
try:
return validate(answer)
except InvalidAnswer, e:
print Utils.highlight('\n%s\n' % e)
continue
else:
return answer
@staticmethod
def validate_port(port):
try:
port = int(port)
except ValueError:
raise InvalidAnswer('%s is not a valid port' % Utils.highlight(port))
if port <= 0 or port > 65535:
raise InvalidAnswer('%s is not a valid port' % Utils.highlight(port))
return port
class InvalidAnswer(Exception):
def __init__(self, msg):
Exception.__init__(self)
self.msg = msg
def __str__(self):
return self.msg
### END of Utils
####################
class RPC(object):
def __init__(self):
import ccnet
ccnet_dir = os.environ['CCNET_CONF_DIR']
central_config_dir = os.environ['SEAFILE_CENTRAL_CONF_DIR']
self.rpc_client = ccnet.CcnetThreadedRpcClient(
ccnet.ClientPool(ccnet_dir, central_config_dir=central_config_dir))
def get_db_email_users(self):
return self.rpc_client.get_emailusers('DB', 0, 1)
def create_admin(self, email, user):
return self.rpc_client.add_emailuser(email, user, 1, 1)
def need_create_admin():
users = rpc.get_db_email_users()
return len(users) == 0
def create_admin(email, passwd):
if rpc.create_admin(email, passwd) < 0:
raise Exception('failed to create admin')
else:
print '\n\n'
print '----------------------------------------'
print 'Successfully created seafile admin'
print '----------------------------------------'
print '\n\n'
def ask_admin_email():
print
print '----------------------------------------'
print 'It\'s the first time you start the seafile server. Now let\'s create the admin account'
print '----------------------------------------'
def validate(email):
# whitespace is not allowed
if re.match(r'[\s]', email):
raise InvalidAnswer('%s is not a valid email address' % Utils.highlight(email))
# must be a valid email address
if not re.match(r'^.+@.*\..+$', email):
raise InvalidAnswer('%s is not a valid email address' % Utils.highlight(email))
return email
key = 'admin email'
question = 'What is the ' + Utils.highlight('email') + ' for the admin account?'
return Utils.ask_question(question,
key=key,
validate=validate)
def ask_admin_password():
def validate(password):
key = 'admin password again'
question = 'Enter the ' + Utils.highlight('password again:')
password_again = Utils.ask_question(question,
key=key,
password=True)
if password_again != password:
raise InvalidAnswer('password mismatch')
return password
key = 'admin password'
question = 'What is the ' + Utils.highlight('password') + ' for the admin account?'
return Utils.ask_question(question,
key=key,
password=True,
validate=validate)
rpc = RPC()
def main():
if not need_create_admin():
return
password_file = os.path.join(os.environ['SEAFILE_CENTRAL_CONF_DIR'], 'admin.txt')
if os.path.exists(password_file):
with open(password_file, 'r') as fp:
pwinfo = json.load(fp)
email = pwinfo['email']
passwd = pwinfo['password']
os.unlink(password_file)
else:
email = ask_admin_email()
passwd = ask_admin_password()
create_admin(email, passwd)
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
print '\n\n\n'
print Utils.highlight('Aborted.')
print
sys.exit(1)
except Exception, e:
print
print Utils.highlight('Error happened during creating seafile admin.')
print

View file

@ -1,19 +0,0 @@
import os
daemon = True
workers = 5
# default localhost:8000
bind = "127.0.0.1:8000"
# Pid
pids_dir = '/data/seafile/pids'
pidfile = os.path.join(pids_dir, 'seahub.pid')
# for file upload, we need a longer timeout value (default is only 30s, too short)
timeout = 1200
limit_request_line = 8190
accesslog = "/data/seafile/logs/guncorn_access.log"
errorlog = "/data/seafile/logs/guncorn_error.log"

View file

@ -1,181 +0,0 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: seafile
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs
# Default-Start: 1 2 3 4 5
# Default-Stop:
# Short-Description: Starts Seafile Server
# Description: starts Seafile Server
### END INIT INFO
echo ""
SCRIPT=$(readlink -f "$0")
INSTALLPATH=$(dirname "${SCRIPT}")
TOPDIR=$(dirname "${INSTALLPATH}")
default_ccnet_conf_dir=${TOPDIR}/ccnet
central_config_dir=${TOPDIR}/conf
seaf_controller="/usr/bin/seafile-controller"
export PATH=${INSTALLPATH}/seafile/bin:$PATH
export ORIG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
script_name=$0
function usage () {
echo "usage : "
echo "$(basename ${script_name}) { start | stop | restart } "
echo ""
}
# check args
if [[ $# != 1 || ( "$1" != "start" && "$1" != "stop" && "$1" != "restart" ) ]]; then
usage;
exit 1;
fi
function validate_running_user () {
real_data_dir=`readlink -f ${seafile_data_dir}`
running_user=`id -un`
data_dir_owner=`stat -c %U ${real_data_dir}`
if [[ "${running_user}" != "${data_dir_owner}" ]]; then
echo "Error: the user running the script (\"${running_user}\") is not the owner of \"${real_data_dir}\" folder, you should use the user \"${data_dir_owner}\" to run the script."
exit -1;
fi
}
function validate_ccnet_conf_dir () {
if [[ ! -d ${default_ccnet_conf_dir} ]]; then
echo "Error: there is no ccnet config directory."
echo "Have you run setup-seafile.sh before this?"
echo ""
exit -1;
fi
}
function validate_central_conf_dir () {
if [[ ! -d ${central_config_dir} ]]; then
echo "Error: there is no conf/ directory."
echo "Have you run setup-seafile.sh before this?"
echo ""
exit -1;
fi
}
function read_seafile_data_dir () {
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
if [[ ! -f ${seafile_ini} ]]; then
echo "${seafile_ini} not found. Now quit"
exit 1
fi
seafile_data_dir=$(cat "${seafile_ini}")
if [[ ! -d ${seafile_data_dir} ]]; then
echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits."
echo "Please check it first, or create this directory yourself."
echo ""
exit 1;
fi
}
function test_config() {
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} --test \
-c "${default_ccnet_conf_dir}" \
-d "${seafile_data_dir}" \
-F "${central_config_dir}" ; then
exit 1;
fi
}
function 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
}
function validate_already_running () {
if pid=$(pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null); then
echo "Seafile controller is already running, pid $pid"
echo
exit 1;
fi
check_component_running "ccnet-server" "ccnet-server -c ${default_ccnet_conf_dir}"
check_component_running "seaf-server" "seaf-server -c ${default_ccnet_conf_dir}"
check_component_running "fileserver" "fileserver -c ${default_ccnet_conf_dir}"
check_component_running "seafdav" "wsgidav.server.run_server"
}
function start_seafile_server () {
validate_already_running;
validate_central_conf_dir;
validate_ccnet_conf_dir;
read_seafile_data_dir;
validate_running_user;
test_config;
echo "Starting seafile server, please wait ..."
mkdir -p $TOPDIR/logs
LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} \
-c "${default_ccnet_conf_dir}" \
-d "${seafile_data_dir}" \
-F "${central_config_dir}"
sleep 3
# check if seafile server started successfully
if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
echo "Failed to start seafile server"
exit 1;
fi
echo "Seafile server started"
echo
}
function stop_seafile_server () {
if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
echo "seafile server not running yet"
return 1;
fi
echo "Stopping seafile server ..."
pkill -SIGTERM -f "seafile-controller -c ${default_ccnet_conf_dir}"
pkill -f "ccnet-server -c ${default_ccnet_conf_dir}"
pkill -f "seaf-server -c ${default_ccnet_conf_dir}"
pkill -f "fileserver -c ${default_ccnet_conf_dir}"
pkill -f "soffice.*--invisible --nocrashreport"
pkill -f "wsgidav.server.run_server"
return 0
}
function restart_seafile_server () {
stop_seafile_server;
sleep 2
start_seafile_server;
}
case $1 in
"start" )
start_seafile_server;
;;
"stop" )
stop_seafile_server;
;;
"restart" )
restart_seafile_server;
esac
echo "Done."

View file

@ -1,301 +0,0 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: seahub
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs
# Default-Start: 1 2 3 4 5
# Default-Stop:
# Short-Description: Starts Seahub
# Description: starts Seahub
### END INIT INFO
echo ""
SCRIPT=$(readlink -f "$0")
INSTALLPATH=$(dirname "${SCRIPT}")
TOPDIR=$(dirname "${INSTALLPATH}")
default_ccnet_conf_dir=${TOPDIR}/ccnet
central_config_dir=${TOPDIR}/conf
manage_py=${INSTALLPATH}/seahub/manage.py
gunicorn_conf=${TOPDIR}/conf/gunicorn.conf
pidfile=${TOPDIR}/pids/seahub.pid
errorlog=${TOPDIR}/logs/gunicorn_error.log
accesslog=${TOPDIR}/logs/gunicorn_access.log
gunicorn_exe=${INSTALLPATH}/seahub/thirdpart/gunicorn
script_name=$0
function usage () {
echo "Usage: "
echo
echo " $(basename ${script_name}) { start <port> | stop | restart <port> }"
echo
echo "To run seahub in fastcgi:"
echo
echo " $(basename ${script_name}) { start-fastcgi <port> | stop | restart-fastcgi <port> }"
echo
echo "<port> is optional, and defaults to 8000"
echo ""
}
# Check args
if [[ $1 != "start" && $1 != "stop" && $1 != "restart" \
&& $1 != "start-fastcgi" && $1 != "restart-fastcgi" && $1 != "clearsessions" && $1 != "python-env" ]]; then
usage;
exit 1;
fi
function check_python_executable() {
if [[ "$PYTHON" != "" && -x $PYTHON ]]; then
return 0
fi
if which python2.7 2>/dev/null 1>&2; then
PYTHON=python2.7
elif which python27 2>/dev/null 1>&2; then
PYTHON=python27
else
echo
echo "Can't find a python executable of version 2.7 or above in PATH"
echo "Install python 2.7+ before continue."
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it"
echo
exit 1
fi
}
function validate_ccnet_conf_dir () {
if [[ ! -d ${default_ccnet_conf_dir} ]]; then
echo "Error: there is no ccnet config directory."
echo "Have you run setup-seafile.sh before this?"
echo ""
exit -1;
fi
}
function read_seafile_data_dir () {
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
if [[ ! -f ${seafile_ini} ]]; then
echo "${seafile_ini} not found. Now quit"
exit 1
fi
seafile_data_dir=$(cat "${seafile_ini}")
if [[ ! -d ${seafile_data_dir} ]]; then
echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits."
echo "Please check it first, or create this directory yourself."
echo ""
exit 1;
fi
}
function validate_seahub_running () {
if pgrep -f "${manage_py}" 2>/dev/null 1>&2; then
echo "Seahub is already running."
exit 1;
elif pgrep -f "seahub.wsgi:application" 2>/dev/null 1>&2; then
echo "Seahub is already running."
exit 1;
fi
}
function validate_port () {
if ! [[ ${port} =~ ^[1-9][0-9]{1,4}$ ]] ; then
printf "\033[033m${port}\033[m is not a valid port number\n\n"
usage;
exit 1
fi
}
if [[ ($1 == "start" || $1 == "restart" || $1 == "start-fastcgi" || $1 == "restart-fastcgi") \
&& ($# == 2 || $# == 1) ]]; then
if [[ $# == 2 ]]; then
port=$2
validate_port
else
port=8000
fi
elif [[ $1 == "stop" && $# == 1 ]]; then
dummy=dummy
elif [[ $1 == "clearsessions" && $# == 1 ]]; then
dummy=dummy
elif [[ $1 == "python-env" ]]; then
dummy=dummy
else
usage;
exit 1
fi
function warning_if_seafile_not_running () {
if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
echo
echo "Warning: seafile-controller not running. Have you run \"./seafile.sh start\" ?"
echo
exit 1
fi
}
function prepare_seahub_log_dir() {
logdir=${TOPDIR}/logs
if ! [[ -d ${logsdir} ]]; then
if ! mkdir -p "${logdir}"; then
echo "ERROR: failed to create logs dir \"${logdir}\""
exit 1
fi
fi
export SEAHUB_LOG_DIR=${logdir}
}
function before_start() {
prepare_env;
warning_if_seafile_not_running;
validate_seahub_running;
prepare_seahub_log_dir;
}
function start_seahub () {
before_start;
echo "Starting seahub at port ${port} ..."
check_init_admin;
$PYTHON $gunicorn_exe seahub.wsgi:application -c "${gunicorn_conf}" --preload
# Ensure seahub is started successfully
sleep 5
if ! pgrep -f "seahub.wsgi:application" 2>/dev/null 1>&2; then
printf "\033[33mError:Seahub failed to start.\033[m\n"
echo "Please try to run \"./seahub.sh start\" again"
exit 1;
fi
echo
echo "Seahub is started"
echo
}
function start_seahub_fastcgi () {
before_start;
# Returns 127.0.0.1 if SEAFILE_FASTCGI_HOST is unset or hasn't got any value,
# otherwise returns value of SEAFILE_FASTCGI_HOST environment variable
address=`(test -z "$SEAFILE_FASTCGI_HOST" && echo "127.0.0.1") || echo $SEAFILE_FASTCGI_HOST`
echo "Starting seahub (fastcgi) at ${address}:${port} ..."
check_init_admin;
$PYTHON "${manage_py}" runfcgi maxchildren=8 host=$address port=$port pidfile=$pidfile \
outlog=${accesslog} errlog=${errorlog}
# Ensure seahub is started successfully
sleep 5
if ! pgrep -f "${manage_py}" 1>/dev/null; then
printf "\033[33mError:Seahub failed to start.\033[m\n"
exit 1;
fi
echo
echo "Seahub is started"
echo
}
function prepare_env() {
check_python_executable;
validate_ccnet_conf_dir;
read_seafile_data_dir;
if [[ -z "$LANG" ]]; then
echo "LANG is not set in ENV, set to en_US.UTF-8"
export LANG='en_US.UTF-8'
fi
if [[ -z "$LC_ALL" ]]; then
echo "LC_ALL is not set in ENV, set to en_US.UTF-8"
export LC_ALL='en_US.UTF-8'
fi
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
export SEAFILE_CONF_DIR=${seafile_data_dir}
export SEAFILE_CENTRAL_CONF_DIR=${central_config_dir}
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
}
function clear_sessions () {
prepare_env;
echo "Start clear expired session records ..."
$PYTHON "${manage_py}" clearsessions
echo
echo "Done"
echo
}
function stop_seahub () {
if [[ -f ${pidfile} ]]; then
echo "Stopping seahub ..."
pkill -9 -f "gunicorn"
sleep 1
if pgrep -f "gunicorn" 2>/dev/null 1>&2 ; then
echo 'Failed to stop seahub.'
exit 1
fi
rm -f ${pidfile}
return 0
else
echo "Seahub is not running"
fi
}
function check_init_admin() {
check_init_admin_script=${INSTALLPATH}/check_init_admin.py
if ! $PYTHON $check_init_admin_script; then
exit 1
fi
}
function run_python_env() {
local pyexec
prepare_env;
if which ipython 2>/dev/null; then
pyexec=ipython
else
pyexec=$PYTHON
fi
if [[ $# -eq 0 ]]; then
$pyexec "$@"
else
"$@"
fi
}
case $1 in
"start" )
start_seahub;
;;
"start-fastcgi" )
start_seahub_fastcgi;
;;
"stop" )
stop_seahub;
;;
"restart" )
stop_seahub
sleep 2
start_seahub
;;
"restart-fastcgi" )
stop_seahub
sleep 2
start_seahub_fastcgi
;;
"python-env")
shift
run_python_env "$@"
;;
"clearsessions" )
clear_sessions
;;
esac
echo "Done."
echo ""

View file

@ -1,777 +0,0 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0")
INSTALLPATH=$(dirname "${SCRIPT}")
TOPDIR=$(dirname "${INSTALLPATH}")
default_ccnet_conf_dir=${TOPDIR}/ccnet
default_seafile_data_dir=${TOPDIR}/seafile-data
default_seahub_db=${TOPDIR}/seahub.db
default_conf_dir=${TOPDIR}/conf
default_pids_dir=${TOPDIR}/pids
default_logs_dir=${TOPDIR}/logs
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
use_existing_ccnet="false"
use_existing_seafile="false"
server_manual_http="https://github.com/haiwen/seafile/wiki"
function welcome () {
echo "-----------------------------------------------------------------"
echo "This script will guide you to config and setup your seafile server."
echo -e "\nMake sure you have read seafile server manual at \n\n\t${server_manual_http}\n"
echo -e "Note: This script will guide your to setup seafile server using sqlite3,"
echo "which may have problems if your disk is on a NFS/CIFS/USB."
echo "In these cases, we suggest you setup seafile server using MySQL."
echo
echo "Press [ENTER] to continue"
echo "-----------------------------------------------------------------"
read dummy
echo
}
function err_and_quit () {
printf "\n\n\033[33mError occured during setup. \nPlease fix possible issues and run the script again.\033[m\n\n"
exit 1;
}
function on_ctrl_c_pressed () {
printf "\n\n\033[33mYou have pressed Ctrl-C. Setup is interrupted.\033[m\n\n"
exit 1;
}
# clean newly created ccnet/seafile configs when exit on SIGINT
trap on_ctrl_c_pressed 2
function check_sanity () {
echo `ls ${INSTALLPATH}/seahub`
echo `ls ${INSTALLPATH}/seafile`
echo `ls ${INSTALLPATH}/runtime`
if ! [[ -d ${INSTALLPATH}/seahub && -d ${INSTALLPATH}/seafile \
&& -d ${INSTALLPATH}/runtime ]]; then
echo
echo "The seafile-server diretory doesn't contain all needed files."
echo "Please make sure you have extracted all files and folders from tarball."
err_and_quit;
fi
}
function read_yes_no () {
printf "[yes|no] "
read yesno;
while [[ "${yesno}" != "yes" && "${yesno}" != "no" ]]
do
printf "please answer [yes|no] "
read yesno;
done
if [[ "${yesno}" == "no" ]]; then
return 1;
else
return 0;
fi
}
function check_existing_ccnet () {
if [[ -d ${default_ccnet_conf_dir} ]]; then
echo "It seems that you have created a ccnet configuration before. "
echo "Would you like to use the existing configuration?"
if ! read_yes_no; then
echo
echo "Please remove the existing configuration before continuing."
echo "You can do it by running \"rm -rf ${default_ccnet_conf_dir}\""
echo
exit 1;
else
echo
echo "Existing ccnet configuration is being used."
use_existing_ccnet=true
fi
fi
echo
}
function check_python_executable() {
if [[ "$PYTHON" != "" && -x $PYTHON ]]; then
return 0
fi
if which python2.7 2>/dev/null 1>&2; then
PYTHON=python2.7
elif which python27 2>/dev/null 1>&2; then
PYTHON=python27
else
echo
echo "Can't find a python executable of version 2.7 or above in PATH"
echo "Install python 2.7+ before continue."
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it"
echo
exit 1
fi
echo "Find python: $PYTHON"
echo
}
function check_python_module () {
module=$1
name=$2
hint=$3
printf " Checking python module: ${name} ... "
if ! $PYTHON -c "import ${module}" 2>/dev/null 1>&2; then
echo
printf "\033[33m ${name} \033[m is not installed, Please install it first.\n"
if [[ "${hint}" != "" ]]; then
printf "${hint}"
echo
fi
err_and_quit;
fi
echo -e "Done."
}
function check_python () {
echo "Checking python on this machine ..."
check_python_executable
if ! which $PYTHON 2>/dev/null 1>&2; then
echo "No $PYTHON found on this machine. Please install it first."
err_and_quit;
else
if ($Python --version 2>&1 | grep "3\\.[0-9].\\.[0-9]") 2>/dev/null 1>&2 ; then
printf "\033[33m Python version 3.x \033[m detected\n"
echo "Python 3.x is not supported. Please use python 2.x."
err_and_quit;
fi
if [[ $PYTHON == "python2.6" ]]; then
py26="2.6"
fi
check_python_module sqlite3 python-sqlite3
fi
echo
}
function check_sqlite3 () {
echo -n "Checking for sqlite3 ..."
if ! which sqlite3 2>/dev/null 1>&2; then
echo -e "\nSqlite3 is not found. install it first.\n"
echo "On Debian/Ubuntu: apt-get install sqlite3"
echo "On CentOS/RHEL: yum install sqlite"
err_and_quit;
fi
printf "Done.\n\n"
}
function check_system_dependency () {
printf "Checking packages needed by seafile ...\n\n"
check_python;
check_sqlite3;
printf "Checking Done.\n\n"
}
function ask_question () {
question=$1
default=$2
key=$3
printf "${question}"
printf "\n"
if [[ "${default}" != "" && "${default}" != "nodefault" ]] ; then
printf "[default: ${default} ] "
elif [[ "${key}" != "" ]]; then
printf "[${key}]: "
fi
}
function get_server_name () {
question="What would you like to use as the name of this seafile server?\nYour seafile users will be able to see the name in their seafile client."
hint="You can use a-z, A-Z, 0-9, _ and -, and the length should be 3 ~ 15"
ask_question "${question}\n${hint}" "nodefault" "server name"
read server_name
if [[ "${server_name}" == "" ]]; then
echo
echo "server name cannot be empty"
get_server_name
elif [[ ! ${server_name} =~ ^[a-zA-Z0-9_-]{3,14}$ ]]; then
printf "\n\033[33m${server_name}\033[m is not a valid name.\n"
get_server_name;
fi
echo
}
function get_server_ip_or_domain () {
question="What is the ip or domain of this server?\nFor example, www.mycompany.com, or, 192.168.1.101"
ask_question "${question}\n" "nodefault" "This server's ip or domain"
read ip_or_domain
if [[ "${ip_or_domain}" == "" ]]; then
echo
echo "ip or domain cannot be empty"
get_server_ip_or_domain
fi
echo
}
function get_ccnet_server_port () {
question="What tcp port do you want to use for ccnet server?"
hint="10001 is the recommended port."
default="10001"
ask_question "${question}\n${hint}" "${default}"
read server_port
if [[ "${server_port}" == "" ]]; then
server_port="${default}"
fi
if [[ ! ${server_port} =~ ^[0-9]+$ ]]; then
echo "\"${server_port}\" is not a valid port number. "
get_ccnet_server_port
fi
echo
}
function get_seafile_server_port () {
question="What tcp port would you like to use for seafile server?"
hint="12001 is the recommended port."
default="12001"
ask_question "${question}\n${hint}" "${default}"
read seafile_server_port
if [[ "${seafile_server_port}" == "" ]]; then
seafile_server_port="${default}"
fi
if [[ ! ${seafile_server_port} =~ ^[0-9]+$ ]]; then
echo "\"${seafile_server_port}\" is not a valid port number. "
get_seafile_server_port
fi
echo
}
function get_fileserver_port () {
question="What tcp port do you want to use for seafile fileserver?"
hint="8082 is the recommended port."
default="8082"
ask_question "${question}\n${hint}" "${default}"
read fileserver_port
if [[ "${fileserver_port}" == "" ]]; then
fileserver_port="${default}"
fi
if [[ ! ${fileserver_port} =~ ^[0-9]+$ ]]; then
echo "\"${fileserver_port}\" is not a valid port number. "
get_fileserver_port
fi
echo
}
function get_seafile_data_dir () {
question="Where would you like to store your seafile data?"
note="Please use a volume with enough free space."
default=${default_seafile_data_dir}
ask_question "${question} \n\033[33mNote: \033[m${note}" "${default}"
read seafile_data_dir
if [[ "${seafile_data_dir}" == "" ]]; then
seafile_data_dir=${default}
fi
if [[ -d ${seafile_data_dir} && -f ${seafile_data_dir}/seafile.conf ]]; then
echo
echo "It seems that you have already existing seafile data in ${seafile_data_dir}."
echo "Would you like to use the existing seafile data?"
if ! read_yes_no; then
echo "You have chosen not to use existing seafile data in ${seafile_data_dir}"
echo "You need to specify a different seafile data directory or remove ${seafile_data_dir} before continuing."
get_seafile_data_dir
else
use_existing_seafile="true"
fi
elif [[ -d ${seafile_data_dir} && $(ls -A ${seafile_data_dir}) != "" ]]; then
echo
echo "${seafile_data_dir} is an existing non-empty directory. Please specify a different directory"
echo
get_seafile_data_dir
elif [[ ! ${seafile_data_dir} =~ ^/ ]]; then
echo
echo "\"${seafile_data_dir}\" is not an absolute path. Please specify an absolute path."
echo
get_seafile_data_dir
elif [[ ! -d $(dirname ${seafile_data_dir}) ]]; then
echo
echo "The path $(dirname ${seafile_data_dir}) does not exist."
echo
get_seafile_data_dir
fi
echo
}
function gen_gunicorn_conf () {
mkdir -p ${default_conf_dir}
gunicorn_conf=${default_conf_dir}/gunicorn.conf
if ! $(cat > ${gunicorn_conf} <<EOF
import os
daemon = True
workers = 5
# default localhost:8000
bind = "127.0.0.1:8000"
# Pid
pids_dir = '$default_pids_dir'
pidfile = os.path.join(pids_dir, 'seahub.pid')
# for file upload, we need a longer timeout value (default is only 30s, too short)
timeout = 1200
limit_request_line = 8190
EOF
); then
echo "failed to generate gunicorn.conf";
err_and_quit
fi
}
function gen_seafdav_conf () {
mkdir -p ${default_conf_dir}
seafdav_conf=${default_conf_dir}/seafdav.conf
if ! $(cat > ${seafdav_conf} <<EOF
[WEBDAV]
enabled = false
port = 8080
fastcgi = false
host = 0.0.0.0
share_name = /
EOF
); then
echo "failed to generate seafdav.conf";
err_and_quit
fi
}
function copy_user_manuals() {
src_docs_dir=${INSTALLPATH}/seafile/docs/
library_template_dir=${seafile_data_dir}/library-template
mkdir -p ${library_template_dir}
cp -f ${src_docs_dir}/*.doc ${library_template_dir}
}
function parse_params() {
while getopts n:i:p:d arg; do
case $arg in
n)
server_name=${OPTARG}
;;
i)
ip_or_domain=${OPTARG}
;;
p)
fileserver_port=${OPTARG}
;;
d)
seafile_data_dir=${OPTARG}
;;
esac
done
}
function validate_params() {
# server_name default hostname -s
if [[ "$server_name" == "" ]]; then
server_name=${SERVER_NAME:-`hostname -s`}
fi
if [[ ! ${server_name} =~ ^[a-zA-Z0-9_-]{3,14}$ ]]; then
echo "Invalid server name param"
err_and_quit;
fi
# ip_or_domain default hostname -i
if [[ "$ip_or_domain" == "" ]]; then
ip_or_domain=${SERVER_IP:-`hostname -i`}
fi
if [[ "$ip_or_domain" != "" && ! ${ip_or_domain} =~ ^[^.].+\..+[^.]$ ]]; then
echo "Invalid ip or domain param"
err_and_quit;
fi
# fileserver_port default 8082
if [[ "${fileserver_port}" == "" ]]; then
fileserver_port=${FILESERVER_PORT:-8082}
fi
if [[ ! ${fileserver_port} =~ ^[0-9]+$ ]]; then
echo "Invalid fileserver port param"
err_and_quit;
fi
if [[ "${seafile_data_dir}" == "" ]]; then
seafile_data_dir=${SEAFILE_DIR:-${default_seafile_data_dir}}
fi
if [[ -d ${seafile_data_dir} && $(ls -A ${seafile_data_dir}) != "" ]]; then
echo "${seafile_data_dir} is an existing non-empty directory. Please specify a different directory"
err_and_quit
elif [[ ! ${seafile_data_dir} =~ ^/ ]]; then
echo "\"${seafile_data_dir}\" is not an absolute path. Please specify an absolute path."
err_and_quit
elif [[ ! -d $(dirname ${seafile_data_dir}) ]]; then
echo "The path $(dirname ${seafile_data_dir}) does not exist."
err_and_quit
fi
}
function usage() {
echo "auto mode:"
echo -e "$0 auto\n" \
"-n server name\n" \
"-i ip or domain\n" \
"-p fileserver port\n" \
"-d seafile dir to store seafile data"
echo ""
echo "interactive mode:"
echo "$0"
}
# -------------------------------------------
# Main workflow of this script
# -------------------------------------------
for param in $@; do
if [[ "$param" == "-h" || "$param" == "--help" ]]; then
usage;
exit 0
fi
done
need_pause=1
if [[ $# -ge 1 && "$1" == "auto" ]]; then
# auto mode, no pause
shift
parse_params $@;
validate_params;
need_pause=0
fi
check_sanity;
if [[ "${need_pause}" == "1" ]]; then
welcome;
fi
sleep .5
check_system_dependency;
sleep .5
check_existing_ccnet;
if [[ ${use_existing_ccnet} != "true" ]]; then
if [[ "${server_name}" == "" ]]; then
get_server_name;
fi
if [[ "${ip_or_domain}" == "" ]]; then
get_server_ip_or_domain;
fi
# get_ccnet_server_port;
fi
if [[ "$seafile_data_dir" == "" ]]; then
get_seafile_data_dir;
fi
if [[ ${use_existing_seafile} != "true" ]]; then
# get_seafile_server_port
if [[ "$fileserver_port" == "" ]]; then
get_fileserver_port
fi
fi
sleep .5
printf "\nThis is your config information:\n\n"
if [[ ${use_existing_ccnet} != "true" ]]; then
printf "server name: \033[33m${server_name}\033[m\n"
printf "server ip/domain: \033[33m${ip_or_domain}\033[m\n"
else
printf "ccnet config: use existing config in \033[33m${default_ccnet_conf_dir}\033[m\n"
fi
if [[ ${use_existing_seafile} != "true" ]]; then
printf "seafile data dir: \033[33m${seafile_data_dir}\033[m\n"
printf "fileserver port: \033[33m${fileserver_port}\033[m\n"
else
printf "seafile data dir: use existing data in \033[33m${seafile_data_dir}\033[m\n"
fi
if [[ "${need_pause}" == "1" ]]; then
echo
echo "If you are OK with the configuration, press [ENTER] to continue."
read dummy
fi
ccnet_init=/usr/bin/ccnet-init
seaf_server_init=/usr/bin/seaf-server-init
# -------------------------------------------
# Create ccnet conf
# -------------------------------------------
if [[ "${use_existing_ccnet}" != "true" ]]; then
echo "Generating ccnet configuration in ${default_ccnet_conf_dir}..."
echo
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH "${ccnet_init}" \
-F "${default_conf_dir}" \
-c "${default_ccnet_conf_dir}" \
--name "${server_name}" \
--host "${ip_or_domain}"; then
err_and_quit;
fi
echo
fi
sleep 0.5
# -------------------------------------------
# Create seafile conf
# -------------------------------------------
if [[ "${use_existing_seafile}" != "true" ]]; then
echo "Generating seafile configuration in ${seafile_data_dir} ..."
echo
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_server_init} \
--central-config-dir "${default_conf_dir}" \
--seafile-dir "${seafile_data_dir}" \
--fileserver-port ${fileserver_port}; then
echo "Failed to generate seafile configuration"
err_and_quit;
fi
echo
fi
# -------------------------------------------
# Write seafile.ini
# -------------------------------------------
echo "${seafile_data_dir}" > "${default_ccnet_conf_dir}/seafile.ini"
# -------------------------------------------
# Generate gunicorn.conf
# -------------------------------------------
gen_gunicorn_conf;
# -------------------------------------------
# Generate seafevents.conf
# -------------------------------------------
gen_seafdav_conf;
# -------------------------------------------
# generate seahub/settings.py
# -------------------------------------------
dest_settings_py=${TOPDIR}/conf/seahub_settings.py
seahub_secret_keygen=${INSTALLPATH}/seahub/tools/secret_key_generator.py
if [[ ! -f ${dest_settings_py} ]]; then
key=$($PYTHON "${seahub_secret_keygen}")
cat > ${dest_settings_py} <<EOF
# -*- coding: utf-8 -*-
SECRET_KEY = "$key"
EOF
fi
# -------------------------------------------
# Seahub related config
# -------------------------------------------
if [[ "${need_pause}" == "1" ]]; then
echo "-----------------------------------------------------------------"
echo "Seahub is the web interface for seafile server."
echo "Now let's setup seahub configuration. Press [ENTER] to continue"
echo "-----------------------------------------------------------------"
echo
read dummy
fi
# echo "Please specify the email address and password for the seahub administrator."
# echo "You can use them to login as admin on your seahub website."
# echo
function get_seahub_admin_email () {
question="Please specify the email address for the seahub administrator:"
ask_question "${question}" "nodefault" "seahub admin email"
read seahub_admin_email
if [[ "${seahub_admin_email}" == "" ]]; then
echo "Seahub admin user name cannot be empty."
get_seahub_admin_email;
elif [[ ! ${seahub_admin_email} =~ ^.+@.*\..+$ ]]; then
echo "${seahub_admin_email} is not a valid email address"
get_seahub_admin_email;
fi
}
function get_seahub_admin_passwd () {
echo
question="Please specify the password you would like to use for seahub administrator:"
ask_question "${question}" "nodefault" "seahub admin password"
read -s seahub_admin_passwd
echo
question="Please enter the password again:"
ask_question "${question}" "nodefault" "seahub admin password again"
read -s seahub_admin_passwd_again
echo
if [[ "${seahub_admin_passwd}" != "${seahub_admin_passwd_again}" ]]; then
printf "\033[33mThe passwords didn't match.\033[m"
get_seahub_admin_passwd;
elif [[ "${seahub_admin_passwd}" == "" ]]; then
echo "Password cannot be empty."
get_seahub_admin_passwd;
fi
}
# get_seahub_admin_email;
# sleep .5;
# get_seahub_admin_passwd;
# seahub_admin_passwd_enc=$(echo -n ${seahub_admin_passwd} | sha1sum | grep -o "[0-9a-f]*")
# sleep .5;
# printf "\n\n"
# echo "This is your seahub admin username/password"
# echo
# printf "admin username: \033[33m${seahub_admin_email}\033[m\n"
# printf "admin password: \033[33m**************\033[m\n\n"
# echo
# echo "If you are OK with the configuration, press [ENTER] to continue."
# read dummy
# usermgr_db_dir=${default_ccnet_conf_dir}/PeerMgr/
# usermgr_db=${usermgr_db_dir}/usermgr.db
# if [[ "${use_existing_ccnet}" != "true" ]]; then
# # create admin user/passwd entry in ccnet db
# if ! mkdir -p "${usermgr_db_dir}"; then
# echo "Failed to create seahub admin."
# err_and_quit;
# fi
# sql="CREATE TABLE IF NOT EXISTS EmailUser (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, email TEXT, passwd TEXT, is_staff bool NOT NULL, is_active bool NOT NULL, ctime INTEGER)";
# if ! sqlite3 "${usermgr_db}" "${sql}" ; then
# rm -f "${usermgr_db}"
# echo "Failed to create seahub admin."
# err_and_quit;
# fi
# sql="INSERT INTO EmailUser(email, passwd, is_staff, is_active, ctime) VALUES (\"${seahub_admin_email}\", \"${seahub_admin_passwd_enc}\", 1, 1, 0);"
# if ! sqlite3 "${usermgr_db}" "${sql}" ; then
# rm -f "${usermgr_db}"
# echo "Failed to create seahub admin."
# err_and_quit;
# fi
# fi
echo "Creating database now, it may take one minute, please wait... "
echo
cd ${TOPDIR}/ccnet && mkdir -m 0755 GroupMgr misc OrgMgr PeerMgr && cd -
ccnet_group_db=${TOPDIR}/ccnet/GroupMgr/groupmgr.db
ccnet_group_sql=${INSTALLPATH}/sql/sqlite/groupmgr.sql
if ! sqlite3 ${ccnet_group_db} ".read ${ccnet_group_sql}" 2>/dev/null 1>&2; then
echo "Failed to sync ccnet groupmgr database."
err_and_quit;
fi
ccnet_config_db=${TOPDIR}/ccnet/misc/config.db
ccnet_config_sql=${INSTALLPATH}/sql/sqlite/config.sql
if ! sqlite3 ${ccnet_config_db} ".read ${ccnet_config_sql}" 2>/dev/null 1>&2; then
echo "Failed to sync ccnet config database."
err_and_quit;
fi
ccnet_org_db=${TOPDIR}/ccnet/OrgMgr/orgmgr.db
ccnet_org_sql=${INSTALLPATH}/sql/sqlite/org.sql
if ! sqlite3 ${ccnet_org_db} ".read ${ccnet_org_sql}" 2>/dev/null 1>&2; then
echo "Failed to sync ccnet org database."
err_and_quit;
fi
ccnet_user_db=${TOPDIR}/ccnet/PeerMgr/usermgr.db
ccnet_user_sql=${INSTALLPATH}/sql/sqlite/user.sql
if ! sqlite3 ${ccnet_user_db} ".read ${ccnet_user_sql}" 2>/dev/null 1>&2; then
echo "Failed to sync ccnet user database."
err_and_quit;
fi
seafile_db=${TOPDIR}/seafile-data/seafile.db
seafile_sql=${INSTALLPATH}/sql/sqlite/seafile.sql
if ! sqlite3 ${seafile_db} ".read ${seafile_sql}" 2>/dev/null 1>&2; then
echo "Failed to sync seafile database."
err_and_quit;
fi
seahub_db=${TOPDIR}/seahub.db
seahub_sqls=${INSTALLPATH}/seahub/sql/sqlite3.sql
if ! sqlite3 ${seahub_db} ".read ${seahub_sqls}" 2>/dev/null 1>&2; then
echo "Failed to sync seahub database."
err_and_quit;
fi
echo
echo "Done."
# prepare avatar folder
media_dir=${INSTALLPATH}/seahub/media
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
if [[ ! -d ${dest_avatar_dir} ]]; then
mkdir -p "${TOPDIR}/seahub-data"
mv "${orig_avatar_dir}" "${dest_avatar_dir}"
ln -s ../../../seahub-data/avatars ${media_dir}
fi
# Make a seafile-server symlink, like this:
# /data/haiwen/
# -- seafile-server-2.0.4
# -- seafile-server-latest # symlink to 2.0.4
seafile_server_symlink=${TOPDIR}/seafile-server-latest
echo
echo -n "creating seafile-server-latest symbolic link ... "
if ! ln -s $(basename ${INSTALLPATH}) ${seafile_server_symlink}; then
echo
echo
echo "Failed to create symbolic link ${seafile_server_symlink}"
err_and_quit;
fi
echo "done"
echo
chmod 0600 "$dest_settings_py"
chmod 0700 "$default_ccnet_conf_dir"
chmod 0700 "$seafile_data_dir"
chmod 0700 "$default_conf_dir"
# -------------------------------------------
# copy user manuals to library template
# -------------------------------------------
copy_user_manuals;
# -------------------------------------------
# final message
# -------------------------------------------
sleep 1
echo
echo "-----------------------------------------------------------------"
echo "Your seafile server configuration has been completed successfully."
echo "-----------------------------------------------------------------"
echo
echo "run seafile server: ./seafile.sh { start | stop | restart }"
echo "run seahub server: ./seahub.sh { start <port> | stop | restart <port> }"
echo
echo "-----------------------------------------------------------------"
echo "If the server is behind a firewall, remember to open these tcp ports:"
echo "-----------------------------------------------------------------"
echo
echo "port of seafile fileserver: ${fileserver_port}"
echo "port of seahub: 8000"
echo
echo -e "When problems occur, refer to\n"
echo -e " ${server_manual_http}\n"
echo "for more information."
echo

View file

@ -1,65 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python2_7 )
inherit python-single-r1
DESCRIPTION="The web end of seafile server"
HOMEPAGE="https://github.com/haiwen/seahub/"
SRC_URI="https://github.com/haiwen/seahub/archive/v${PV}-server.tar.gz -> ${P}.tar.gz"
LICENSE=""
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE=""
#see with requirements.txt
RDEPEND="dev-python/python-dateutil[${PYTHON_USEDEP}]
dev-python/python-memcached[${PYTHON_USEDEP}]
dev-python/chardet[${PYTHON_USEDEP}]
dev-python/six[${PYTHON_USEDEP}]
dev-python/pillow[${PYTHON_USEDEP}]
=dev-python/django-1.11*[${PYTHON_USEDEP}]
dev-python/django_compressor[${PYTHON_USEDEP}]
dev-python/django-post_office-haiwen[${PYTHON_USEDEP}]
dev-python/django-statici18n[${PYTHON_USEDEP}]
dev-python/djangorestframework[${PYTHON_USEDEP}]
dev-python/django-constance-haiwen[${PYTHON_USEDEP},database]
dev-python/openpyxl[${PYTHON_USEDEP}]
dev-python/pytz[${PYTHON_USEDEP}]
dev-python/django-formtools[${PYTHON_USEDEP}]
dev-python/qrcode[${PYTHON_USEDEP}]
dev-python/requests[${PYTHON_USEDEP}]
dev-python/requests-oauthlib[${PYTHON_USEDEP}]
dev-python/django-simple-captcha[${PYTHON_USEDEP}]
www-servers/gunicorn
dev-python/django-webpack-loader[${PYTHON_USEDEP}]
dev-python/python-cas-haiwen[${PYTHON_USEDEP}]
virtual/python-futures[${PYTHON_USEDEP}]
dev-python/social-auth-core[${PYTHON_USEDEP}]
dev-python/flup[${PYTHON_USEDEP}]"
#TODO:
#ccnet-server[sqlite] ?
S="${WORKDIR}/${P}-server"
src_compile() {
emake locale
}
src_install() {
# dodir /opt/Tiredful-API
# cp -R "${S}"/Tiredful-API "${D}"/opt/
einfo "Please follow postisnt instruction"
}
pkg_postinst() {
einfo "The GUI server is not ready to be started yet"
einfo "Please follow the following steps to complete configuration:"
einfo " https://manual.seafile.com/deploy/using_sqlite.html"
einfo " https://manual.seafile.com/build_seafile/server.html"
einfo "also see ${FILESDIR} for modified scripts"
}