seafile: import seafile-server package and its dependencies
authorGergely Kiss <mail.gery@gmail.com>
Mon, 15 Dec 2014 00:26:06 +0000 (01:26 +0100)
committerSteven Barth <steven@midlink.org>
Tue, 16 Dec 2014 07:54:39 +0000 (08:54 +0100)
Signed-off-by: Gergely Kiss <mail.gery@gmail.com>
Tested-by: Gergely Kiss <mail.gery@gmail.com>
libs/libsearpc/Makefile [new file with mode: 0644]
net/seafile-ccnet/Makefile [new file with mode: 0644]
net/seafile-seahub/Makefile [new file with mode: 0644]
net/seafile-seahub/patches/010-default-config.patch [new file with mode: 0644]
net/seafile-server/Makefile [new file with mode: 0644]
net/seafile-server/files/seafile.init [new file with mode: 0755]
net/seafile-server/patches/010-makefile-fix.patch [new file with mode: 0644]
net/seafile-server/patches/020-script-patches.patch [new file with mode: 0644]
net/seafile-server/patches/030-pidfiles-in-same-directory.patch [new file with mode: 0644]
net/seafile-server/patches/040-seafile-admin.patch [new file with mode: 0644]

diff --git a/libs/libsearpc/Makefile b/libs/libsearpc/Makefile
new file mode 100644 (file)
index 0000000..1fc124d
--- /dev/null
@@ -0,0 +1,84 @@
+#
+# 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:=libsearpc
+PKG_VERSION:=3.0-latest
+PKG_RELEASE:=1
+PKG_LICENSE:=GPL-3.0
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=v$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/haiwen/libsearpc/archive/
+PKG_MD5SUM:=32a6eaafe16d8c0c0e320b4a08a4d8f6
+PKG_CAT:=zcat
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/libsearpc
+    SECTION:=libs
+    CATEGORY:=Libraries
+    TITLE:=Seafile RPC Library
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
+    URL:=http://seafile.com/
+    DEPENDS:=+glib2 +jansson +python $(ICONV_DEPENDS)
+endef
+
+define Package/libsearpc/description
+    Searpc is a simple C language RPC framework based on GObject system.
+    Searpc handles the serialization/deserialization part of RPC,
+    the transport part is left to users.
+endef
+
+CONFIGURE_ARGS += --enable-compile-demo=no \
+                   --disable-server-pkg
+
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv
+
+include $(INCLUDE_DIR)/host-build.mk
+
+define Host/Configure
+endef
+
+define Host/Compile
+endef
+
+define Host/Install
+       $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
+       $(INSTALL_BIN) $(HOST_BUILD_DIR)/lib/searpc-codegen.py $(STAGING_DIR_HOST)/bin/
+endef
+
+$(eval $(call HostBuild))
+
+Hooks/Prepare/Post += delete_source_package
+
+define delete_source_package
+       # deleting source package as its filename is ambiguous
+       rm -f $(DL_DIR)/$(PKG_SOURCE)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{bin,include}
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsearpc.so* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/searpc* $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libsearpc.pc $(1)/usr/lib/pkgconfig/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/searpc-codegen.py $(1)/usr/bin/
+endef
+
+define Package/libsearpc/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsearpc.so* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/pysearpc $(1)/usr/lib/python2.7/site-packages/
+endef
+
+$(eval $(call BuildPackage,libsearpc))
diff --git a/net/seafile-ccnet/Makefile b/net/seafile-ccnet/Makefile
new file mode 100644 (file)
index 0000000..bad2d50
--- /dev/null
@@ -0,0 +1,81 @@
+#
+# 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-ccnet
+PKG_VERSION:=3.1.7
+PKG_RELEASE:=1
+PKG_LICENSE:=GPL-3.0
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/ccnet-$(PKG_VERSION)-server
+PKG_SOURCE:=v$(PKG_VERSION)-server.tar.gz
+PKG_SOURCE_URL:=https://github.com/haiwen/ccnet/archive/
+PKG_MD5SUM:=ed6d58bcce31d33847f536d129cfb404
+PKG_CAT:=zcat
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/seafile-ccnet
+    SECTION:=net
+    CATEGORY:=Network
+    TITLE:=Seafile server - ccnet component
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
+    URL:=http://seafile.com/
+    DEPENDS:=+libsearpc +libevent2 +libopenssl \
+               +glib2 +python +libzdb +libuuid \
+               +libpthread +libsqlite3 +jansson $(ICONV_DEPENDS)
+endef
+
+define Package/seafile-ccnet/description
+   Ccnet is a framework for writing networked applications in C.
+endef
+
+CONFIGURE_ARGS += --disable-client \
+                   --enable-server \
+                   --disable-ldap \
+                   --disable-cluster \
+                   --enable-python \
+                   --disable-server-pkg \
+                   --disable-static-build \
+                   --disable-compile-demo \
+                   --disable-console
+
+PKG_BUILD_DEPENDS:=vala/host \
+                  libsearpc/host
+
+Hooks/Prepare/Post += delete_source_package
+
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
+                   -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
+
+define delete_source_package
+       # deleting downloaded source package as its filename is ambiguous
+       rm -f $(DL_DIR)/$(PKG_SOURCE)
+endef
+
+define Package/seafile-ccnet/install
+       $(INSTALL_DIR) $(1)/usr/{bin,lib}
+       $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/ccnet* $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/ccnet $(1)/usr/lib/python2.7/site-packages/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/ccnet* $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libccnet.pc $(1)/usr/lib/pkgconfig/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.a $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,seafile-ccnet))
diff --git a/net/seafile-seahub/Makefile b/net/seafile-seahub/Makefile
new file mode 100644 (file)
index 0000000..6a0b8d9
--- /dev/null
@@ -0,0 +1,82 @@
+#
+# 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-seahub
+PKG_VERSION:=3.1.7
+PKG_RELEASE:=1
+PKG_LICENSE:=Apache-2.0
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/seahub-$(PKG_VERSION)-server
+PKG_SOURCE:=v$(PKG_VERSION)-server.tar.gz
+PKG_SOURCE_URL:=https://github.com/haiwen/seahub/archive/
+PKG_MD5SUM:=d019b7171ed23817025cba55554b90d9
+PKG_CAT:=zcat
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/seafile-seahub
+    SECTION:=net
+    CATEGORY:=Network
+    TITLE:=Seafile server - seahub component
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
+    URL:=http://seafile.com/
+    DEPENDS:=+python +simplejson +python-imglib +python-setuptools
+endef
+
+define Package/seafile-seahub/description
+   The web end of seafile server.
+
+   NOTE: in order to have better performance, language support is turned off by default.
+   Please set 'USE_I18N = True' in seahub_settings.py to support multiple languages.
+endef
+
+PKG_BUILD_DEPENDS:=python-setuptools
+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 Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/seafile-seahub/install
+       $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/seahub
+       $(CP) $(PKG_BUILD_DIR)/{locale,media,seahub,sql,subdomain,tests,thirdpart,tools} $(1)/usr/share/seafile/seafile-server/seahub/
+       $(CP) $(PKG_BUILD_DIR)/*.{sh,template,py,txt} $(1)/usr/share/seafile/seafile-server/seahub/
+       $(CP) $(PKG_BUILD_DIR)/{CONTRIBUTORS,HACKING,README.markdown} $(1)/usr/share/seafile/seafile-server/seahub/
+       $(CP) $(PKG_BUILD_DIR)/pylintrc* $(1)/usr/share/seafile/seafile-server/seahub/
+       # Installing python dependencies
+       export PYTHONPATH="$(1)/usr/share/seafile/seafile-server/seahub/thirdpart:$(STAGING_DIR)/$(PYTHON_PKG_DIR)"; \
+       export PYTHONOPTIMIZE=""; \
+       export PYTHONDONTWRITEBYTECODE=1; \
+           easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://www.djangoproject.com/m/releases/1.5/Django-1.5.8.tar.gz; \
+           easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z -N https://github.com/djblets/djblets/archive/release-0.6.14.tar.gz; \
+           easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/g/gunicorn/gunicorn-0.16.1.tar.gz; \
+           easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/s/six/six-1.4.1.tar.gz; \
+           easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/c/chardet/chardet-2.1.1.tar.gz; \
+           easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/2.6/f/flup/flup-1.0.2-py2.6.egg; \
+           easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/l/lockfile/lockfile-0.9.1.tar.gz; \
+           easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/p/python-daemon/python-daemon-1.5.5.tar.gz; \
+           easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-1.5.tar.gz
+           # fix python exec path in scripts
+           sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/env python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/chardetect.py
+           sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/env python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/django-admin.py
+           sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/env python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/gunicorn
+           sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/env python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/gunicorn_django
+           sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/env python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/gunicorn_paster
+       find $(PKG_BUILD_DIR) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f
+       sed -i "s/\(SEAFILE_VERSION\s*=\s*\)'\([0-9]\.[0-9]\.[0-9]\)'/\1'$(PKG_VERSION)'/g" $(1)/usr/share/seafile/seafile-server/seahub/seahub/settings.py
+endef
+
+$(eval $(call BuildPackage,seafile-seahub))
diff --git a/net/seafile-seahub/patches/010-default-config.patch b/net/seafile-seahub/patches/010-default-config.patch
new file mode 100644 (file)
index 0000000..4168dc1
--- /dev/null
@@ -0,0 +1,30 @@
+diff -rupN seahub-3.1.7-server.orig/seahub/settings.py seahub-3.1.7-server/seahub/settings.py
+--- seahub-3.1.7-server.orig/seahub/settings.py        2014-10-20 09:32:35.000000000 +0200
++++ seahub-3.1.7-server/seahub/settings.py     2014-12-10 15:47:21.625104606 +0100
+@@ -46,7 +46,7 @@ SITE_ID = 1
+ # If you set this to False, Django will make some optimizations so as not
+ # to load the internationalization machinery.
+-USE_I18N = True
++USE_I18N = False
+ # If you set this to False, Django will not format dates, numbers and
+ # calendars according to the current locale.
+@@ -209,7 +209,7 @@ SHOW_REPO_DOWNLOAD_BUTTON = False
+ REPO_PASSWORD_MIN_LENGTH = 8
+ # mininum length for user's password
+-USER_PASSWORD_MIN_LENGTH = 6
++USER_PASSWORD_MIN_LENGTH = 8
+ # LEVEL based on four types of input:
+ # num, upper letter, lower letter, other symbols
+@@ -218,7 +218,7 @@ USER_PASSWORD_STRENGTH_LEVEL = 3
+ # default False, only check USER_PASSWORD_MIN_LENGTH
+ # when True, check password strength level, STRONG(or above) is allowed
+-USER_STRONG_PASSWORD_REQUIRED = False
++USER_STRONG_PASSWORD_REQUIRED = True
+ # Using server side crypto by default, otherwise, let user choose crypto method.
+ FORCE_SERVER_CRYPTO = True
diff --git a/net/seafile-server/Makefile b/net/seafile-server/Makefile
new file mode 100644 (file)
index 0000000..2ec6de7
--- /dev/null
@@ -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 (executable)
index 0000000..eed4f79
--- /dev/null
@@ -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 (file)
index 0000000..1ae971e
--- /dev/null
@@ -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 (file)
index 0000000..8bb7ae7
--- /dev/null
@@ -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 (file)
index 0000000..4338f17
--- /dev/null
@@ -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 (file)
index 0000000..7225cff
--- /dev/null
@@ -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 ')