diff options
author | Gergely Kiss <mail.gery@gmail.com> | 2014-12-15 01:26:06 +0100 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2014-12-16 08:54:39 +0100 |
commit | 8e781d1a485d6f1f9870831eed440dccf711a75c (patch) | |
tree | 17b7f3a76d8c24a34493d435533db53502dcae0d /net/seafile-server | |
parent | 42b3bce850e4929bf6ec09d82fc15f3c712d8479 (diff) |
seafile: import seafile-server package and its dependencies
Signed-off-by: Gergely Kiss <mail.gery@gmail.com>
Tested-by: Gergely Kiss <mail.gery@gmail.com>
Diffstat (limited to 'net/seafile-server')
-rw-r--r-- | net/seafile-server/Makefile | 123 | ||||
-rwxr-xr-x | net/seafile-server/files/seafile.init | 46 | ||||
-rw-r--r-- | net/seafile-server/patches/010-makefile-fix.patch | 12 | ||||
-rw-r--r-- | net/seafile-server/patches/020-script-patches.patch | 40 | ||||
-rw-r--r-- | net/seafile-server/patches/030-pidfiles-in-same-directory.patch | 24 | ||||
-rw-r--r-- | net/seafile-server/patches/040-seafile-admin.patch | 53 |
6 files changed, 298 insertions, 0 deletions
diff --git a/net/seafile-server/Makefile b/net/seafile-server/Makefile new file mode 100644 index 000000000..2ec6de777 --- /dev/null +++ b/net/seafile-server/Makefile @@ -0,0 +1,123 @@ +# +# Copyright (C) 2007-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=seafile-server +PKG_VERSION:=3.1.7 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-3.0 + +PKG_BUILD_DIR:=$(BUILD_DIR)/seafile-$(PKG_VERSION)-server +PKG_SOURCE:=v$(PKG_VERSION)-server.tar.gz +PKG_SOURCE_URL:=https://github.com/haiwen/seafile/archive/ +PKG_MD5SUM:=af35324998b6c98fe1442d5d775871ee +PKG_CAT:=zcat +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/seafile-server + SECTION:=net + CATEGORY:=Network + TITLE:=Seafile server + MAINTAINER:=Gergely Kiss <mail.gery@gmail.com> + URL:=http://seafile.com/ + DEPENDS:=+shadow-useradd +libarchive +libopenssl +glib2 +seafile-ccnet +libsearpc +sqlite3-cli +python-mysql \ + +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 +libmysqlclient +libevhtp \ + +libpthread +libuuid +seafile-seahub +bash +sudo +procps +procps-pkill $(ICONV_DEPENDS) +endef + +define Package/seafile-server/description + Open source cloud storage with advanced features on privacy protection and teamwork. +endef + +CONFIGURE_ARGS += --disable-riak \ + --disable-client \ + --disable-fuse \ + --enable-server \ + --enable-python \ + --disable-static-build \ + --disable-server-pkg \ + --disable-console + +PKG_BUILD_DEPENDS:=vala/host \ + libsearpc/host + +TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \ + -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz + +Hooks/Prepare/Post += delete_source_package + +define delete_source_package + # deleting downloaded source package as its filename is ambiguous + rm -f $(DL_DIR)/$(PKG_SOURCE) +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 + $(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)/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/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/upgrade/ $(1)/usr/share/seafile/seafile-server/ + $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(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/ +endef + +define Package/seafile-server/postinst +#!/bin/sh + +if ! id -u seafile >/dev/null 2>&1; then + useradd seafile -d "/usr/share/seafile" -s /bin/sh; fi + +chown -R seafile:seafile /usr/share/seafile/ +chmod -R o-rwx /usr/share/seafile/ + +if [ ! -d "/usr/share/seafile/seafile-data" ] +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." +fi + +/etc/init.d/seafile enable +/etc/init.d/seafile restart +endef + +define Package/seafile-server/prerm +#!/bin/sh +/etc/init.d/seafile stop +endef + +$(eval $(call BuildPackage,seafile-server)) diff --git a/net/seafile-server/files/seafile.init b/net/seafile-server/files/seafile.init new file mode 100755 index 000000000..eed4f7942 --- /dev/null +++ b/net/seafile-server/files/seafile.init @@ -0,0 +1,46 @@ +#!/bin/sh /etc/rc.common + +START=99 +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" + +export PATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PATH" +export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH" + +start() { + if [ ! -d /var/run/seafile ] + then + mkdir /var/run/seafile + chown seafile:seafile /var/run/seafile + chmod o-rwx /var/run/seafile + fi + + cd "/usr/share/seafile" && \ + sudo PYTHONPATH="$PYTHONPATH" -u seafile -E \ + "/usr/bin/seafile-admin" start +} + +stop() { + cd "/usr/share/seafile" && \ + sudo PYTHONPATH="$PYTHONPATH" -u seafile -E \ + "/usr/bin/seafile-admin" stop +} + +setup() { + cd "/usr/share/seafile" && \ + sudo PYTHONPATH="$PYTHONPATH" -u seafile -E \ + "/usr/bin/seafile-admin" setup +} + +create_admin() { + cd "/usr/share/seafile" && \ + sudo PYTHONPATH="$PYTHONPATH" -u seafile -E \ + "/usr/bin/seafile-admin" create-admin +} + +reset_admin() { + create_admin +} diff --git a/net/seafile-server/patches/010-makefile-fix.patch b/net/seafile-server/patches/010-makefile-fix.patch new file mode 100644 index 000000000..1ae971e37 --- /dev/null +++ b/net/seafile-server/patches/010-makefile-fix.patch @@ -0,0 +1,12 @@ +diff -rupN seafile-3.1.7-server.orig/fileserver/Makefile.am seafile-3.1.7-server/fileserver/Makefile.am +--- seafile-3.1.7-server.orig/fileserver/Makefile.am 2014-10-16 05:30:04.000000000 +0200 ++++ seafile-3.1.7-server/fileserver/Makefile.am 2014-12-08 00:16:44.289364980 +0100 +@@ -6,7 +6,7 @@ AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir) + -I$(top_srcdir)/lib \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/common \ +- -I$(includedir) \ ++ -I$(STAGING_DIR)$(includedir) \ + @CCNET_CFLAGS@ \ + @SEARPC_CFLAGS@ \ + @GLIB2_CFLAGS@ \ diff --git a/net/seafile-server/patches/020-script-patches.patch b/net/seafile-server/patches/020-script-patches.patch new file mode 100644 index 000000000..8bb7ae707 --- /dev/null +++ b/net/seafile-server/patches/020-script-patches.patch @@ -0,0 +1,40 @@ +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}") + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet +-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} + + echo "seafserv-gc run done" + 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}") + ++export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH" ++ + cd "$INSTALLPATH" + + python_script=setup-seafile-mysql.py diff --git a/net/seafile-server/patches/030-pidfiles-in-same-directory.patch b/net/seafile-server/patches/030-pidfiles-in-same-directory.patch new file mode 100644 index 000000000..4338f1790 --- /dev/null +++ b/net/seafile-server/patches/030-pidfiles-in-same-directory.patch @@ -0,0 +1,24 @@ +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 +@@ -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; +@@ -614,9 +614,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); + } diff --git a/net/seafile-server/patches/040-seafile-admin.patch b/net/seafile-server/patches/040-seafile-admin.patch new file mode 100644 index 000000000..7225cff44 --- /dev/null +++ b/net/seafile-server/patches/040-seafile-admin.patch @@ -0,0 +1,53 @@ +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-12 12:09:00.703175935 +0100 +@@ -416,13 +416,15 @@ def create_gunicorn_conf(): + content = '''\ + import os + daemon = True +-workers = 3 ++workers = 1 ++threads = 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') ++# uncomment if you need access logging (works only in fastcgi mode) ++#accesslog = os.path.join(runtime_dir, 'access.log') + ''' + try: + with open(confpath, 'w') as fp: +@@ -607,6 +609,7 @@ def start_seahub_gunicorn(): + 'gunicorn_django', + '-c', conf[CONF_SEAHUB_CONF], + '-b', '0.0.0.0:%s' % conf[CONF_SEAHUB_PORT], ++ '-t', '120', + ] + + info('Starting seahub...') +@@ -738,10 +741,9 @@ 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 +- print highlight(' $ cd %s' % cwd) +- print highlight(' $ %s { start | stop }' % SCRIPT_NAME) ++ print highlight(' # /etc/init.d/seafile { start | stop | restart }') + print + print 'If you have any problem, refer to\n' + print +@@ -802,8 +804,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 ') |