aboutsummaryrefslogtreecommitdiff
path: root/net/seafile-server
diff options
context:
space:
mode:
authorGergely Kiss <mail.gery@gmail.com>2016-04-30 10:37:30 +0200
committerEtienne CHAMPETIER <champetier.etienne@gmail.com>2016-08-24 20:35:33 +0000
commit437621931a1561ae23604c619fde40f78d750c3c (patch)
tree59c792f612d9fb2f199d18e2397e3487248dbb1d /net/seafile-server
parent39e937fae7608da2e260505e312d8d5f5ed7a225 (diff)
seafile: import version 5.1.1 and its dependencies
Signed-off-by: Gergely Kiss <mail.gery@gmail.com>
Diffstat (limited to 'net/seafile-server')
-rw-r--r--net/seafile-server/Makefile102
-rw-r--r--net/seafile-server/files/seafile.conf10
-rwxr-xr-xnet/seafile-server/files/seafile.init166
-rwxr-xr-xnet/seafile-server/files/seahub.init226
-rw-r--r--net/seafile-server/patches/020-script-patches.patch95
-rw-r--r--net/seafile-server/patches/030-pidfiles-in-same-directory.patch8
-rw-r--r--net/seafile-server/patches/040-seafile-admin.patch69
-rw-r--r--net/seafile-server/patches/050-libevhtp-search-path-fix.patch17
-rw-r--r--net/seafile-server/patches/050-libseafile-makefile-fixes.patch43
-rw-r--r--net/seafile-server/patches/060-libevent2-include-path.patch107
-rw-r--r--net/seafile-server/patches/060-timestamps-as-int64.patch39
11 files changed, 592 insertions, 290 deletions
diff --git a/net/seafile-server/Makefile b/net/seafile-server/Makefile
index 949345d8a..bbc155a45 100644
--- a/net/seafile-server/Makefile
+++ b/net/seafile-server/Makefile
@@ -1,29 +1,28 @@
#
-# Copyright (C) 2007-2015 OpenWrt.org
+# Copyright (C) 2007-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
-# NOTE: make sure to update EXTRA_DEPENDS in case of version/release changes!
-
include $(TOPDIR)/rules.mk
PKG_NAME:=seafile-server
-PKG_VERSION:=4.1.2
-PKG_RELEASE=$(PKG_SOURCE_VERSION)-5
+PKG_VERSION:=5.1.1
+PKG_RELEASE=$(PKG_SOURCE_VERSION)-1
PKG_LICENSE:=GPL-3.0
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/haiwen/seafile.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=c0166019c712e2e1d5e532fd5f7401b1b72db6d8
+PKG_SOURCE_VERSION:=5a8677a3acdde748caa387adfc054da64f2a24ea
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
+$(call include_mk, python-package.mk)
define Package/seafile-server
SECTION:=net
@@ -31,21 +30,16 @@ define Package/seafile-server
TITLE:=Seafile server
MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
URL:=http://seafile.com/
- DEPENDS:=+libarchive +libopenssl +glib2 +libsearpc +seafile-ccnet +seafile-seahub \
- +sqlite3-cli +python-mysql +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 \
- +libmysqlclient +libpthread +libuuid \
- +bash +sudo +procps-ng +procps-ng-pkill $(ICONV_DEPENDS)
- EXTRA_DEPENDS:=seafile-ccnet (=4.1.2-a73109f09af4ecc49cdc4c57cdde51b38e15c31a-2), seafile-seahub (=4.1.2-3fb1288f920de03a4e2e6a06b60671ce98971742)
+ DEPENDS:=+libarchive +libopenssl +glib2 +libsearpc +seafile-ccnet +seafile-seahub +sqlite3-cli +python-mysql \
+ +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 +libmysqlclient +libevhtp \
+ +libpthread +libuuid +bash +procps +procps-pkill $(ICONV_DEPENDS)
+ EXTRA_DEPENDS:=seafile-ccnet (=5.1.1-6d94fdc4296d542a5552039dc13a67c3448e8b13-1), seafile-seahub (=5.1.1-95f762f396c81f840fe658ab983df53784083bb1-1), libevhtp (>=1.2.10)
endef
define Package/seafile-server/description
Open source cloud storage with advanced features on privacy protection and teamwork.
endef
-define Package/seafile-server/conffiles
-/etc/config/seafile
-endef
-
CONFIGURE_ARGS += --disable-riak \
--disable-client \
--disable-fuse \
@@ -55,87 +49,71 @@ CONFIGURE_ARGS += --disable-riak \
--disable-server-pkg \
--disable-console
-PKG_BUILD_DEPENDS:=vala/host \
- libsearpc/host \
- libevhtp-1.1
+PKG_BUILD_DEPENDS:=vala/host
TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
-L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
+define Package/seafile-server/conffiles
+/etc/config/seafile
+endef
+
define Package/seafile-server/install
$(INSTALL_DIR) $(1)/usr/{bin,lib}
- $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
- $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/runtime
- $(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+ $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server
+ $(INSTALL_DIR) $(1)/usr/share/seafile/conf
+ $(INSTALL_DIR) $(1)/etc/{config,init.d}
$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seafile/ $(1)/usr/lib/python2.7/site-packages/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seaserv/ $(1)/usr/lib/python2.7/site-packages/
+ $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/
+ $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
+ $(CP) $(PKG_BUILD_DIR)/scripts/seaf-fsck.sh $(1)/usr/share/seafile/seafile-server/
$(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
$(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
$(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
$(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
+ $(CP) $(PKG_BUILD_DIR)/scripts/check_init_admin.py $(1)/usr/share/seafile/seafile-server/
$(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
- $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
$(CP) ./files/seafile.conf $(1)/etc/config/seafile
+ $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
+ $(INSTALL_BIN) ./files/seahub.init $(1)/etc/init.d/seahub
+ find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
$(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/
+ $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/
endef
define Package/seafile-server/postinst
#!/bin/sh
-if ! group_exists seafile; then
- group_add_next seafile; fi
-
-SEAFILE_GID=$$(grep -s '^seafile:' "$${IPKG_INSTROOT}/etc/group" | cut -d: -f3)
-
-if ! user_exists seafile; then
- user_add seafile "" "$${SEAFILE_GID}" seafile /usr/share/seafile /bin/sh; fi
-
-if [ -z "$${IPKG_INSTROOT}" ]
+if [ ! -d /usr/share/seafile/seafile-data ]
then
- chown -R seafile:seafile /usr/share/seafile/
- chmod -R o-rwx /usr/share/seafile/
+ echo "*** Installation completed, running configuration script..."
+ /etc/init.d/seafile setup
- if [ ! -d /usr/share/seafile/seafile-data ]
+ if [ $$? -ne 0 ]
then
- echo "*** Installation completed, running configuration script..."
- /etc/init.d/seafile setup
-
- if [ $$? -ne 0 ]
- then
- echo
- echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
- echo "*** \"/etc/init.d/seafile setup\""
- fi
-
- echo
- echo "*** NOTE: you need to create an admin account before using Seafile."
- echo "*** Please run \"/etc/init.d/seafile create_admin\" to do so."
- else
- echo "*** It seems you are upgrading from an older version."
- echo "*** If so, please run the appropriate upgrade scripts before using the new version of Seafile."
- echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
echo
- echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
+ echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
+ echo "*** \"/etc/init.d/seafile setup\""
fi
else
- cat > "$${IPKG_INSTROOT}/etc/uci-defaults/99_seafile-server" << EOF
-#!/bin/sh
-
-chown -R seafile:seafile /usr/share/seafile/
-chmod -R o-rwx /usr/share/seafile/
-exit 0
-EOF
+ echo "*** seafile-data directory already exists."
+ echo "*** In case you are upgrading seafile, please run the appropriate upgrade script"
+ echo "*** manually before using the new version of Seafile."
+ echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
+ echo
+ echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
fi
endef
diff --git a/net/seafile-server/files/seafile.conf b/net/seafile-server/files/seafile.conf
index fa8240e94..f4c0ea9d0 100644
--- a/net/seafile-server/files/seafile.conf
+++ b/net/seafile-server/files/seafile.conf
@@ -1,2 +1,12 @@
# Start Seahub in fastcgi mode - 1 = enable, 0 = disable
SEAHUB_FASTCGI=0
+# Listen on the port specified below (defaults to 8000)
+SEAHUB_PORT=8000
+# Method of serving requests (fastcgi mode only) - threaded or prefork
+# Using threaded mode is recommended as it consumes less resources
+SEAHUB_METHOD=threaded
+# The maximum number of worker processes/threads (fastcgi mode only)
+# General formula: (2 x $num_cores) + 1
+# To set the number of workers in WSGI mode (which is the default)
+# please edit /usr/share/seafile/seafile-server/runtime/seahub.conf
+SEAHUB_WORKERS=3
diff --git a/net/seafile-server/files/seafile.init b/net/seafile-server/files/seafile.init
index 42f98e2d9..1c6553a2e 100755
--- a/net/seafile-server/files/seafile.init
+++ b/net/seafile-server/files/seafile.init
@@ -1,57 +1,157 @@
-#!/bin/sh /etc/rc.common
+#!/bin/bash /etc/rc.common
-START=99
+START=98
APP=seafile
EXTRA_HELP=" setup Runs the setup script
create_admin Creates the administrative login
reset_admin Alias to create_admin"
EXTRA_COMMANDS="setup create_admin reset_admin"
-SEAHUB_FASTCGI=0
+TOPDIR=/usr/share/seafile
+default_ccnet_conf_dir=${TOPDIR}/ccnet
+central_config_dir=${TOPDIR}/conf
+seaf_controller=/usr/bin/seafile-controller
-[ -f /etc/config/seafile ] && \
- . /etc/config/seafile
+function validate_ccnet_conf_dir () {
+ if [[ ! -d ${default_ccnet_conf_dir} ]]; then
+ echo "Error: there is no ccnet config directory."
+ echo "Have you run \"/etc/init.d/seafile setup\"?"
+ 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 \"/etc/init.d/seafile setup\"?"
+ echo ""
+ exit 1
+ fi
+}
+
+function read_seafile_data_dir () {
+ seafile_ini=${default_ccnet_conf_dir}/seafile.ini
+ if [[ ! -f ${seafile_ini} ]]; then
+ echo "Error: ${seafile_ini} not found."
+ 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 ! ${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
+ return 1
+ fi
+}
-export PATH="/usr/share/seafile/seafile-server/seahub/thirdpart:${PATH}"
-export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:${PYTHONPATH}"
+function validate_already_running () {
+ check_component_running "seafile-controller" "seafile-controller -F ${central_config_dir}" || return 1
+ check_component_running "ccnet-server" "ccnet-server -F ${central_config_dir}" || return 1
+ check_component_running "seaf-server" "seaf-server -F ${central_config_dir}" || return 1
+ check_component_running "fileserver" "fileserver -F ${central_config_dir}" || return 1
+ check_component_running "seafdav" "wsgidav.server.run_server" || return 1
+}
+
+function start_seafile_server () {
+ if ! validate_already_running; then
+ if [[ "$name" == "seafile-controller" ]]; then
+ echo "Seafile already running."
+ else
+ echo "Error: component [$name] is already running. Please try stopping it manually by running \"kill $pid\"."
+ echo "To force killing the process, use \"kill -9 $pid\"."
+ fi
+ exit 1
+ fi
+ validate_central_conf_dir
+ validate_ccnet_conf_dir
+ read_seafile_data_dir
+ test_config
+
+ echo "Starting seafile server, please wait ..."
-start() {
- if [ ! -d /var/run/seafile ]
- then
- mkdir /var/run/seafile
- chown seafile:seafile /var/run/seafile
- chmod o-rwx /var/run/seafile
+ ${seaf_controller} \
+ -F "${central_config_dir}" \
+ -c "${default_ccnet_conf_dir}" \
+ -d "${seafile_data_dir}"
+
+ sleep 3
+
+ # check if seafile server started successfully
+ if ! pgrep -f "seafile-controller -F ${central_config_dir}" 2>/dev/null 1>&2; then
+ echo "Failed to start seafile server"
+ exit 1
fi
- if [ ${SEAHUB_FASTCGI} -eq 1 ]; then
- cd "/usr/share/seafile" && \
- sudo PYTHONPATH="${PYTHONPATH}" -u seafile -E \
- "/usr/bin/seafile-admin" start --fastcgi
+ echo "Seafile server started"
+ echo
+}
+
+function stop_seafile_server () {
+ if ! pgrep -f "seafile-controller -F ${central_config_dir}" 2>/dev/null 1>&2; then
+ echo "Seafile server not running"
else
- cd "/usr/share/seafile" && \
- sudo PYTHONPATH="${PYTHONPATH}" -u seafile -E \
- "/usr/bin/seafile-admin" start
+ echo "Stopping seafile server ..."
+ pkill -SIGTERM -f "seafile-controller -F ${central_config_dir}"
+ pkill -f "ccnet-server -F ${central_config_dir}"
+ pkill -f "seaf-server -F ${central_config_dir}"
+ pkill -f "fileserver -F ${central_config_dir}"
+ pkill -f "soffice.*--invisible --nocrashreport"
+ pkill -f "wsgidav.server.run_server"
+ retry=1
+ while ! validate_already_running && [ $retry -lt 60 ]; do sleep 1; ((retry++)); done
+ if ! validate_already_running; then
+ echo "Error: [$name] component is still running. Please try stopping it manually by running \"kill $pid\"."
+ echo "To force killing the process, use \"kill -9 $pid\"."
+ fi
+
fi
}
-stop() {
- cd "/usr/share/seafile" && \
- sudo PYTHONPATH="${PYTHONPATH}" -u seafile -E \
- "/usr/bin/seafile-admin" stop
+function restart_seafile_server () {
+ stop_seafile_server
+ start_seafile_server
+}
+
+function start() {
+ start_seafile_server
+}
+
+function stop() {
+ stop_seafile_server
+}
+
+function restart() {
+ restart_seafile_server
}
-setup() {
- cd "/usr/share/seafile" && \
- sudo PYTHONPATH="${PYTHONPATH}" -u seafile -E \
- "/usr/bin/seafile-admin" setup
+function setup() {
+ cd "$TOPDIR" && \
+ /usr/bin/seafile-admin setup
}
-create_admin() {
- cd "/usr/share/seafile" && \
- sudo PYTHONPATH="${PYTHONPATH}" -u seafile -E \
- "/usr/bin/seafile-admin" create-admin
+function create_admin() {
+ cd "$TOPDIR" && \
+ /usr/bin/seafile-admin create-admin
}
-reset_admin() {
+function reset_admin() {
create_admin
}
diff --git a/net/seafile-server/files/seahub.init b/net/seafile-server/files/seahub.init
new file mode 100755
index 000000000..da3a1d1a7
--- /dev/null
+++ b/net/seafile-server/files/seahub.init
@@ -0,0 +1,226 @@
+#!/bin/bash /etc/rc.common
+
+START=99
+APP=seahub
+EXTRA_HELP=" clearsessions Clears expired sessions from database"
+EXTRA_COMMANDS="clearsessions"
+
+SEAHUB_FASTCGI=0
+SEAHUB_PORT=8000
+SEAHUB_METHOD=threaded
+SEAHUB_WORKERS=3
+
+[ -f /etc/config/seafile ] && \
+ . /etc/config/seafile
+
+INSTALLPATH=/usr/share/seafile/seafile-server
+TOPDIR=$(dirname "${INSTALLPATH}")
+default_ccnet_conf_dir=${TOPDIR}/ccnet
+central_config_dir=${TOPDIR}/conf
+
+manage_py=${INSTALLPATH}/seahub/manage.py
+gunicorn_conf=${INSTALLPATH}/runtime/seahub.conf
+pidfile=/var/run/seafile/seahub.pid
+errorlog=${INSTALLPATH}/runtime/error.log
+accesslog=${INSTALLPATH}/runtime/access.log
+gunicorn_exe=/usr/bin/gunicorn
+
+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 '/etc/init.d/seafile setup'?"
+ echo ""
+ exit 1
+ fi
+}
+
+function read_seafile_data_dir() {
+ seafile_ini=${default_ccnet_conf_dir}/seafile.ini
+ if [[ ! -f ${seafile_ini} ]]; then
+ echo "Error: ${seafile_ini} not found."
+ 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 pid=$(pgrep -f "${manage_py}" 2>/dev/null); then
+ return 1
+ elif pid=$(pgrep -f "seahub.wsgi:application" 2>/dev/null); then
+ return 1
+ fi
+}
+
+function validate_port() {
+ if ! [[ ${SEAHUB_PORT} =~ ^[1-9][0-9]{1,4}$ ]] ; then
+ printf "\033[033m${SEAHUB_PORT}\033[m is not a valid port number\n"
+ exit 1
+ fi
+}
+
+function warning_if_seafile_not_running() {
+ if ! pgrep -f "seafile-controller -F ${central_config_dir}" 2>/dev/null 1>&2; then
+ echo
+ echo "Error: seafile-controller not running. Have you run \"/etc/init.d/seafile 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 log dir \"${logdir}\""
+ exit 1
+ fi
+ fi
+ export SEAHUB_LOG_DIR="${logdir}"
+}
+
+function before_start() {
+ prepare_env
+ warning_if_seafile_not_running
+ if ! validate_seahub_running; then
+ echo "Seahub is already running."
+ exit 1
+ fi
+ prepare_seahub_log_dir
+ validate_port
+}
+
+function start_seahub() {
+ before_start
+ echo "Starting seahub at port ${SEAHUB_PORT} ..."
+ check_init_admin
+ $PYTHON $gunicorn_exe seahub.wsgi:application -c "${gunicorn_conf}" -b "0.0.0.0:${SEAHUB_PORT}" --preload
+
+ # Ensure seahub is started successfully
+ retry=1
+ while ! validate_seahub_running && [[ ! -f "${pidfile}" ]] && [[ $retry -lt 120 ]]; do sleep 1; ((retry++)); done
+ if ! validate_seahub_running && [[ -f "${pidfile}" ]]; then
+ echo
+ echo "Seahub is started"
+ echo
+ else
+ printf "\033[33mError: Seahub failed to start.\033[m\n"
+ exit 1
+ fi
+}
+
+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}:${SEAHUB_PORT} ..."
+ check_init_admin
+ $PYTHON "${manage_py}" runfcgi host=${address} port=${SEAHUB_PORT} pidfile=${pidfile} \
+ outlog=${accesslog} errlog=${errorlog} maxchildren=${SEAHUB_WORKERS} method=${SEAHUB_METHOD}
+
+ # Ensure seahub is started successfully
+ retry=1
+ while ! validate_seahub_running && [[ ! -f "${pidfile}" ]] && [[ $retry -lt 120 ]]; do sleep 1; ((retry++)); done
+ if ! validate_seahub_running && [[ -f "${pidfile}" ]]; then
+ echo
+ echo "Seahub is started"
+ echo
+ else
+ printf "\033[33mError: Seahub failed to start.\033[m\n"
+ exit 1
+ fi
+}
+
+function prepare_env() {
+ check_python_executable
+ validate_ccnet_conf_dir
+ read_seafile_data_dir
+
+ 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}/seahub:${INSTALLPATH}/seahub/thirdpart:${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
+ pid=$(cat "${pidfile}")
+ echo "Stopping seahub ..."
+ kill ${pid}
+ rm -f ${pidfile}
+ retry=1
+ while ! validate_seahub_running && [ $retry -lt 60 ]; do sleep 1; ((retry++)); done
+ if ! validate_seahub_running; then
+ echo "Error: seahub cannot be stopped. Please try stopping it manually by running \"kill $(echo "$pid" | tr '\n' ' ')\"."
+ echo "To force killing the processes, use \"kill -9 $(echo "$pid" | tr '\n' ' ')\"."
+ fi
+ 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 start() {
+ if [ "$SEAHUB_FASTCGI" == "1" ]; then
+ start_seahub_fastcgi
+ else
+ start_seahub
+ fi
+}
+
+function stop() {
+ stop_seahub
+}
+
+function restart() {
+ stop
+ start
+}
+
+function clearsessions() {
+ clear_sessions
+}
diff --git a/net/seafile-server/patches/020-script-patches.patch b/net/seafile-server/patches/020-script-patches.patch
index 8bb7ae707..585784dd4 100644
--- a/net/seafile-server/patches/020-script-patches.patch
+++ b/net/seafile-server/patches/020-script-patches.patch
@@ -1,40 +1,77 @@
-diff -rupN seafile-3.1.7-server.orig/scripts/seaf-gc.sh seafile-3.1.7-server/scripts/seaf-gc.sh
---- seafile-3.1.7-server.orig/scripts/seaf-gc.sh 2014-10-16 05:30:04.000000000 +0200
-+++ seafile-3.1.7-server/scripts/seaf-gc.sh 2014-12-13 00:51:12.919136978 +0100
-@@ -6,11 +6,10 @@ SCRIPT=$(readlink -f "$0")
- INSTALLPATH=$(dirname "${SCRIPT}")
+diff -rupN seafile-server-5.1.1.orig/scripts/seaf-fsck.sh seafile-server-5.1.1/scripts/seaf-fsck.sh
+--- seafile-server-5.1.1.orig/scripts/seaf-fsck.sh 2016-04-21 11:05:26.000000000 +0200
++++ seafile-server-5.1.1/scripts/seaf-fsck.sh 2016-04-22 09:10:13.075581325 +0200
+@@ -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}
+diff -rupN seafile-server-5.1.1.orig/scripts/seaf-gc.sh seafile-server-5.1.1/scripts/seaf-gc.sh
+--- seafile-server-5.1.1.orig/scripts/seaf-gc.sh 2016-04-21 11:05:26.000000000 +0200
++++ seafile-server-5.1.1/scripts/seaf-gc.sh 2016-04-22 09:10:27.211581999 +0200
+@@ -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
--export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
-+export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH"
-
- script_name=$0
- function usage () {
-@@ -78,9 +77,7 @@ function run_seaf_gc () {
-
- echo "Starting seafserv-gc, please wait ..."
-
-- LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_gc} \
-- -c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}" \
-- ${seaf_gc_opts}
-+ ${seaf_gc} -c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}" ${seaf_gc_opts}
+ export PATH=${INSTALLPATH}/seafile/bin:$PATH
+diff -rupN seafile-server-5.1.1.orig/scripts/setup-seafile-mysql.sh seafile-server-5.1.1/scripts/setup-seafile-mysql.sh
+--- seafile-server-5.1.1.orig/scripts/setup-seafile-mysql.sh 2016-04-21 11:05:26.000000000 +0200
++++ seafile-server-5.1.1/scripts/setup-seafile-mysql.sh 2016-04-22 09:11:50.083585953 +0200
+@@ -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}"
- echo "seafserv-gc run done"
+- 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
-diff -rupN seafile-3.1.7-server.orig/scripts/setup-seafile-mysql.sh seafile-3.1.7-server/scripts/setup-seafile-mysql.sh
---- seafile-3.1.7-server.orig/scripts/setup-seafile-mysql.sh 2014-10-16 05:30:04.000000000 +0200
-+++ seafile-3.1.7-server/scripts/setup-seafile-mysql.sh 2014-12-13 00:51:49.242172631 +0100
-@@ -9,6 +9,8 @@ set -e
- SCRIPT=$(readlink -f "$0")
- INSTALLPATH=$(dirname "${SCRIPT}")
+ }
+@@ -85,5 +76,6 @@ function check_python () {
+ check_python;
+ export PYTHON=$PYTHON
+export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH"
-+
- cd "$INSTALLPATH"
- python_script=setup-seafile-mysql.py
+ exec $PYTHON "$python_script"
+diff -rupN seafile-server-5.1.1.orig/scripts/sqlite2mysql.sh seafile-server-5.1.1/scripts/sqlite2mysql.sh
+--- seafile-server-5.1.1.orig/scripts/sqlite2mysql.sh 2016-04-21 11:05:26.000000000 +0200
++++ seafile-server-5.1.1/scripts/sqlite2mysql.sh 2016-04-22 09:02:22.047558854 +0200
+@@ -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.
diff --git a/net/seafile-server/patches/030-pidfiles-in-same-directory.patch b/net/seafile-server/patches/030-pidfiles-in-same-directory.patch
index 4338f1790..bb3f86c08 100644
--- a/net/seafile-server/patches/030-pidfiles-in-same-directory.patch
+++ b/net/seafile-server/patches/030-pidfiles-in-same-directory.patch
@@ -1,6 +1,6 @@
-diff -rupN seafile-3.1.7-server.orig/controller/seafile-controller.c seafile-3.1.7-server/controller/seafile-controller.c
---- seafile-3.1.7-server.orig/controller/seafile-controller.c 2014-10-16 05:30:04.000000000 +0200
-+++ seafile-3.1.7-server/controller/seafile-controller.c 2014-11-28 16:50:24.053674057 +0100
+diff -rupN seafile-server-5.1.1.orig/controller/seafile-controller.c seafile-server-5.1.1/controller/seafile-controller.c
+--- seafile-server-5.1.1.orig/controller/seafile-controller.c 2016-04-19 15:44:32.000000000 +0200
++++ seafile-server-5.1.1/controller/seafile-controller.c 2016-04-19 16:23:05.785000218 +0200
@@ -21,7 +21,7 @@
SeafileController *ctl;
@@ -10,7 +10,7 @@ diff -rupN seafile-3.1.7-server.orig/controller/seafile-controller.c seafile-3.1
char *bin_dir = NULL;
char *installpath = NULL;
-@@ -614,9 +614,9 @@ stop_ccnet_server ()
+@@ -575,9 +575,9 @@ stop_ccnet_server ()
static void
init_pidfile_path (SeafileController *ctl)
{
diff --git a/net/seafile-server/patches/040-seafile-admin.patch b/net/seafile-server/patches/040-seafile-admin.patch
index 1948c738b..667cdadd1 100644
--- a/net/seafile-server/patches/040-seafile-admin.patch
+++ b/net/seafile-server/patches/040-seafile-admin.patch
@@ -1,62 +1,55 @@
-diff -rupN seafile-3.1.7-server.orig/tools/seafile-admin seafile-3.1.7-server/tools/seafile-admin
---- seafile-3.1.7-server.orig/tools/seafile-admin 2014-10-16 05:30:04.000000000 +0200
-+++ seafile-3.1.7-server/tools/seafile-admin 2014-12-22 21:52:25.929781054 +0100
-@@ -416,13 +416,13 @@ def create_gunicorn_conf():
- content = '''\
- import os
- daemon = True
--workers = 3
-+workers = 1
-+threads = 3
+diff -rupN seafile-server-5.1.1.orig/tools/seafile-admin seafile-server-5.1.1/tools/seafile-admin
+--- seafile-server-5.1.1.orig/tools/seafile-admin 2016-04-19 15:44:33.000000000 +0200
++++ seafile-server-5.1.1/tools/seafile-admin 2016-04-26 10:55:11.826798430 +0200
+@@ -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')
+ 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:
- with open(confpath, 'w') as fp:
-@@ -607,6 +607,7 @@ def start_seahub_gunicorn():
- 'gunicorn_django',
- '-c', conf[CONF_SEAHUB_CONF],
- '-b', '0.0.0.0:%s' % conf[CONF_SEAHUB_PORT],
-+ '-t', '120',
- ]
+@@ -526,6 +529,7 @@ def check_django_version():
- info('Starting seahub...')
-@@ -625,6 +626,7 @@ def start_seahub_fastcgi():
- 'pidfile=%(pidfile)s',
- 'outlog=%(outlog)s',
- 'errlog=%(errlog)s',
-+ 'method=threaded',
- ]
- cmdline = ' '.join(argv) % \
-@@ -693,7 +695,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')
+ 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')
-@@ -738,10 +740,9 @@ def setup_seafile(args):
+@@ -836,10 +840,13 @@ def setup_seafile(args):
print '-----------------------------------------------------------------'
print '-----------------------------------------------------------------'
print
- print 'To start/stop seafile server:'
-+ print 'To start, stop or restart seafile server, please run as root:'
++ 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 highlight(' # /etc/init.d/seafile { start | stop | restart }')
++ 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
-@@ -802,8 +803,7 @@ def start_seafile(args):
+@@ -903,8 +910,7 @@ def start_seafile(args):
def stop_seafile(dummy):
info('Stopping seafile server')
pkill('seafile-controller')
diff --git a/net/seafile-server/patches/050-libevhtp-search-path-fix.patch b/net/seafile-server/patches/050-libevhtp-search-path-fix.patch
deleted file mode 100644
index cb7e545d1..000000000
--- a/net/seafile-server/patches/050-libevhtp-search-path-fix.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff -rupN seafile-server-4.1.2.orig/server/Makefile.am seafile-server-4.1.2/server/Makefile.am
---- seafile-server-4.1.2.orig/server/Makefile.am 2015-05-02 11:04:11.000000000 +0200
-+++ seafile-server-4.1.2/server/Makefile.am 2015-06-14 01:28:55.924834806 +0200
-@@ -4,6 +4,7 @@ AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir)
- -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
- -DSEAFILE_SERVER \
- -DFULL_FEATURE \
-+ -I$(STAGING_DIR)/usr/include/libevhtp-1.1 \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/lib \
- -I$(top_builddir)/lib \
-@@ -122,4 +123,4 @@ seaf_server_LDADD = @CCNET_LIBS@ \
- @SEARPC_LIBS@ @JANSSON_LIBS@ @ZDB_LIBS@ @CURL_LIBS@ ${LIB_WS32} @ZLIB_LIBS@ \
- @LIBARCHIVE_LIBS@
-
--seaf_server_LDFLAGS = @STATIC_COMPILE@ @SERVER_PKG_RPATH@
-+seaf_server_LDFLAGS = @STATIC_COMPILE@ @SERVER_PKG_RPATH@ -L$(STAGING_DIR)/usr/lib/libevhtp-1.1
diff --git a/net/seafile-server/patches/050-libseafile-makefile-fixes.patch b/net/seafile-server/patches/050-libseafile-makefile-fixes.patch
new file mode 100644
index 000000000..7eb435460
--- /dev/null
+++ b/net/seafile-server/patches/050-libseafile-makefile-fixes.patch
@@ -0,0 +1,43 @@
+diff -rupN seafile-server-5.1.1.orig/lib/Makefile.am seafile-server-5.1.1/lib/Makefile.am
+--- seafile-server-5.1.1.orig/lib/Makefile.am 2016-04-21 11:05:26.000000000 +0200
++++ seafile-server-5.1.1/lib/Makefile.am 2016-04-22 10:09:41.567751561 +0200
+@@ -1,3 +1,5 @@
++include $(TOPDIR)/rules.mk
++
+ pcfiles = libseafile.pc
+ pkgconfig_DATA = $(pcfiles)
+ pkgconfigdir = $(libdir)/pkgconfig
+@@ -35,7 +37,7 @@ seafile-rpc-wrapper.c: seafile-object.h
+
+ seafile-object.h: ${seafile_object_define}
+ rm -f $@
+- valac --pkg posix ${seafile_object_define} -C -H seafile-object.h
++ "$(STAGING_DIR_HOST)/bin/valac" --pkg posix ${seafile_object_define} -C -H seafile-object.h
+
+ DISTCLEANFILES = ${searpc_gen}
+
+@@ -64,7 +66,7 @@ rpc_table.stamp: ${top_srcdir}/lib/rpc_t
+ @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 $@
+
+@@ -74,7 +76,7 @@ vala.stamp: ${seafile_object_define}
+ rm -f ${seafile_object_gen}
+ @rm -f vala.tmp
+ @touch vala.tmp
+- valac -C --pkg posix $^
++ "$(STAGING_DIR_HOST)/bin/valac" -C --pkg posix $^
+ @mv -f vala.tmp $@
+
+ ${seafile_object_gen}: vala.stamp
+@@ -90,5 +92,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
diff --git a/net/seafile-server/patches/060-libevent2-include-path.patch b/net/seafile-server/patches/060-libevent2-include-path.patch
deleted file mode 100644
index 958a13647..000000000
--- a/net/seafile-server/patches/060-libevent2-include-path.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-diff -rupN seafile-server-4.1.2.orig/lib/net.c seafile-server-4.1.2/lib/net.c
---- seafile-server-4.1.2.orig/lib/net.c 2015-09-09 19:31:56.000000000 +0200
-+++ seafile-server-4.1.2/lib/net.c 2015-09-14 20:20:30.906021296 +0200
-@@ -31,11 +31,7 @@
-
- #include <fcntl.h>
-
--#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
- #include <event2/util.h>
--#else
--#include <evutil.h>
--#endif
-
- #include "net.h"
-
-diff -rupN seafile-server-4.1.2.orig/lib/net.h seafile-server-4.1.2/lib/net.h
---- seafile-server-4.1.2.orig/lib/net.h 2015-09-09 19:31:56.000000000 +0200
-+++ seafile-server-4.1.2/lib/net.h 2015-09-14 20:20:30.906021296 +0200
-@@ -19,11 +19,7 @@
- #include <netinet/tcp.h>
- #endif
-
--#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
- #include <event2/util.h>
--#else
--#include <evutil.h>
--#endif
-
- #ifdef WIN32
- #define ECONNREFUSED WSAECONNREFUSED
-diff -rupN seafile-server-4.1.2.orig/lib/utils.h seafile-server-4.1.2/lib/utils.h
---- seafile-server-4.1.2.orig/lib/utils.h 2015-09-09 19:31:56.000000000 +0200
-+++ seafile-server-4.1.2/lib/utils.h 2015-09-14 20:20:30.907021326 +0200
-@@ -13,11 +13,7 @@
- #include <stdlib.h>
- #include <sys/stat.h>
-
--#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
- #include <event2/util.h>
--#else
--#include <evutil.h>
--#endif
-
- #ifdef __linux__
- #include <endian.h>
-diff -rupN seafile-server-4.1.2.orig/server/access-file.c seafile-server-4.1.2/server/access-file.c
---- seafile-server-4.1.2.orig/server/access-file.c 2015-09-09 19:31:56.000000000 +0200
-+++ seafile-server-4.1.2/server/access-file.c 2015-09-14 20:20:30.907021326 +0200
-@@ -3,13 +3,9 @@
- #define DEBUG_FLAG SEAFILE_DEBUG_HTTP
- #include "log.h"
-
--#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
- #include <event2/event.h>
- #include <event2/bufferevent.h>
- #include <event2/bufferevent_struct.h>
--#else
--#include <event.h>
--#endif
-
- #include <evhtp.h>
-
-diff -rupN seafile-server-4.1.2.orig/server/http-server.c seafile-server-4.1.2/server/http-server.c
---- seafile-server-4.1.2.orig/server/http-server.c 2015-09-09 19:31:56.000000000 +0200
-+++ seafile-server-4.1.2/server/http-server.c 2015-09-14 20:20:30.908021355 +0200
-@@ -6,11 +6,7 @@
- #include <locale.h>
- #include <sys/types.h>
-
--#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
- #include <event2/event.h>
--#else
--#include <event.h>
--#endif
-
- #include <evhtp.h>
-
-diff -rupN seafile-server-4.1.2.orig/server/listen-mgr.c seafile-server-4.1.2/server/listen-mgr.c
---- seafile-server-4.1.2.orig/server/listen-mgr.c 2015-09-09 19:31:56.000000000 +0200
-+++ seafile-server-4.1.2/server/listen-mgr.c 2015-09-14 20:23:15.614452334 +0200
-@@ -3,11 +3,9 @@
- #include <event2/event.h>
- #include <event2/listener.h>
-
--#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
- #include <event2/bufferevent.h>
- #include <event2/buffer_compat.h>
- #include <event2/bufferevent_struct.h>
--#endif
-
-
- #include "seafile-session.h"
-diff -rupN seafile-server-4.1.2.orig/server/upload-file.c seafile-server-4.1.2/server/upload-file.c
---- seafile-server-4.1.2.orig/server/upload-file.c 2015-09-09 19:31:56.000000000 +0200
-+++ seafile-server-4.1.2/server/upload-file.c 2015-09-14 20:20:30.909021385 +0200
-@@ -6,11 +6,7 @@
- #include <getopt.h>
- #include <fcntl.h>
-
--#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
- #include <event2/event.h>
--#else
--#include <event.h>
--#endif
-
- #include <evhtp.h>
-
diff --git a/net/seafile-server/patches/060-timestamps-as-int64.patch b/net/seafile-server/patches/060-timestamps-as-int64.patch
new file mode 100644
index 000000000..5e655d839
--- /dev/null
+++ b/net/seafile-server/patches/060-timestamps-as-int64.patch
@@ -0,0 +1,39 @@
+diff -rupN seafile-server-5.1.1.orig/lib/repo.vala seafile-server-5.1.1/lib/repo.vala
+--- seafile-server-5.1.1.orig/lib/repo.vala 2016-04-19 15:44:32.000000000 +0200
++++ seafile-server-5.1.1/lib/repo.vala 2016-04-25 21:29:33.327962235 +0200
+@@ -30,7 +30,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 head_cmmt_id { get; set; }
+@@ -40,7 +40,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
+@@ -63,7 +63,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; }
+
+@@ -155,7 +155,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; }
+ }