diff --git a/lang/python/django-appconf/Makefile b/lang/python/django-appconf/Makefile index 1a86fa63d..34ce696e9 100644 --- a/lang/python/django-appconf/Makefile +++ b/lang/python/django-appconf/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=django-appconf -PKG_VERSION:=1.0.2 -PKG_RELEASE:=6 +PKG_VERSION:=1.0.3 +PKG_RELEASE:=1 PYPI_NAME:=$(PKG_NAME) -PKG_HASH:=6a4d9aea683b4c224d97ab8ee11ad2d29a37072c0c6c509896dd9857466fb261 +PKG_HASH:=35f13ca4d567f132b960e2cd4c832c2d03cb6543452d34e29b7ba10371ba80e3 PKG_MAINTAINER:=Alexandru Ardelean PKG_LICENSE:=BSD-3-Clause @@ -35,7 +35,8 @@ define Package/python-django-appconf $(call Package/django-appconf/Default) DEPENDS:= \ +PACKAGE_python-django-appconf:python \ - python-django1 + python-django1 \ + +PACKAGE_python-django-appconf:python-six VARIANT:=python MDEPENDS:=python-django1 endef @@ -48,7 +49,8 @@ define Package/python3-django-appconf $(call Package/django-appconf/Default) DEPENDS:= \ +PACKAGE_python3-django-appconf:python3 \ - +PACKAGE_python3-django-appconf:python3-django1 + +PACKAGE_python3-django-appconf:python3-django1 \ + +PACKAGE_python3-django-appconf:python3-six VARIANT:=python3 endef diff --git a/lang/python/django-jsonfield/Makefile b/lang/python/django-jsonfield/Makefile index 305ab6f68..2ed18e8a5 100644 --- a/lang/python/django-jsonfield/Makefile +++ b/lang/python/django-jsonfield/Makefile @@ -8,14 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=django-jsonfield -PKG_VERSION:=1.0.1 -PKG_RELEASE:=6 +PKG_VERSION:=2.1.1 +PKG_RELEASE:=1 -PYPI_NAME:=$(PKG_NAME) -PKG_HASH:=6c0afd5554739365b55d86e285cf966cc3a45682fff963463364ea1f6511ca3e +PYPI_NAME:=jsonfield +PKG_HASH:=ed7c5e1829e9453e24a8bebef1e702ffe402e6def6b326f0e0b88764c59a6dc7 PKG_MAINTAINER:=Alexandru Ardelean -PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE:=MIT PKG_LICENSE_FILES:=LICENSE include ../pypi.mk @@ -27,28 +27,31 @@ define Package/django-jsonfield/Default SUBMENU:=Python SECTION:=lang CATEGORY:=Languages - TITLE:=JSONField for django models - URL:=https://github.com/adamchainz/django-jsonfield + TITLE:=A reusable Django field to store validated JSON in models + URL:=https://github.com/rpkilby/jsonfield endef define Package/python-django-jsonfield $(call Package/django-jsonfield/Default) DEPENDS:= \ +PACKAGE_python-django-jsonfield:python \ - python-django1 + python-django1 \ + +PACKAGE_python-django-jsonfield:python-six VARIANT:=python MDEPENDS:=python-django1 endef define Package/python-django-jsonfield/description - JSONField for django models + jsonfield is a reusable model field that allows you to store validated + JSON, automatically handling serialization to and from the database. endef define Package/python3-django-jsonfield $(call Package/django-jsonfield/Default) DEPENDS:= \ +PACKAGE_python3-django-jsonfield:python3 \ - +PACKAGE_python3-django-jsonfield:python3-django1 + +PACKAGE_python3-django-jsonfield:python3-django1 \ + +PACKAGE_python3-django-jsonfield:python3-six VARIANT:=python3 endef diff --git a/lang/python/django-picklefield/Makefile b/lang/python/django-picklefield/Makefile index 6e4d6805f..c240b3f49 100644 --- a/lang/python/django-picklefield/Makefile +++ b/lang/python/django-picklefield/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=django-picklefield -PKG_VERSION:=1.1.0 -PKG_RELEASE:=5 +PKG_VERSION:=2.1.1 +PKG_RELEASE:=1 PYPI_NAME:=$(PKG_NAME) -PKG_HASH:=ce7fee5c6558fe5dc8924993d994ccde75bb75b91cd82787cbd4c92b95a69f9c +PKG_HASH:=67a5e156343e3b032cac2f65565f0faa81635a99c7da74b0f07a0f5db467b646 PKG_MAINTAINER:=Alexandru Ardelean PKG_LICENSE:=MIT @@ -23,6 +23,11 @@ include $(INCLUDE_DIR)/package.mk include ../python-package.mk include ../python3-package.mk +PYTHON_PKG_SETUP_VARS:= \ + PKG_VERSION="$(PKG_VERSION)" +PYTHON3_PKG_SETUP_VARS:= \ + PKG_VERSION="$(PKG_VERSION)" + define Package/django-picklefield/Default SUBMENU:=Python SECTION:=lang diff --git a/lang/python/django-picklefield/patches/001-no-import-self-during-setup.patch b/lang/python/django-picklefield/patches/001-no-import-self-during-setup.patch new file mode 100644 index 000000000..473a4439d --- /dev/null +++ b/lang/python/django-picklefield/patches/001-no-import-self-during-setup.patch @@ -0,0 +1,19 @@ +--- a/setup.py ++++ b/setup.py +@@ -2,14 +2,14 @@ from __future__ import unicode_literals + + from setuptools import find_packages, setup + +-import picklefield ++import os + + with open('README.rst') as file_: + long_description = file_.read() + + setup( + name='django-picklefield', +- version=picklefield.__version__, ++ version=os.getenv('PKG_VERSION'), + description='Pickled object field for Django', + long_description=long_description, + author='Simon Charette', diff --git a/lang/python/django-postoffice/Makefile b/lang/python/django-postoffice/Makefile index 7cfa82ce4..20af16ee7 100644 --- a/lang/python/django-postoffice/Makefile +++ b/lang/python/django-postoffice/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=django-postoffice -PKG_VERSION:=3.1.0 -PKG_RELEASE:=6 +PKG_VERSION:=3.2.1 +PKG_RELEASE:=1 PYPI_NAME:=django-post-office PYPI_SOURCE_NAME:=django-post_office -PKG_HASH:=827937a944fe47cea393853069cd9315d080298c8ddb0faf787955d6aa51a030 +PKG_HASH:=e32427822f647719575094f790ca949ef9f9827ec0e8378cb021f01f3834b2a4 PKG_MAINTAINER:=Alexandru Ardelean PKG_LICENSE:=MIT diff --git a/lang/python/django-ranged-response/Makefile b/lang/python/django-ranged-response/Makefile index 62f91a317..896073f62 100644 --- a/lang/python/django-ranged-response/Makefile +++ b/lang/python/django-ranged-response/Makefile @@ -26,7 +26,7 @@ define Package/django-ranged-response/Default SECTION:=lang CATEGORY:=Languages TITLE:=Add Content-Range: to FileResponse - URL:=https://github.com/wearespindle/django-ranged-fileresponse + URL:=https://github.com/i3thuan5/django-ranged-response endef define Package/python-django-ranged-response diff --git a/lang/python/django-statici18n/Makefile b/lang/python/django-statici18n/Makefile index ea58e6f84..2e86437f7 100644 --- a/lang/python/django-statici18n/Makefile +++ b/lang/python/django-statici18n/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=django-statici18n -PKG_VERSION:=1.8.2 -PKG_RELEASE:=6 +PKG_VERSION:=1.9.0 +PKG_RELEASE:=1 PYPI_NAME:=$(PKG_NAME) -PKG_HASH:=ba9eeb3c4517027922645999359f8335fbb9fea04c457123cfbd6b4a36cbeda4 +PKG_HASH:=913dd056c1abcbe129b1db806cb4cfb821c4077d7e857d6eb29043ea64f4d1d0 PKG_MAINTAINER:=Alexandru Ardelean PKG_LICENSE:=BSD-3-Clause @@ -35,7 +35,9 @@ define Package/python-django-statici18n $(call Package/django-statici18n/Default) DEPENDS:= \ +PACKAGE_python-django-statici18n:python \ - python-django1 + python-django1 \ + +PACKAGE_python-django-statici18n:python-django-appconf \ + +PACKAGE_python-django-statici18n:python-six VARIANT:=python MDEPENDS:=python-django1 endef @@ -48,7 +50,9 @@ define Package/python3-django-statici18n $(call Package/django-statici18n/Default) DEPENDS:= \ +PACKAGE_python3-django-statici18n:python3 \ - +PACKAGE_python3-django-statici18n:python3-django1 + +PACKAGE_python3-django-statici18n:python3-django1 \ + +PACKAGE_python3-django-statici18n:python3-django-appconf \ + +PACKAGE_python3-django-statici18n:python3-six VARIANT:=python3 endef diff --git a/lang/python/django1/Makefile b/lang/python/django1/Makefile index c7d3bbcf6..db260a208 100644 --- a/lang/python/django1/Makefile +++ b/lang/python/django1/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=django1 PKG_VERSION:=1.11.29 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PYPI_NAME:=Django PKG_HASH:=4200aefb6678019a0acf0005cd14cfce3a5e6b9b90d06145fcdd2e474ad4329c diff --git a/lang/python/django1/patches/001-load-byte-compiled-db-migrations.patch b/lang/python/django1/patches/001-load-byte-compiled-db-migrations.patch new file mode 100644 index 000000000..e347e5534 --- /dev/null +++ b/lang/python/django1/patches/001-load-byte-compiled-db-migrations.patch @@ -0,0 +1,11 @@ +--- a/django/db/migrations/loader.py ++++ b/django/db/migrations/loader.py +@@ -106,7 +106,7 @@ class MigrationLoader(object): + # Scan for .py files + migration_names = set() + for name in os.listdir(directory): +- if name.endswith(".py"): ++ if name.endswith(".py") or name.endswith(".pyc"): + import_name = name.rsplit(".", 1)[0] + if import_name[0] not in "_.~": + migration_names.add(import_name) diff --git a/libs/libsearpc/Makefile b/libs/libsearpc/Makefile index c52ca8222..313460342 100644 --- a/libs/libsearpc/Makefile +++ b/libs/libsearpc/Makefile @@ -8,15 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libsearpc -PKG_VERSION:=3.1.0 -PKG_RELEASE=2 +PKG_VERSION:=3.2.0 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/haiwen/libsearpc/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=cbd86d3c37b54ca2060ca537a07940fe3e98498abf345b2f3e1cec488230231a -PKG_MAINTAINER:=Alexandru Ardelean +PKG_HASH:=c479d85e405674c3450eac040abe143af5a9fafe7f1b74926e2a05280ab5420e -PKG_LICENSE:=GPL-3.0 +PKG_MAINTAINER:=Alexandru Ardelean , Jeffery To +PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE.txt PKG_FIXUP:=autoreconf @@ -26,41 +26,70 @@ PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk include ../../lang/python/python-package.mk +include ../../lang/python/python3-package.mk define Package/libsearpc - SECTION:=libs - CATEGORY:=Libraries - TITLE:=Seafile RPC Library - URL:=https://seafile.com - DEPENDS:=+glib2 +jansson +python $(ICONV_DEPENDS) + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Seafile RPC Library + URL:=https://seafile.com + DEPENDS:=+glib2 +jansson $(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. + 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 +define Package/python3-searpc + SECTION:=lang + CATEGORY:=Languages + SUBMENU:=Python + TITLE:=Python bindings for Searpc + DEPENDS:=+libsearpc +python3-light +python3-logging + VARIANT:=python3 +endef + +define Package/python3-searpc/description +$(call Package/libsearpc/description) + + This package contains the Python bindings for Searpc. +endef -TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv +CONFIGURE_ARGS += \ + --disable-compile-demo \ + --disable-server-pkg 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/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libsearpc.pc $(1)/usr/lib/pkgconfig/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/searpc-codegen.py $(1)/usr/bin/ endef +# Include Python 2 bindings in this package to maintain compatibility with previous versions define Package/libsearpc/install $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/pysearpc $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsearpc.so* $(1)/usr/lib/ - $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/pysearpc $(1)$(PYTHON_PKG_DIR) - find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f + $(INSTALL_DATA) $(PKG_BUILD_DIR)/pysearpc/*.py $(1)$(PYTHON_PKG_DIR)/pysearpc/ + rm -f $(1)$(PYTHON_PKG_DIR)/pysearpc/{pygencode,test_pysearpc}.py endef +define Py3Build/Compile + rm -rf $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/pysearpc + $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/pysearpc + $(INSTALL_DATA) $(PKG_BUILD_DIR)/pysearpc/*.py $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/pysearpc/ + rm -f $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/pysearpc/{pygencode,test_pysearpc}.py +endef + +Py3Package/python3-searpc/install:=: + $(eval $(call BuildPackage,libsearpc)) + +$(eval $(call Py3Package,python3-searpc)) +$(eval $(call BuildPackage,python3-searpc)) +$(eval $(call BuildPackage,python3-searpc-src)) diff --git a/libs/libsearpc/patches/001-fix-memory-leak-GH-48.patch b/libs/libsearpc/patches/001-fix-memory-leak-GH-48.patch new file mode 100644 index 000000000..a0ae81fce --- /dev/null +++ b/libs/libsearpc/patches/001-fix-memory-leak-GH-48.patch @@ -0,0 +1,19 @@ +From 9b2e2dc65213fb22ed400dc54e4c2279564df62b Mon Sep 17 00:00:00 2001 +From: ly1217 +Date: Thu, 31 Oct 2019 00:31:38 -0700 +Subject: [PATCH] Fix memory leak. + +--- + lib/searpc-named-pipe-transport.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/lib/searpc-named-pipe-transport.c ++++ b/lib/searpc-named-pipe-transport.c +@@ -377,6 +377,7 @@ void searpc_free_client_with_pipe_transp + close(pipe_client->pipe_fd); + #endif + g_free (pipe_client); ++ g_free (data->service); + g_free (data); + searpc_client_free (client); + } diff --git a/libs/libsearpc/patches/002-no-future-import.patch b/libs/libsearpc/patches/002-no-future-import.patch new file mode 100644 index 000000000..b69c021fc --- /dev/null +++ b/libs/libsearpc/patches/002-no-future-import.patch @@ -0,0 +1,11 @@ +--- a/pysearpc/named_pipe.py ++++ b/pysearpc/named_pipe.py +@@ -2,8 +2,6 @@ + RPC client/server implementation based on named pipe transport. + """ + +-from future import standard_library +-standard_library.install_aliases() + from builtins import object + import json + import logging diff --git a/net/seafile-ccnet/Makefile b/net/seafile-ccnet/Makefile index f7c96399d..623855a9c 100644 --- a/net/seafile-ccnet/Makefile +++ b/net/seafile-ccnet/Makefile @@ -8,67 +8,100 @@ include $(TOPDIR)/rules.mk PKG_NAME:=seafile-ccnet -PKG_VERSION:=6.3.4 -PKG_RELEASE:=2 -PKG_LICENSE:=GPL-3.0 +PKG_VERSION:=7.1.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/haiwen/ccnet-server/tar.gz/v$(PKG_VERSION)-server? -PKG_HASH:=ab3d5bda728f87c71929a6247c9f74c5209b9b8e44bafa77db91e8de590ec6ef +PKG_HASH:=32d3d7290415497c52ab407a64468538662dde81ccd139b6e4499e3f2c5b8d4b + +PKG_MAINTAINER:=Alexandru Ardelean , Jeffery To +PKG_LICENSE:=AGPL-3.0-only +PKG_LICENSE_FILES:=LICENSE.txt + PKG_BUILD_DIR:=$(BUILD_DIR)/ccnet-server-$(PKG_VERSION)-server -PKG_MAINTAINER:=Alexandru Ardelean +PKG_BUILD_DEPENDS:=vala/host PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk include ../../lang/python/python-package.mk +include ../../lang/python/python3-package.mk define Package/seafile-ccnet - SECTION:=net - CATEGORY:=Network - TITLE:=Seafile server - ccnet component - URL:=http://seafile.com/ - DEPENDS:=+libsearpc +libevent2 +libopenssl \ - +glib2 +python +libzdb +libuuid \ - +libpthread +libsqlite3 +jansson $(ICONV_DEPENDS) + SECTION:=net + CATEGORY:=Network + TITLE:=Seafile server - ccnet component + URL:=http://seafile.com/ + DEPENDS:= \ + +glib2 \ + +jansson \ + +libevent2 \ + +libmariadb \ + +libopenssl \ + +libpthread \ + +libsearpc \ + +libsqlite3 \ + +libuuid \ + $(ICONV_DEPENDS) endef define Package/seafile-ccnet/description - Ccnet is a framework for writing networked applications in C. + 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 +define Package/python3-seafile-ccnet + SECTION:=lang + CATEGORY:=Languages + SUBMENU:=Python + TITLE:=Python bindings for Seafile Ccnet + DEPENDS:=+seafile-ccnet +python3-light +python3-searpc + VARIANT:=python3 +endef -PKG_BUILD_DEPENDS:=vala/host +define Package/python3-seafile-ccnet/description +$(call Package/seafile-ccnet/description) + + This package contains Python bindings for Ccnet. +endef -TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \ - -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz +CONFIGURE_ARGS += \ + --disable-console \ + --disable-ldap \ + --enable-python \ + --with-mysql="$(STAGING_DIR)/usr/bin/mysql_config" +# Include Python 2 bindings in this package to maintain compatibility with previous versions define Package/seafile-ccnet/install - $(INSTALL_DIR) $(1)/usr/{bin,lib} - $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) - $(CP) $(PKG_INSTALL_DIR)/usr/bin/ccnet* $(1)/usr/bin/ - $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/ccnet $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/{lib,libexec} + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/ccnet + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/libexec/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/python/ccnet/*.py $(1)$(PYTHON_PKG_DIR)/ccnet/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/ - find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f endef define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DIR) $(1)/usr/include/ccnet $(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.so* $(1)/usr/lib/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/ccnet/*.h $(1)/usr/include/ccnet/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libccnet.pc $(1)/usr/lib/pkgconfig/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.{a,la,so*} $(1)/usr/lib/ +endef + +define Py3Build/Compile + rm -rf $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/ccnet + $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/ccnet + $(INSTALL_DATA) $(PKG_BUILD_DIR)/python/ccnet/*.py $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/ccnet/ endef +Py3Package/python3-seafile-ccnet/install:=: + $(eval $(call BuildPackage,seafile-ccnet)) + +$(eval $(call Py3Package,python3-seafile-ccnet)) +$(eval $(call BuildPackage,python3-seafile-ccnet)) +$(eval $(call BuildPackage,python3-seafile-ccnet-src)) diff --git a/net/seafile-ccnet/patches/010-Makefile.patch b/net/seafile-ccnet/patches/010-Makefile.patch index a24f5863a..51477c855 100644 --- a/net/seafile-ccnet/patches/010-Makefile.patch +++ b/net/seafile-ccnet/patches/010-Makefile.patch @@ -5,21 +5,7 @@ AM_CPPFLAGS = @GLIB2_CFLAGS@ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/ccnet \ -@@ -72,11 +73,11 @@ ccnet-client.c: ccnet-object.h - - ccnet-object.h: ${ccnet_object_define} - rm -f $@ -- valac --pkg posix ${ccnet_object_define} -C -H ccnet-object.h -+ "$(STAGING_DIR_HOSTPKG)/bin/valac" --pkg posix ${ccnet_object_define} -C -H ccnet-object.h - - ccnetobj.c: ${ccnet_object_define} - rm -f $@ -- valac -C --pkg posix ${ccnet_object_define} -+ "$(STAGING_DIR_HOSTPKG)/bin/valac" -C --pkg posix ${ccnet_object_define} - - searpc_gen = searpc-signature.h searpc-marshal.h - -@@ -86,7 +87,7 @@ rpc_table.stamp: ${top_srcdir}/lib/rpc_table.py +@@ -85,7 +86,7 @@ rpc_table.stamp: ${top_srcdir}/lib/rpc_t @rm -f rpc_table.tmp @touch rpc_table.tmp @echo "[libsearpc]: generating rpc header files" diff --git a/net/seafile-ccnet/patches/020-Remove-API-deprecated-in-openssl-1.1.patch b/net/seafile-ccnet/patches/020-Remove-API-deprecated-in-openssl-1.1.patch index 398337510..ce06a2d32 100644 --- a/net/seafile-ccnet/patches/020-Remove-API-deprecated-in-openssl-1.1.patch +++ b/net/seafile-ccnet/patches/020-Remove-API-deprecated-in-openssl-1.1.patch @@ -20,8 +20,6 @@ Signed-off-by: Eneas U de Queiroz tools/ccnet-init.c | 2 ++ 7 files changed, 23 insertions(+), 8 deletions(-) -diff --git a/lib/rsa.c b/lib/rsa.c -index 7cca150..d969a62 100644 --- a/lib/rsa.c +++ b/lib/rsa.c @@ -4,6 +4,7 @@ @@ -36,11 +34,10 @@ index 7cca150..d969a62 100644 generate_private_key(u_int bits) { RSA *private = NULL; -- ++ BIGNUM *e = NULL; + - private = RSA_generate_key(bits, 35, NULL, NULL); - if (private == NULL) -+ BIGNUM *e = NULL; -+ + private = RSA_new(); + e = BN_new(); + if (private == NULL || e == NULL || !BN_set_word(e, 35) || @@ -53,11 +50,9 @@ index 7cca150..d969a62 100644 + BN_free(e); return private; } -diff --git a/net/common/processors/keepalive-proc.c b/net/common/processors/keepalive-proc.c -index 609d102..42a0c23 100644 --- a/net/common/processors/keepalive-proc.c +++ b/net/common/processors/keepalive-proc.c -@@ -401,7 +401,7 @@ static void send_challenge(CcnetProcessor *processor) +@@ -401,7 +401,7 @@ static void send_challenge(CcnetProcesso unsigned char *buf; int len; @@ -66,7 +61,7 @@ index 609d102..42a0c23 100644 buf = public_key_encrypt (peer->pubkey, priv->random_buf, 40, &len); ccnet_processor_send_update (processor, "311", NULL, (char *)buf, len); -@@ -434,7 +434,7 @@ static void send_challenge_user(CcnetProcessor *processor, CcnetUser *user) +@@ -434,7 +434,7 @@ static void send_challenge_user(CcnetPro ccnet_debug ("[Keepalive] Send user challenge to %.8s\n", processor->peer->id); @@ -75,11 +70,9 @@ index 609d102..42a0c23 100644 buf = public_key_encrypt (user->pubkey, priv->random_buf, 40, &len); ccnet_processor_send_update (processor, "321", NULL, (char *)buf, len); -diff --git a/net/common/processors/keepalive2-proc.c b/net/common/processors/keepalive2-proc.c -index d3e799e..d81c266 100644 --- a/net/common/processors/keepalive2-proc.c +++ b/net/common/processors/keepalive2-proc.c -@@ -306,7 +306,7 @@ static void send_challenge(CcnetProcessor *processor) +@@ -306,7 +306,7 @@ static void send_challenge(CcnetProcesso unsigned char *buf; int len; @@ -88,11 +81,9 @@ index d3e799e..d81c266 100644 buf = public_key_encrypt (peer->pubkey, priv->random_buf, 40, &len); if (len < 0) { ccnet_debug ("[Keepalive] Failed to encrypt challenge " -diff --git a/net/common/processors/sendsessionkey-proc.c b/net/common/processors/sendsessionkey-proc.c -index 3ec2757..10c3340 100644 --- a/net/common/processors/sendsessionkey-proc.c +++ b/net/common/processors/sendsessionkey-proc.c -@@ -124,7 +124,7 @@ generate_session_key (CcnetProcessor *processor, int *len_p) +@@ -124,7 +124,7 @@ generate_session_key (CcnetProcessor *pr unsigned char random_buf[40]; SHA_CTX s; @@ -101,11 +92,9 @@ index 3ec2757..10c3340 100644 SHA1_Init (&s); SHA1_Update (&s, random_buf, sizeof(random_buf)); -diff --git a/net/common/processors/sendsessionkey-v2-proc.c b/net/common/processors/sendsessionkey-v2-proc.c -index c1c6924..4805ba6 100644 --- a/net/common/processors/sendsessionkey-v2-proc.c +++ b/net/common/processors/sendsessionkey-v2-proc.c -@@ -125,7 +125,7 @@ generate_session_key (CcnetProcessor *processor, int *len_p) +@@ -125,7 +125,7 @@ generate_session_key (CcnetProcessor *pr unsigned char random_buf[40]; SHA_CTX s; @@ -114,11 +103,9 @@ index c1c6924..4805ba6 100644 SHA1_Init (&s); SHA1_Update (&s, random_buf, sizeof(random_buf)); -diff --git a/net/server/user-mgr.c b/net/server/user-mgr.c -index 8a356f0..7a3f5cb 100644 --- a/net/server/user-mgr.c +++ b/net/server/user-mgr.c -@@ -816,9 +816,13 @@ hash_password_pbkdf2_sha256 (const char *passwd, +@@ -816,9 +816,13 @@ hash_password_pbkdf2_sha256 (const char char salt_str[SHA256_DIGEST_LENGTH*2+1]; if (!RAND_bytes (salt, sizeof(salt))) { @@ -132,11 +119,9 @@ index 8a356f0..7a3f5cb 100644 } PKCS5_PBKDF2_HMAC (passwd, strlen(passwd), -diff --git a/tools/ccnet-init.c b/tools/ccnet-init.c -index 4748962..28c9995 100644 --- a/tools/ccnet-init.c +++ b/tools/ccnet-init.c -@@ -162,7 +162,9 @@ main(int argc, char **argv) +@@ -108,7 +108,9 @@ main(int argc, char **argv) config_dir = ccnet_expand_path (config_dir); /* printf("[conf_dir=%s\n]", config_dir); */ @@ -146,6 +131,3 @@ index 4748962..28c9995 100644 if (RAND_status() != 1) { /* it should be seeded automatically */ fprintf(stderr, "PRNG is not seeded\n"); --- -2.19.1 - diff --git a/net/seafile-ccnet/patches/030-uci-conf.patch b/net/seafile-ccnet/patches/030-uci-conf.patch new file mode 100644 index 000000000..226c4153d --- /dev/null +++ b/net/seafile-ccnet/patches/030-uci-conf.patch @@ -0,0 +1,33 @@ +--- a/net/common/rpc-service.c ++++ b/net/common/rpc-service.c +@@ -314,7 +314,11 @@ ccnet_start_rpc(CcnetSession *session) + + #endif /* CCNET_SERVER */ + +- char *path = g_build_filename (session->config_dir, CCNET_SOCKET_NAME, NULL); ++ const char *socket_dir = g_getenv ("SEAFILE_UCI_SOCKET_DIR"); ++ if (!socket_dir) { ++ socket_dir = session->config_dir; ++ } ++ char *path = g_build_filename (socket_dir, CCNET_SOCKET_NAME, NULL); + SearpcNamedPipeServer *server = searpc_create_named_pipe_server_with_threadpool (path, NAMED_PIPE_SERVER_THREAD_POOL_SIZE); + if (!server) { + ccnet_warning ("Failed to create named pipe server.\n"); +--- a/net/server/ccnet-server.c ++++ b/net/server/ccnet-server.c +@@ -292,10 +292,13 @@ main (int argc, char **argv) + config_dir = ccnet_expand_path (config_dir); + + if (!log_file) { +- char *logdir = g_build_filename (config_dir, "logs", NULL); ++ char *logdir = g_strdup (g_getenv ("SEAFILE_UCI_LOG_DIR")); ++ if (!logdir) { ++ logdir = g_build_filename (config_dir, "logs", NULL); ++ } + checkdir_with_mkdir (logdir); ++ log_file = g_build_filename (logdir, "ccnet.log", NULL); + g_free (logdir); +- log_file = g_build_filename (config_dir, "logs", "ccnet.log", NULL); + } + if (ccnet_log_init (log_file, log_level_str) < 0) { + fprintf (stderr, "ccnet_log_init error: %s, %s\n", strerror(errno), diff --git a/net/seafile-seahub/Makefile b/net/seafile-seahub/Makefile index a479c7d4e..47a6df773 100644 --- a/net/seafile-seahub/Makefile +++ b/net/seafile-seahub/Makefile @@ -8,67 +8,88 @@ include $(TOPDIR)/rules.mk PKG_NAME:=seafile-seahub -PKG_VERSION:=6.3.4 -PKG_RELEASE:=8 +PKG_VERSION:=7.1.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/haiwen/seahub/tar.gz/v$(PKG_VERSION)-server? -PKG_HASH:=53a9efdb6791fd3a2a191e89cb0f133632056046ec08adbb2ad72088e6161430 +PKG_HASH:=647dca870c996ed00844d3bf45bc15f22fdf5268cfd3ac4c0dd9e4c15360361d -PKG_MAINTAINER:=Alexandru Ardelean +PKG_MAINTAINER:=Alexandru Ardelean , Jeffery To PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE.txt -HOST_PYTHON_PACKAGE_BUILD_DEPENDS:="django>=1.11" - PKG_BUILD_DIR:=$(BUILD_DIR)/seahub-$(PKG_VERSION)-server -include $(INCLUDE_DIR)/package.mk -include ../../lang/python/python-package.mk +HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="Django~=1.11" + +PKG_BUILD_PARALLEL:=1 -SEAFILE_PYTHON_DEPENDS:= \ - simplejson chardet dateutil mysqlclient pytz qrcode requests requests-oauthlib \ - django1 django-constance django-appconf django-compressor django-formtools \ - django-jsonfield django-picklefield django-postoffice django-restframework39 \ - pillow django-simple-captcha django-statici18n django-webpack-loader +include $(INCLUDE_DIR)/package.mk +include ../../lang/python/python3-package.mk define Package/seafile-seahub SECTION:=net CATEGORY:=Network TITLE:=Seafile server - seahub component URL:=https://seafile.com/ - DEPENDS:=+python \ - +python-flup +gunicorn +openpyxl \ - $(foreach dep,$(SEAFILE_PYTHON_DEPENDS),+python-$(dep)) + DEPENDS:= \ + +gunicorn3 \ + +python3 \ + +python3-chardet \ + +python3-cryptodome \ + +python3-dateutil \ + +python3-django1 \ + +python3-django-formtools \ + +python3-django-picklefield \ + +python3-django-postoffice \ + +python3-django-restframework39 \ + +python3-django-simple-captcha \ + +python3-django-statici18n \ + +python3-django-webpack-loader \ + +python3-openpyxl \ + +python3-pillow \ + +python3-pyjwt \ + +python3-pymysql \ + +python3-pytz \ + +python3-qrcode \ + +python3-requests \ + +python3-requests-oauthlib \ + +python3-seafile-ccnet \ + +python3-searpc + VARIANT:=python3 +endef + +define Package/seafile-seahub/description + The web end of seafile server. + + Note: Localization support is turned off by default for performance + reasons. Set 'USE_I18N = True' in /etc/seafile/conf/seahub_settings.py + to use languages other than English. endef define Build/Configure endef MAKE_VARS += \ - PYTHON="$(HOST_PYTHON_BIN)" \ + PYTHON="$(HOST_PYTHON3_BIN)" \ DJANGO_ADMIN_PY="$(STAGING_DIR_HOSTPKG)/bin/django-admin" -define Build/Compile - $(call Build/Compile/HostPyPipInstall,$(HOST_PYTHON_PACKAGE_BUILD_DEPENDS)) +define Py3Build/Compile + $(call Build/Compile/HostPy3PipInstall,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS)) $(call Build/Compile/Default,locale) + $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) endef -define Package/seafile-seahub/description - The web end of seafile server. - - NOTE: in order to have better performance, localization support is turned off by default. - Please set 'USE_I18N = True' in seahub_settings.py if you intend to use languages other than English. -endef - -define Package/seafile-seahub/install - $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/seahub - $(CP) $(PKG_BUILD_DIR)/{locale,media,fabfile,seahub,sql,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/ - find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f +define Py3Package/seafile-seahub/install + $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/seahub/tools + $(CP) $(PKG_BUILD_DIR)/{frontend,locale,media,seahub,sql,static,thirdpart} $(1)/usr/share/seafile/seafile-server/seahub/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/manage.py $(1)/usr/share/seafile/seafile-server/seahub/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/tools/secret_key_generator.py $(1)/usr/share/seafile/seafile-server/seahub/tools/ $(SED) "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 + mv $(1)/usr/share/seafile/seafile-server/seahub/media/avatars $(1)/usr/share/seafile/seafile-server/seahub/media/avatars_default endef +$(eval $(call Py3Package,seafile-seahub)) $(eval $(call BuildPackage,seafile-seahub)) +$(eval $(call BuildPackage,seafile-seahub-src)) diff --git a/net/seafile-seahub/patches/010-default-config.patch b/net/seafile-seahub/patches/010-default-config.patch deleted file mode 100644 index 91ccabc0f..000000000 --- a/net/seafile-seahub/patches/010-default-config.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/seahub/settings.py -+++ b/seahub/settings.py -@@ -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. -@@ -339,7 +339,7 @@ SHARE_LINK_EMAIL_LANGUAGE = '' - ENABLE_UPLOAD_LINK_VIRUS_CHECK = False - - # 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 -@@ -348,7 +348,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 - - # Force user to change password when admin add/reset a user. - FORCE_PASSWORD_CHANGE = True diff --git a/net/seafile-seahub/patches/020-Makefile-fixes.patch b/net/seafile-seahub/patches/020-Makefile-fixes.patch index 36c808493..12451b8f6 100644 --- a/net/seafile-seahub/patches/020-Makefile-fixes.patch +++ b/net/seafile-seahub/patches/020-Makefile-fixes.patch @@ -7,7 +7,7 @@ PROJECT=seahub develop: setup-git -@@ -9,7 +12,7 @@ dist: locale uglify statici18n collectstatic +@@ -9,22 +12,22 @@ dist: locale statici18n collectstatic locale: @echo "--> Compile locales" @@ -15,9 +15,6 @@ + $(DJANGO_ADMIN_PY) compilemessages @echo "" - uglify: -@@ -19,17 +22,17 @@ uglify: - statici18n: @echo "--> Generate JS locale files in static/scripts/i18n" - python manage.py compilejsi18n @@ -26,8 +23,8 @@ collectstatic: @echo "--> Collect django static files to media/assets" rm -rf media/assets 2> /dev/null -- python manage.py collectstatic --noinput -i admin -i termsandconditions -i app -i sysadmin-app -i build.js -+ $(PYTHON) manage.py collectstatic --noinput -i admin -i termsandconditions -i app -i sysadmin-app -i build.js +- python manage.py collectstatic --noinput -i admin -i termsandconditions ++ $(PYTHON) manage.py collectstatic --noinput -i admin -i termsandconditions compressstatic: @echo "--> Compress static files(css) to media/CACHE" diff --git a/net/seafile-seahub/patches/030-uci-conf.patch b/net/seafile-seahub/patches/030-uci-conf.patch new file mode 100644 index 000000000..e5559e52d --- /dev/null +++ b/net/seafile-seahub/patches/030-uci-conf.patch @@ -0,0 +1,29 @@ +--- a/seahub/settings.py ++++ b/seahub/settings.py +@@ -140,7 +140,7 @@ TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ +- os.path.join(PROJECT_ROOT, '../../seahub-data/custom/templates'), ++ os.path.join(os.environ.get('SEAFILE_UCI_DATA_DIR', os.path.join(PROJECT_ROOT, '../..')), 'seahub-data/custom/templates'), + os.path.join(PROJECT_ROOT, 'seahub/templates'), + ], + 'APP_DIRS': True, +@@ -627,7 +627,7 @@ CAPTCHA_IMAGE_SIZE = (90, 42) + ENABLE_THUMBNAIL = True + + # Absolute filesystem path to the directory that will hold thumbnail files. +-SEAHUB_DATA_ROOT = os.path.join(PROJECT_ROOT, '../../seahub-data') ++SEAHUB_DATA_ROOT = os.path.join(os.environ.get('SEAFILE_UCI_DATA_DIR', os.path.join(PROJECT_ROOT, '../..')), 'seahub-data') + if os.path.exists(SEAHUB_DATA_ROOT): + THUMBNAIL_ROOT = os.path.join(SEAHUB_DATA_ROOT, 'thumbnail') + else: +@@ -790,7 +790,7 @@ except ImportError: + pass + else: + # In server release, sqlite3 db file is /seahub.db +- DATABASES['default']['NAME'] = os.path.join(install_topdir, 'seahub.db') ++ DATABASES['default']['NAME'] = os.path.join(os.environ.get('SEAFILE_UCI_DATA_DIR', install_topdir), 'seahub.db') + + # In server release, gunicorn is used to deploy seahub + INSTALLED_APPS += ('gunicorn', ) diff --git a/net/seafile-seahub/patches/040-manage-shebang.patch b/net/seafile-seahub/patches/040-manage-shebang.patch new file mode 100644 index 000000000..8507d0c19 --- /dev/null +++ b/net/seafile-seahub/patches/040-manage-shebang.patch @@ -0,0 +1,8 @@ +--- a/manage.py ++++ b/manage.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python3 + import os + import sys + diff --git a/net/seafile-server/Config.in b/net/seafile-server/Config.in deleted file mode 100644 index d66632fa4..000000000 --- a/net/seafile-server/Config.in +++ /dev/null @@ -1,12 +0,0 @@ -menu "Configuration" - depends on PACKAGE_seafile-server - -config SEAFILE_FUSE_SUPPORT - bool "Enable FUSE support" - select PACKAGE_libfuse - default n - -config SEAFILE_CONSOLE_SUPPORT - bool "Enable seafile server console" - default n -endmenu diff --git a/net/seafile-server/Makefile b/net/seafile-server/Makefile index 627682161..140c4783d 100644 --- a/net/seafile-server/Makefile +++ b/net/seafile-server/Makefile @@ -8,144 +8,246 @@ include $(TOPDIR)/rules.mk PKG_NAME:=seafile-server -PKG_VERSION:=6.3.4 -PKG_RELEASE:=7 -PKG_LICENSE:=GPL-3.0 +PKG_VERSION:=7.1.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/haiwen/seafile-server/tar.gz/v$(PKG_VERSION)-server? -PKG_HASH:=1ba4c641bad8d7592fd2592827e81470c88b8e802707d2b1e6d551c16d0da100 +PKG_HASH:=30b972d17eb13da28f4dffcbabd2a2a4a7426a017f694e0fb8440e93fd5bd355 + +PKG_MAINTAINER:=Alexandru Ardelean , Jeffery To +PKG_LICENSE:=AGPL-3.0-only +PKG_LICENSE_FILES:=LICENSE.txt + PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-server -PKG_MAINTAINER:=Alexandru Ardelean +PKG_BUILD_DEPENDS:=vala/host libevhtp PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk include ../../lang/python/python-package.mk +include ../../lang/python/python3-package.mk # Check that the actual Makefile version-relase match the above. $(eval $(shell awk '/^PKG_VERSION.*=/ { print "SEAHUB_" $$$$0 }' ../seafile-seahub/Makefile)) ifneq ($(PKG_VERSION),$(SEAHUB_PKG_VERSION)) - $(error $(if $(SEAHUB_PKG_VERSION), \ - Version mismatch between seafile-seahub ($(SEAHUB_PKG_VERSION)) and \ - seafile-server ($(PKG_VERSION)), \ - Could not get PKG_VERSION from seafile-seahub Makefile)) + $(error $(if $(SEAHUB_PKG_VERSION), \ + Version mismatch between seafile-seahub ($(SEAHUB_PKG_VERSION)) and \ + seafile-server ($(PKG_VERSION)), \ + Could not get PKG_VERSION from seafile-seahub Makefile)) endif define Package/seafile-server - SECTION:=net - CATEGORY:=Network - TITLE:=Seafile server - URL:=https://seafile.com/ - DEPENDS:=+libarchive +libopenssl +glib2 +libsearpc +seafile-ccnet +seafile-seahub +sqlite3-cli \ - +python-mysqlclient +python-urllib3 +jansson +libevent2 +libevent2-openssl \ - +libevent2-pthreads +zlib +libzdb +libsqlite3 +libmysqlclient +oniguruma \ - +libpthread +libuuid +bash +procps-ng +procps-ng-pkill +SEAFILE_FUSE_SUPPORT:libfuse $(ICONV_DEPENDS) - MENU:=1 + SECTION:=net + CATEGORY:=Network + TITLE:=Seafile server + URL:=https://seafile.com/ + DEPENDS:= \ + +bash \ + +glib2 \ + +jansson \ + +libarchive \ + +libevent2 \ + +libevent2-openssl \ + +libmariadb \ + +libopenssl \ + +libpthread \ + +libsearpc \ + +libsqlite3 \ + +libuuid \ + +oniguruma \ + +procps-ng-pkill \ + +python3-pymysql \ + +python3-seafile-server \ + +seafile-ccnet \ + +seafile-seahub \ + +sqlite3-cli \ + +zlib \ + $(ICONV_DEPENDS) endef -define Package/seafile-server/config - source "$(SOURCE)/Config.in" +define Package/seafile-server/description + Open source cloud storage with advanced features on privacy + protection and teamwork. endef -define Package/seafile-server/description - Open source cloud storage with advanced features on privacy protection and teamwork. +define Package/seafile-server-fuse + SECTION:=net + CATEGORY:=Network + TITLE:=Seafile server - FUSE extension + URL:=https://seafile.com/ + DEPENDS:= \ + +bash \ + +glib2 \ + +jansson \ + +libevent2 \ + +libevent2-openssl \ + +libfuse \ + +libmariadb \ + +libopenssl \ + +libpthread \ + +libsearpc \ + +libsqlite3 \ + +libuuid \ + +procps-ng-pkill \ + +seafile-ccnet \ + +seafile-server \ + +zlib \ + $(ICONV_DEPENDS) endef -CONFIGURE_ARGS += --enable-python +define Package/seafile-server-fuse/description +$(call Package/seafile-server/description) -ifeq ($(CONFIG_SEAFILE_FUSE_SUPPORT),y) - CONFIGURE_ARGS += --enable-fuse - TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/fuse -else - CONFIGURE_ARGS += --disable-fuse -endif + This package contains the FUSE extension (seaf-fuse) for Seafile + server. +endef -ifeq ($(CONFIG_SEAFILE_CONSOLE_SUPPORT),y) - CONFIGURE_ARGS += --enable-console -else - CONFIGURE_ARGS += --disable-console -endif +define Package/python3-seafile-server + SECTION:=lang + CATEGORY:=Languages + SUBMENU:=Python + TITLE:=Python bindings for Seafile server + DEPENDS:=+python3-light +python3-logging +python3-searpc +python3-seafile-ccnet + VARIANT:=python3 +endef -PKG_BUILD_DEPENDS:=vala/host libevhtp +define Package/python3-seafile-server/description +$(call Package/seafile-server/description) -# This is required as python-package.mk overrides the default setting of having interlinking enabled + This package contains Python bindings for Seafile server. +endef + +CONFIGURE_ARGS += \ + --disable-console \ + --enable-fuse \ + --enable-python \ + --with-mysql="$(STAGING_DIR)/usr/bin/mysql_config" + +# This is required as python[3]-package.mk overrides the default setting of having interlinking enabled ifdef CONFIG_USE_MIPS16 - TARGET_CFLAGS += -minterlink-mips16 + TARGET_CFLAGS += -minterlink-mips16 endif -TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \ - -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz -levent_openssl -levent ifdef CONFIG_GCC_LIBSSP -TARGET_LDFLAGS += -lssp + TARGET_LDFLAGS += -lssp endif define Package/seafile-server/conffiles -/etc/config/seafile +/etc/config/seafile-server endef +SEAFILE_SERVER_BINARIES:= \ + seaf-fsck \ + seafile-controller \ + seaf-server \ + seaf-server-init \ + seafserv-gc + +SEAFILE_SERVER_SHELL_SCRIPTS:= \ + reset-admin.sh \ + seaf-fsck.sh \ + seaf-gc.sh \ + seafile.sh \ + seahub.sh \ + setup-seafile-mysql.sh \ + setup-seafile.sh + # sqlite2mysql.sh handled differently + +SEAFILE_SERVER_PYTHON_SCRIPTS:= \ + check_init_admin.py \ + setup-seafile-mysql.py \ + sqlite2mysql.py + +# Include Python 2 bindings in this package to maintain compatibility with previous versions define Package/seafile-server/install - $(INSTALL_DIR) $(1)/usr/{bin,lib} - $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/{bin,libexec} + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/{seafile,seaserv} $(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)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/ - $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/ - $(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/ -ifeq ($(CONFIG_SEAFILE_FUSE_SUPPORT),y) - $(CP) $(PKG_BUILD_DIR)/scripts/seaf-fuse.sh $(1)/usr/share/seafile/seafile-server/ -endif - $(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/ - $(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 + $(INSTALL_DIR) $(1)/etc/{config,init.d,seafile} + $(INSTALL_DIR) $(1)/lib/upgrade/keep.d + + for bin in $(SEAFILE_SERVER_BINARIES) ; do \ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$$$$bin $(1)/usr/libexec/ ; \ + done + + $(INSTALL_DATA) $(PKG_BUILD_DIR)/python/seafile/*.py $(1)$(PYTHON_PKG_DIR)/seafile/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/python/seaserv/*.py $(1)$(PYTHON_PKG_DIR)/seaserv/ + + for sh in $(SEAFILE_SERVER_SHELL_SCRIPTS) ; do \ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/$$$$sh $(1)/usr/bin/$$$${sh%.sh} ; \ + done + mv $(1)/usr/bin/reset-admin $(1)/usr/bin/reset-seafile-admin + + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/ + + for py in $(SEAFILE_SERVER_PYTHON_SCRIPTS) ; do \ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/scripts/$$$$py $(1)/usr/share/seafile/seafile-server/ ; \ + done + + $(CP) $(PKG_BUILD_DIR)/scripts/{sql,upgrade} $(1)/usr/share/seafile/seafile-server/ + rm -rf $(1)/usr/share/seafile/seafile-server/upgrade/win32 + + $(INSTALL_BIN) ./files/create-seafile-admin.sh $(1)/usr/bin/create-seafile-admin + + $(INSTALL_CONF) ./files/seafile-server.config $(1)/etc/config/seafile-server + $(INSTALL_BIN) ./files/seafile-server.init $(1)/etc/init.d/seafile-server + $(INSTALL_DATA) ./files/seafile-server.upgrade $(1)/lib/upgrade/keep.d/seafile-server endef define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DIR) $(1)/usr/include/seafile $(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)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/ - $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/seafile/*.h $(1)/usr/include/seafile/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/ endef +define Py3Build/Compile + rm -rf $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/{seafile,seaserv} + $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/{seafile,seaserv} + $(INSTALL_DATA) $(PKG_BUILD_DIR)/python/seafile/*.py $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/seafile/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/python/seaserv/*.py $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/seaserv/ +endef + +define Package/seafile-server-fuse/install + $(INSTALL_DIR) $(1)/usr/{bin,libexec} + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/seaf-fuse $(1)/usr/libexec/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/seaf-fuse.sh $(1)/usr/bin/seaf-fuse +endef + +Py3Package/python3-seafile-server/install:=: + define Package/seafile-server/postinst #!/bin/sh -[ ! -f /etc/init.d/seafile ] && exit 0 - -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 -else - echo "*** seafile-data directory already exists." - echo - echo "*** In case you are upgrading seafile, please run the appropriate upgrade script" - echo "*** manually before using the new version." - 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 +cat << EOF + +Please see: + +https://github.com/openwrt/packages/blob/master/net/seafile-server/README.md + +for OpenWrt-specific installation notes (in particular, if you are +upgrading from a version before 7.1). + +EOF + +[ -z "$$IPKG_INSTROOT" ] || exit 0 + +cat << EOF + +opkg will attempt to start Seafile server now. This may fail if you have +not set up Seafile server before or if you are upgrading and have not +run the upgrade scripts. + +EOF endef $(eval $(call BuildPackage,seafile-server)) +$(eval $(call BuildPackage,seafile-server-fuse)) + +$(eval $(call Py3Package,python3-seafile-server)) +$(eval $(call BuildPackage,python3-seafile-server)) +$(eval $(call BuildPackage,python3-seafile-server-src)) diff --git a/net/seafile-server/README.md b/net/seafile-server/README.md new file mode 100644 index 000000000..e4bd47a94 --- /dev/null +++ b/net/seafile-server/README.md @@ -0,0 +1,114 @@ +# Seafile Server on OpenWrt + +## Installation Notes + +### First-time Installation + +1. Consider where you would like the Seafile data directory + (`seafile-data`), Seahub data directory (`seahub-data`), and the + Seahub database (`seahub.db`, if you will be using SQLite) to be + stored. + + This location can be configured in `/etc/config/seafile-server` + (using the _data_dir_ option); the default is `/usr/share/seafile`. + + If you are certain you will use a custom location, set this location + in `/etc/config/seafile-server` before continuing with the other + installation steps. + +2. Run one of the two setup scripts: + + * To use SQLite: + + # setup-seafile + + * To use MySQL: + + # setup-seafile-mysql + +3. Create a Seafile admin account: + + # create-seafile-admin + +4. Start Seafile server: + + # service seafile-server start + + +### Upgrading + +Please run the appropriate upgrade scripts in +`/usr/share/seafile/seafile-server/upgrade` before using the new +version. + +For more information, see +https://download.seafile.com/published/seafile-manual/upgrade/upgrade.md. + +Note that since version 7.1, configuration files are stored in +`/etc/seafile` instead of `/usr/share/seafile`. + +If you are upgrading from a version before 7.1: + +1. Run the upgrade scripts in + `/usr/share/seafile/seafile-server/upgrade` up to 7.1. + +2. Move the `conf` and `ccnet` directories from `/usr/share/seafile` to + `/etc/seafile`. + +3. If you are using a custom Seafile data directory location and have + set this in `ccnet/seafile.ini`: + + Starting with 7.1, the Seafile data directory location will be taken + from `/etc/config/seafile-server`, and any setting in + `ccnet/seafile.ini` will be ignored. + + It is strongly recommended to migrate the custom location setting to + `/etc/config/seafile-server` and rename/remove the `seafile.ini` + file. + + Note that the _data_dir_ option in /etc/config/seafile-server + determines the *parent* path to the Seafile data directory (along + with the Seahub data directory and the Seahub database, if you are + using SQLite). The actual Seafile data directory must be named + `seafile-data`. + + For example, if your Seafile data directory is + `/srv/seafile/my-seafile-data`: + + 1. Rename the directory to `seafile-data`, so now the Seafile data + directory is `/srv/seafile/seafile-data`. + + 2. Move the Seahub data directory (`seahub-data`) from + `/usr/share/seafile` into `/srv/seafile`. + + 3. If you are using SQLite, move the Seahub database (`seahub.db`) + from `/usr/share/seafile` into `/srv/seafile`. + + 4. Set the _data_dir_ option in `/etc/config/seafile-server` to the + parent path, `/srv/seafile`. + + 5. Rename or delete `ccnet/seafile.ini`. + +4. Review/update your Seahub settings. In previous versions of the + Seahub OpenWrt package, some of Seahub's default settings (in + `/usr/share/seafile/seafile-server/seahub/seahub/settings.py`) were + modified from the defaults shipped by upstream. + + Starting with 7.1, Seahub's default settings are the same as + [upstream][seahub_settings], with custom settings added to + `/etc/seafile/conf/seahub_settings.py` during setup for new + installations. + + To use the same custom settings in your upgraded installation, add + these lines to `/etc/seafile/conf/seahub_settings.py`: + + # Custom settings for OpenWrt + USE_I18N = False + USER_PASSWORD_MIN_LENGTH = 8 + USER_STRONG_PASSWORD_REQUIRED = True + + [seahub_settings]: https://github.com/haiwen/seahub/blob/v7.1.2-server/seahub/settings.py + +5. Continue running the upgrade scripts up to the new version. + + diff --git a/net/seafile-server/files/create-seafile-admin.sh b/net/seafile-server/files/create-seafile-admin.sh new file mode 100644 index 000000000..3748381cd --- /dev/null +++ b/net/seafile-server/files/create-seafile-admin.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +TOPDIR=/usr/share/seafile +INSTALLPATH=$TOPDIR/seafile-server + +seafile start || exit 1 + +seahub python-env python3 "$INSTALLPATH/check_init_admin.py" + +seafile stop diff --git a/net/seafile-server/files/seafile-server.config b/net/seafile-server/files/seafile-server.config new file mode 100644 index 000000000..5d801dd85 --- /dev/null +++ b/net/seafile-server/files/seafile-server.config @@ -0,0 +1,11 @@ +config seafile-server + # + # Directory that holds: + # + # * Seafile data directory (seafile-data) + # * Seahub data directory (seahub-data) + # * Seahub database (seahub.db), if using SQLite + # + # Default: /usr/share/seafile + # + option data_dir /usr/share/seafile diff --git a/net/seafile-server/files/seafile-server.init b/net/seafile-server/files/seafile-server.init new file mode 100644 index 000000000..db9369bff --- /dev/null +++ b/net/seafile-server/files/seafile-server.init @@ -0,0 +1,74 @@ +#!/bin/sh /etc/rc.common + +START=99 +STOP=01 +EXTRA_COMMANDS="generate_uci_conf" + +TOPDIR=/usr/share/seafile +INSTALLPATH=$TOPDIR/seafile-server + +uci_conf=/var/run/seafile/uci.conf +default_data_dir=$TOPDIR + +seafile_server_latest_symlink=$TOPDIR/seafile-server-latest +seafile_data_dir_symlink=$TOPDIR/seafile-data +seahub_avatars_symlink=$INSTALLPATH/seahub/media/avatars +seahub_custom_media_symlink=$INSTALLPATH/seahub/media/custom + +read_uci_section() { + local cfg="$1" + local data_dir + config_get data_dir "$cfg" data_dir "$default_data_dir" + uci_data_dir="$data_dir" +} + +generate_uci_conf() { + local uci_data_dir="$default_data_dir" + + config_load seafile-server + config_foreach read_uci_section seafile-server + + mkdir -p "$uci_data_dir" + + mkdir -p "${uci_conf%/*}" + cat <<- EOF > "$uci_conf" + export SEAFILE_UCI_CONF_DIR=/etc/seafile + export SEAFILE_UCI_DATA_DIR="$uci_data_dir" + export SEAFILE_UCI_LOG_DIR=/var/log/seafile + export SEAFILE_UCI_PID_DIR=/var/run/seafile + export SEAFILE_UCI_SOCKET_DIR=/var/run/seafile + EOF + + [ ! -L "$seafile_server_latest_symlink" ] || rm -f "$seafile_server_latest_symlink" + [ ! -L "$seafile_data_dir_symlink" ] || rm -f "$seafile_data_dir_symlink" + + [ ! -L "$seahub_avatars_symlink" ] || \ + [ "$(readlink -f "$seahub_avatars_symlink")" = "$uci_data_dir/seahub-data/avatars" ] || \ + ln -snf "$uci_data_dir/seahub-data/avatars" "$seahub_avatars_symlink" + + [ ! -L "$seahub_custom_media_symlink" ] || \ + [ "$(readlink -f "$seahub_custom_media_symlink")" = "$uci_data_dir/seahub-data/custom" ] || \ + ln -snf "$uci_data_dir/seahub-data/custom" "$seahub_custom_media_symlink" +} + +start() { + seafile start || return + if ! seahub start; then + seafile stop + return 1 + fi +} + +stop() { + seahub stop + seahub_ret=$? + seafile stop + seafile_ret=$? + [ "$seahub_ret" -eq 0 ] && [ "$seafile_ret" -eq 0 ] +} + +restart() { + stop + sleep 2 + start +} diff --git a/net/seafile-server/files/seafile-server.upgrade b/net/seafile-server/files/seafile-server.upgrade new file mode 100644 index 000000000..9312da679 --- /dev/null +++ b/net/seafile-server/files/seafile-server.upgrade @@ -0,0 +1 @@ +/etc/seafile/ diff --git a/net/seafile-server/files/seafile.conf b/net/seafile-server/files/seafile.conf deleted file mode 100644 index f4c0ea9d0..000000000 --- a/net/seafile-server/files/seafile.conf +++ /dev/null @@ -1,12 +0,0 @@ -# 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 deleted file mode 100755 index 1c6553a2e..000000000 --- a/net/seafile-server/files/seafile.init +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/bash /etc/rc.common - -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" - -TOPDIR=/usr/share/seafile -default_ccnet_conf_dir=${TOPDIR}/ccnet -central_config_dir=${TOPDIR}/conf -seaf_controller=/usr/bin/seafile-controller - -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 -} - -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 ..." - - ${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 - - 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 - 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 -} - -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 -} - -function setup() { - cd "$TOPDIR" && \ - /usr/bin/seafile-admin setup -} - -function create_admin() { - cd "$TOPDIR" && \ - /usr/bin/seafile-admin create-admin -} - -function reset_admin() { - create_admin -} diff --git a/net/seafile-server/files/seahub.init b/net/seafile-server/files/seahub.init deleted file mode 100755 index da3a1d1a7..000000000 --- a/net/seafile-server/files/seahub.init +++ /dev/null @@ -1,226 +0,0 @@ -#!/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/010-configure-libevent_openssl.patch b/net/seafile-server/patches/010-configure-libevent_openssl.patch new file mode 100644 index 000000000..902676b7e --- /dev/null +++ b/net/seafile-server/patches/010-configure-libevent_openssl.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -219,7 +219,7 @@ PKG_CHECK_MODULES(JANSSON, [jansson >= $ + AC_SUBST(JANSSON_CFLAGS) + AC_SUBST(JANSSON_LIBS) + +-PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_REQUIRED]) ++PKG_CHECK_MODULES(LIBEVENT, [libevent_openssl >= $LIBEVENT_REQUIRED]) + AC_SUBST(LIBEVENT_CFLAGS) + AC_SUBST(LIBEVENT_LIBS) + diff --git a/net/seafile-server/patches/011-configure-liconv.patch b/net/seafile-server/patches/011-configure-liconv.patch new file mode 100644 index 000000000..819e68435 --- /dev/null +++ b/net/seafile-server/patches/011-configure-liconv.patch @@ -0,0 +1,10 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -167,6 +167,7 @@ else + LIB_MAC= + MSVC_CFLAGS= + LIB_CRYPT32= ++ LIB_ICONV=-liconv + fi + + AC_SUBST(LIB_WS32) diff --git a/net/seafile-server/patches/020-installpath.patch b/net/seafile-server/patches/020-installpath.patch new file mode 100644 index 000000000..ed3710b4e --- /dev/null +++ b/net/seafile-server/patches/020-installpath.patch @@ -0,0 +1,99 @@ +--- a/controller/seafile-controller.c ++++ b/controller/seafile-controller.c +@@ -257,7 +257,7 @@ init_seafile_path () + bin_dir = g_path_get_dirname (binary); + + tmp = g_path_get_dirname (bin_dir); +- installpath = g_path_get_dirname (tmp); ++ installpath = "/usr/share/seafile/seafile-server"; + + topdir = g_path_get_dirname (installpath); + +--- a/scripts/reset-admin.sh ++++ b/scripts/reset-admin.sh +@@ -1,7 +1,7 @@ + #!/bin/bash + + SCRIPT=$(readlink -f "$0") +-INSTALLPATH=$(dirname "${SCRIPT}") ++INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data +--- a/scripts/seaf-fsck.sh ++++ b/scripts/seaf-fsck.sh +@@ -3,7 +3,7 @@ + echo "" + + SCRIPT=$(readlink -f "$0") +-INSTALLPATH=$(dirname "${SCRIPT}") ++INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data +--- a/scripts/seaf-fuse.sh ++++ b/scripts/seaf-fuse.sh +@@ -3,7 +3,7 @@ + echo "" + + SCRIPT=$(readlink -f "$0") +-INSTALLPATH=$(dirname "${SCRIPT}") ++INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data +--- a/scripts/seaf-gc.sh ++++ b/scripts/seaf-gc.sh +@@ -3,7 +3,7 @@ + echo "" + + SCRIPT=$(readlink -f "$0") +-INSTALLPATH=$(dirname "${SCRIPT}") ++INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data +--- a/scripts/seafile.sh ++++ b/scripts/seafile.sh +@@ -13,7 +13,7 @@ + echo "" + + SCRIPT=$(readlink -f "$0") +-INSTALLPATH=$(dirname "${SCRIPT}") ++INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data +--- a/scripts/seahub.sh ++++ b/scripts/seahub.sh +@@ -13,7 +13,7 @@ + echo "" + + SCRIPT=$(readlink -f "$0") +-INSTALLPATH=$(dirname "${SCRIPT}") ++INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data +--- a/scripts/setup-seafile-mysql.sh ++++ b/scripts/setup-seafile-mysql.sh +@@ -7,7 +7,7 @@ + set -e + + SCRIPT=$(readlink -f "$0") +-INSTALLPATH=$(dirname "${SCRIPT}") ++INSTALLPATH=/usr/share/seafile/seafile-server + + cd "$INSTALLPATH" + +--- a/scripts/setup-seafile.sh ++++ b/scripts/setup-seafile.sh +@@ -1,7 +1,7 @@ + #!/bin/bash + + SCRIPT=$(readlink -f "$0") +-INSTALLPATH=$(dirname "${SCRIPT}") ++INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data diff --git a/net/seafile-server/patches/020-script-patches.patch b/net/seafile-server/patches/020-script-patches.patch deleted file mode 100644 index dcbf82c0d..000000000 --- a/net/seafile-server/patches/020-script-patches.patch +++ /dev/null @@ -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. diff --git a/net/seafile-server/patches/021-bin-paths.patch b/net/seafile-server/patches/021-bin-paths.patch new file mode 100644 index 000000000..d97625be3 --- /dev/null +++ b/net/seafile-server/patches/021-bin-paths.patch @@ -0,0 +1,104 @@ +--- a/scripts/seaf-fsck.sh ++++ b/scripts/seaf-fsck.sh +@@ -8,9 +8,9 @@ TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data + default_conf_dir=${TOPDIR}/conf +-seaf_fsck=${INSTALLPATH}/seafile/bin/seaf-fsck ++seaf_fsck=/usr/libexec/seaf-fsck + +-export PATH=${INSTALLPATH}/seafile/bin:$PATH ++export PATH=/usr/libexec:$PATH + export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH} + + script_name=$0 +--- a/scripts/seaf-fuse.sh ++++ b/scripts/seaf-fuse.sh +@@ -8,9 +8,9 @@ TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data + default_conf_dir=${TOPDIR}/conf +-seaf_fuse=${INSTALLPATH}/seafile/bin/seaf-fuse ++seaf_fuse=/usr/libexec/seaf-fuse + +-export PATH=${INSTALLPATH}/seafile/bin:$PATH ++export PATH=/usr/libexec:$PATH + export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH} + + script_name=$0 +--- a/scripts/seaf-gc.sh ++++ b/scripts/seaf-gc.sh +@@ -8,10 +8,10 @@ TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data + default_conf_dir=${TOPDIR}/conf +-seaf_gc=${INSTALLPATH}/seafile/bin/seafserv-gc ++seaf_gc=/usr/libexec/seafserv-gc + seaf_gc_opts="" + +-export PATH=${INSTALLPATH}/seafile/bin:$PATH ++export PATH=/usr/libexec:$PATH + export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH} + + script_name=$0 +--- a/scripts/seafile.sh ++++ b/scripts/seafile.sh +@@ -18,9 +18,9 @@ TOPDIR=$(dirname "${INSTALLPATH}") + default_ccnet_conf_dir=${TOPDIR}/ccnet + default_seafile_data_dir=${TOPDIR}/seafile-data + central_config_dir=${TOPDIR}/conf +-seaf_controller="${INSTALLPATH}/seafile/bin/seafile-controller" ++seaf_controller="/usr/libexec/seafile-controller" + +-export PATH=${INSTALLPATH}/seafile/bin:$PATH ++export PATH=/usr/libexec:$PATH + export ORIG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH} + +--- a/scripts/seahub.sh ++++ b/scripts/seahub.sh +@@ -25,7 +25,7 @@ gunicorn_conf=${TOPDIR}/conf/gunicorn.co + pidfile=${TOPDIR}/pids/seahub.pid + errorlog=${TOPDIR}/logs/gunicorn_error.log + accesslog=${TOPDIR}/logs/gunicorn_access.log +-gunicorn_exe=${INSTALLPATH}/seahub/thirdpart/bin/gunicorn ++gunicorn_exe=/usr/bin/gunicorn3 + + script_name=$0 + function usage () { +@@ -233,9 +233,9 @@ function clear_sessions () { + function stop_seahub () { + if [[ -f ${pidfile} ]]; then + echo "Stopping seahub ..." +- pkill -9 -f "thirdpart/bin/gunicorn" ++ pkill -9 -f "/usr/bin/gunicorn3" + sleep 1 +- if pgrep -f "thirdpart/bin/gunicorn" 2>/dev/null 1>&2 ; then ++ if pgrep -f "/usr/bin/gunicorn3" 2>/dev/null 1>&2 ; then + echo 'Failed to stop seahub.' + exit 1 + fi +--- a/scripts/setup-seafile-mysql.py ++++ b/scripts/setup-seafile-mysql.py +@@ -299,7 +299,7 @@ class EnvManager(object): + def __init__(self): + self.install_path = os.path.dirname(os.path.abspath(__file__)) + self.top_dir = os.path.dirname(self.install_path) +- self.bin_dir = os.path.join(self.install_path, 'seafile', 'bin') ++ self.bin_dir = '/usr/libexec' + self.central_config_dir = os.path.join(self.top_dir, 'conf') + self.central_pids_dir = os.path.join(self.top_dir, 'pids') + self.central_logs_dir = os.path.join(self.top_dir, 'logs') +--- a/scripts/setup-seafile.sh ++++ b/scripts/setup-seafile.sh +@@ -455,8 +455,8 @@ if [[ "${need_pause}" == "1" ]]; then + read dummy + fi + +-ccnet_init=${INSTALLPATH}/seafile/bin/ccnet-init +-seaf_server_init=${INSTALLPATH}/seafile/bin/seaf-server-init ++ccnet_init=/usr/libexec/ccnet-init ++seaf_server_init=/usr/libexec/seaf-server-init + + # ------------------------------------------- + # Create ccnet conf diff --git a/net/seafile-server/patches/022-uci-conf.patch b/net/seafile-server/patches/022-uci-conf.patch new file mode 100644 index 000000000..aa605245c --- /dev/null +++ b/net/seafile-server/patches/022-uci-conf.patch @@ -0,0 +1,583 @@ +--- a/common/seaf-utils.c ++++ b/common/seaf-utils.c +@@ -236,7 +236,12 @@ create_ccnet_rpc_client () + SearpcNamedPipeClient *transport = NULL; + char *pipe_path = NULL; + +- pipe_path = g_build_path ("/", seaf->ccnet_dir, CCNET_RPC_PIPE_NAME, NULL); ++ char *socket_dir = g_strdup (g_getenv ("SEAFILE_UCI_SOCKET_DIR")); ++ if (!socket_dir) { ++ socket_dir = g_strdup (seaf->ccnet_dir); ++ } ++ pipe_path = g_build_path ("/", socket_dir, CCNET_RPC_PIPE_NAME, NULL); ++ g_free (socket_dir); + transport = searpc_create_named_pipe_client(pipe_path); + g_free(pipe_path); + if (!transport) +--- a/controller/seafile-controller.c ++++ b/controller/seafile-controller.c +@@ -480,7 +480,10 @@ stop_services () + static void + init_pidfile_path (SeafileController *ctl) + { +- char *pid_dir = g_build_filename (topdir, "pids", NULL); ++ char *pid_dir = g_strdup (g_getenv ("SEAFILE_UCI_PID_DIR")); ++ if (!pid_dir) { ++ pid_dir = g_build_filename (topdir, "pids", NULL); ++ } + if (!g_file_test(pid_dir, G_FILE_TEST_EXISTS)) { + if (g_mkdir(pid_dir, 0777) < 0) { + seaf_warning("failed to create pid dir %s: %s", pid_dir, strerror(errno)); +@@ -492,6 +495,8 @@ init_pidfile_path (SeafileController *ct + ctl->pidfile[PID_SERVER] = g_build_filename (pid_dir, "seaf-server.pid", NULL); + ctl->pidfile[PID_SEAFDAV] = g_build_filename (pid_dir, "seafdav.pid", NULL); + ctl->pidfile[PID_SEAFEVENTS] = g_build_filename (pid_dir, "seafevents.pid", NULL); ++ ++ g_free (pid_dir); + } + + static int +@@ -514,7 +519,10 @@ seaf_controller_init (SeafileController + + if (logdir == NULL) { + char *topdir = g_path_get_dirname(config_dir); +- logdir = g_build_filename (topdir, "logs", NULL); ++ logdir = g_strdup (g_getenv ("SEAFILE_UCI_LOG_DIR")); ++ if (!logdir) { ++ logdir = g_build_filename (topdir, "logs", NULL); ++ } + if (checkdir_with_mkdir(logdir) < 0) { + fprintf (stderr, "failed to create log folder \"%s\": %s\n", + logdir, strerror(errno)); +@@ -523,10 +531,15 @@ seaf_controller_init (SeafileController + g_free (topdir); + } + ++ char *socket_dir = g_strdup (g_getenv ("SEAFILE_UCI_SOCKET_DIR")); ++ if (!socket_dir) { ++ socket_dir = g_build_filename (installpath, "runtime", NULL); ++ } ++ + ctl->central_config_dir = central_config_dir; + ctl->config_dir = config_dir; + ctl->seafile_dir = seafile_dir; +- ctl->rpc_pipe_path = g_build_filename (installpath, "runtime", NULL); ++ ctl->rpc_pipe_path = socket_dir; + ctl->logdir = logdir; + + if (read_seafdav_config() < 0) { +--- a/python/seaserv/service.py ++++ b/python/seaserv/service.py +@@ -32,11 +32,17 @@ CCNET_CONF_PATH = _load_path_from_env('C + SEAFILE_CONF_DIR = _load_path_from_env('SEAFILE_CONF_DIR') + SEAFILE_CENTRAL_CONF_DIR = _load_path_from_env('SEAFILE_CENTRAL_CONF_DIR', check=False) + SEAFILE_RPC_PIPE_PATH = _load_path_from_env ("SEAFILE_RPC_PIPE_PATH", check=False) ++SEAFILE_UCI_SOCKET_DIR = _load_path_from_env('SEAFILE_UCI_SOCKET_DIR', check=False) + +-ccnet_pipe_path = os.path.join (CCNET_CONF_PATH, 'ccnet-rpc.sock') ++ccnet_pipe_path = os.path.join (SEAFILE_UCI_SOCKET_DIR if SEAFILE_UCI_SOCKET_DIR else CCNET_CONF_PATH, 'ccnet-rpc.sock') + ccnet_threaded_rpc = ccnet.CcnetThreadedRpcClient(ccnet_pipe_path) + +-seafile_pipe_path = os.path.join(SEAFILE_RPC_PIPE_PATH if SEAFILE_RPC_PIPE_PATH else SEAFILE_CONF_DIR, ++socket_dir = SEAFILE_CONF_DIR ++if SEAFILE_RPC_PIPE_PATH: ++ socket_dir = SEAFILE_RPC_PIPE_PATH ++elif SEAFILE_UCI_SOCKET_DIR: ++ socket_dir = SEAFILE_UCI_SOCKET_DIR ++seafile_pipe_path = os.path.join(socket_dir, + 'seafile.sock') + seafserv_threaded_rpc = seafile.ServerThreadedRpcClient(seafile_pipe_path) + +--- a/scripts/check_init_admin.py ++++ b/scripts/check_init_admin.py +@@ -284,7 +284,7 @@ class RPC(object): + import ccnet + ccnet_dir = os.environ['CCNET_CONF_DIR'] + central_config_dir = os.environ['SEAFILE_CENTRAL_CONF_DIR'] +- ccnet_named_pipe_path = ccnet_dir + '/' + 'ccnet-rpc.sock' ++ ccnet_named_pipe_path = os.environ.get('SEAFILE_UCI_SOCKET_DIR', ccnet_dir) + '/' + 'ccnet-rpc.sock' + self.rpc_client = ccnet.CcnetThreadedRpcClient(ccnet_named_pipe_path) + + def get_db_email_users(self): +--- a/scripts/reset-admin.sh ++++ b/scripts/reset-admin.sh +@@ -1,11 +1,13 @@ + #!/bin/bash + ++/etc/init.d/seafile-server generate_uci_conf && . /var/run/seafile/uci.conf ++ + SCRIPT=$(readlink -f "$0") + INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") +-default_ccnet_conf_dir=${TOPDIR}/ccnet +-default_seafile_data_dir=${TOPDIR}/seafile-data +-central_config_dir=${TOPDIR}/conf ++default_ccnet_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/ccnet ++default_seafile_data_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seafile-data ++central_config_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf + + function check_python_executable() { + if [[ "$PYTHON" != "" && -x $PYTHON ]]; then +--- a/scripts/seaf-fsck.sh ++++ b/scripts/seaf-fsck.sh +@@ -2,12 +2,14 @@ + + echo "" + ++/etc/init.d/seafile-server generate_uci_conf && . /var/run/seafile/uci.conf ++ + SCRIPT=$(readlink -f "$0") + INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") +-default_ccnet_conf_dir=${TOPDIR}/ccnet +-default_seafile_data_dir=${TOPDIR}/seafile-data +-default_conf_dir=${TOPDIR}/conf ++default_ccnet_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/ccnet ++default_seafile_data_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seafile-data ++default_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf + seaf_fsck=/usr/libexec/seaf-fsck + + export PATH=/usr/libexec:$PATH +--- a/scripts/seaf-fuse.sh ++++ b/scripts/seaf-fuse.sh +@@ -2,12 +2,14 @@ + + echo "" + ++/etc/init.d/seafile-server generate_uci_conf && . /var/run/seafile/uci.conf ++ + SCRIPT=$(readlink -f "$0") + INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") +-default_ccnet_conf_dir=${TOPDIR}/ccnet +-default_seafile_data_dir=${TOPDIR}/seafile-data +-default_conf_dir=${TOPDIR}/conf ++default_ccnet_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/ccnet ++default_seafile_data_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seafile-data ++default_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf + seaf_fuse=/usr/libexec/seaf-fuse + + export PATH=/usr/libexec:$PATH +@@ -78,7 +80,7 @@ function start_seaf_fuse () { + + echo "Starting seaf-fuse, please wait ..." + +- logfile=${TOPDIR}/logs/seaf-fuse.log ++ logfile=${SEAFILE_UCI_LOG_DIR-$TOPDIR/logs}/seaf-fuse.log + + LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_fuse} \ + -c "${default_ccnet_conf_dir}" \ +--- a/scripts/seaf-gc.sh ++++ b/scripts/seaf-gc.sh +@@ -2,12 +2,14 @@ + + echo "" + ++/etc/init.d/seafile-server generate_uci_conf && . /var/run/seafile/uci.conf ++ + SCRIPT=$(readlink -f "$0") + INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") +-default_ccnet_conf_dir=${TOPDIR}/ccnet +-default_seafile_data_dir=${TOPDIR}/seafile-data +-default_conf_dir=${TOPDIR}/conf ++default_ccnet_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/ccnet ++default_seafile_data_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seafile-data ++default_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf + seaf_gc=/usr/libexec/seafserv-gc + seaf_gc_opts="" + +--- a/scripts/seafile.sh ++++ b/scripts/seafile.sh +@@ -12,12 +12,14 @@ + + echo "" + ++/etc/init.d/seafile-server generate_uci_conf && . /var/run/seafile/uci.conf ++ + SCRIPT=$(readlink -f "$0") + INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") +-default_ccnet_conf_dir=${TOPDIR}/ccnet +-default_seafile_data_dir=${TOPDIR}/seafile-data +-central_config_dir=${TOPDIR}/conf ++default_ccnet_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/ccnet ++default_seafile_data_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seafile-data ++central_config_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf + seaf_controller="/usr/libexec/seafile-controller" + + export PATH=/usr/libexec:$PATH +@@ -121,7 +123,7 @@ function start_seafile_server () { + + echo "Starting seafile server, please wait ..." + +- mkdir -p $TOPDIR/logs ++ mkdir -p ${SEAFILE_UCI_LOG_DIR-$TOPDIR/logs} + LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} \ + -c "${default_ccnet_conf_dir}" \ + -d "${default_seafile_data_dir}" \ +--- a/scripts/seahub.sh ++++ b/scripts/seahub.sh +@@ -12,19 +12,21 @@ + + echo "" + ++/etc/init.d/seafile-server generate_uci_conf && . /var/run/seafile/uci.conf ++ + SCRIPT=$(readlink -f "$0") + INSTALLPATH=/usr/share/seafile/seafile-server + TOPDIR=$(dirname "${INSTALLPATH}") +-default_ccnet_conf_dir=${TOPDIR}/ccnet +-default_seafile_data_dir=${TOPDIR}/seafile-data +-central_config_dir=${TOPDIR}/conf +-seafile_rpc_pipe_path=${INSTALLPATH}/runtime ++default_ccnet_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/ccnet ++default_seafile_data_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seafile-data ++central_config_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf ++seafile_rpc_pipe_path=${SEAFILE_UCI_SOCKET_DIR-$INSTALLPATH/runtime} + + manage_py=${INSTALLPATH}/seahub/manage.py +-gunicorn_conf=${TOPDIR}/conf/gunicorn.conf.py +-pidfile=${TOPDIR}/pids/seahub.pid +-errorlog=${TOPDIR}/logs/gunicorn_error.log +-accesslog=${TOPDIR}/logs/gunicorn_access.log ++gunicorn_conf=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf/gunicorn.conf.py ++pidfile=${SEAFILE_UCI_PID_DIR-$TOPDIR/pids}/seahub.pid ++errorlog=${SEAFILE_UCI_LOG_DIR-$TOPDIR/logs}/gunicorn_error.log ++accesslog=${SEAFILE_UCI_LOG_DIR-$TOPDIR/logs}/gunicorn_access.log + gunicorn_exe=/usr/bin/gunicorn3 + + script_name=$0 +@@ -138,7 +140,7 @@ function warning_if_seafile_not_running + } + + function prepare_seahub_log_dir() { +- logdir=${TOPDIR}/logs ++ logdir=${SEAFILE_UCI_LOG_DIR-$TOPDIR/logs} + if ! [[ -d ${logsdir} ]]; then + if ! mkdir -p "${logdir}"; then + echo "ERROR: failed to create logs dir \"${logdir}\"" +--- a/scripts/setup-seafile-mysql.py ++++ b/scripts/setup-seafile-mysql.py +@@ -300,9 +300,9 @@ class EnvManager(object): + self.install_path = os.path.dirname(os.path.abspath(__file__)) + self.top_dir = os.path.dirname(self.install_path) + self.bin_dir = '/usr/libexec' +- self.central_config_dir = os.path.join(self.top_dir, 'conf') +- self.central_pids_dir = os.path.join(self.top_dir, 'pids') +- self.central_logs_dir = os.path.join(self.top_dir, 'logs') ++ self.central_config_dir = os.path.join(os.environ.get('SEAFILE_UCI_CONF_DIR', self.top_dir), 'conf') ++ self.central_pids_dir = os.environ.get('SEAFILE_UCI_PID_DIR', os.path.join(self.top_dir, 'pids')) ++ self.central_logs_dir = os.environ.get('SEAFILE_UCI_LOG_DIR', os.path.join(self.top_dir, 'logs')) + Utils.must_mkdir(self.central_config_dir) + + def check_pre_condiction(self): +@@ -790,7 +790,7 @@ class CcnetConfigurator(AbstractConfigur + def __init__(self): + '''Initialize default values of ccnet configuration''' + AbstractConfigurator.__init__(self) +- self.ccnet_dir = os.path.join(env_mgr.top_dir, 'ccnet') ++ self.ccnet_dir = os.path.join(os.environ.get('SEAFILE_UCI_CONF_DIR', env_mgr.top_dir), 'ccnet') + self.port = 10001 + self.server_name = None + self.ip_or_domain = None +@@ -919,7 +919,7 @@ class CcnetConfigurator(AbstractConfigur + class SeafileConfigurator(AbstractConfigurator): + def __init__(self): + AbstractConfigurator.__init__(self) +- self.seafile_dir = os.path.join(env_mgr.top_dir, 'seafile-data') ++ self.seafile_dir = os.path.join(os.environ.get('SEAFILE_UCI_DATA_DIR', env_mgr.top_dir), 'seafile-data') + self.port = 12001 + self.fileserver_port = None + self.seafile_conf = os.path.join(env_mgr.central_config_dir, 'seafile.conf') +@@ -983,7 +983,7 @@ class SeafileConfigurator(AbstractConfig + question = 'Where do you want to put your seafile data?' + key = 'seafile-data' + note = 'Please use a volume with enough free space' +- default = os.path.join(env_mgr.top_dir, 'seafile-data') ++ default = os.path.join(os.environ.get('SEAFILE_UCI_DATA_DIR', env_mgr.top_dir), 'seafile-data') + self.seafile_dir = Utils.ask_question(question, + key=key, + note=note, +@@ -1204,7 +1204,7 @@ class SeahubConfigurator(AbstractConfigu + media_dir = os.path.join(env_mgr.install_path, 'seahub', 'media') + orig_avatar_dir = os.path.join(media_dir, 'avatars') + +- seahub_data_dir = os.path.join(env_mgr.top_dir, 'seahub-data') ++ seahub_data_dir = os.path.join(os.environ.get('SEAFILE_UCI_DATA_DIR', env_mgr.top_dir), 'seahub-data') + dest_avatar_dir = os.path.join(seahub_data_dir, 'avatars') + + if os.path.exists(dest_avatar_dir): +@@ -1214,7 +1214,7 @@ class SeahubConfigurator(AbstractConfigu + os.mkdir(seahub_data_dir) + + shutil.move(orig_avatar_dir, dest_avatar_dir) +- os.symlink('../../../seahub-data/avatars', orig_avatar_dir) ++ os.symlink(dest_avatar_dir, orig_avatar_dir) + except Exception as e: + Utils.error('Failed to prepare seahub avatars dir: %s' % e) + +@@ -1390,7 +1390,7 @@ def check_params(args): + seafile_config.fileserver_port = Utils.validate_port(fileserver_port) + + seafile_dir = get_param_val(args.seafile_dir, 'SEAFILE_DIR', +- os.path.join(env_mgr.top_dir, 'seafile-data')) ++ os.path.join(os.environ.get('SEAFILE_UCI_DATA_DIR', env_mgr.top_dir), 'seafile-data')) + seafile_config.seafile_dir = seafile_config.validate_seafile_dir(seafile_dir) + + global db_config +--- a/scripts/setup-seafile-mysql.sh ++++ b/scripts/setup-seafile-mysql.sh +@@ -6,6 +6,8 @@ + + set -e + ++/etc/init.d/seafile-server generate_uci_conf && . /var/run/seafile/uci.conf ++ + SCRIPT=$(readlink -f "$0") + INSTALLPATH=/usr/share/seafile/seafile-server + +--- a/scripts/setup-seafile.sh ++++ b/scripts/setup-seafile.sh +@@ -1,14 +1,16 @@ + #!/bin/bash + ++/etc/init.d/seafile-server generate_uci_conf && . /var/run/seafile/uci.conf ++ + SCRIPT=$(readlink -f "$0") + INSTALLPATH=/usr/share/seafile/seafile-server + 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 ++default_ccnet_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/ccnet ++default_seafile_data_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seafile-data ++default_seahub_db=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub.db ++default_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf ++default_pids_dir=${SEAFILE_UCI_PID_DIR-$TOPDIR/pids} ++default_logs_dir=${SEAFILE_UCI_LOG_DIR-$TOPDIR/logs} + + export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH} + +@@ -516,7 +518,7 @@ gen_seafdav_conf; + # ------------------------------------------- + # generate seahub/settings.py + # ------------------------------------------- +-dest_settings_py=${TOPDIR}/conf/seahub_settings.py ++dest_settings_py=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf/seahub_settings.py + seahub_secret_keygen=${INSTALLPATH}/seahub/tools/secret_key_generator.py + + if [[ ! -f ${dest_settings_py} ]]; then +@@ -621,44 +623,44 @@ function get_seahub_admin_passwd () { + echo "Creating database now, it may take one minute, please wait... " + echo + +-cd ${TOPDIR}/ccnet && mkdir -m 0755 GroupMgr misc OrgMgr PeerMgr && cd - ++cd ${SEAFILE_UCI_CONF_DIR-$TOPDIR}/ccnet && mkdir -m 0755 GroupMgr misc OrgMgr PeerMgr && cd - + +-ccnet_group_db=${TOPDIR}/ccnet/GroupMgr/groupmgr.db ++ccnet_group_db=${SEAFILE_UCI_CONF_DIR-$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_db=${SEAFILE_UCI_CONF_DIR-$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_db=${SEAFILE_UCI_CONF_DIR-$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_db=${SEAFILE_UCI_CONF_DIR-$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_db=${SEAFILE_UCI_DATA_DIR-$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_db=${SEAFILE_UCI_DATA_DIR-$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." +@@ -671,12 +673,12 @@ echo "Done." + + media_dir=${INSTALLPATH}/seahub/media + orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars +-dest_avatar_dir=${TOPDIR}/seahub-data/avatars ++dest_avatar_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data/avatars + + if [[ ! -d ${dest_avatar_dir} ]]; then +- mkdir -p "${TOPDIR}/seahub-data" ++ mkdir -p "${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data" + mv "${orig_avatar_dir}" "${dest_avatar_dir}" +- ln -s ../../../seahub-data/avatars ${media_dir} ++ ln -s ${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data/avatars ${media_dir} + fi + + # Make a seafile-server symlink, like this: +--- a/scripts/sqlite2mysql.sh ++++ b/scripts/sqlite2mysql.sh +@@ -13,17 +13,19 @@ + # (mysql> source ccnet-db.sql) + # + ++/etc/init.d/seafile-server generate_uci_conf && . /var/run/seafile/uci.conf ++ + CCNET_DB='ccnet-db.sql' + SEAFILE_DB='seafile-db.sql' + SEAHUB_DB='seahub-db.sql' + + ########## ccnet + seafile_path=$(pwd) +-if [ -f "${seafile_path}/conf/ccnet.conf" ]; then +- USER_MGR_DB=${seafile_path}/ccnet/PeerMgr/usermgr.db +- GRP_MGR_DB=${seafile_path}/ccnet/GroupMgr/groupmgr.db ++if [ -f "${SEAFILE_UCI_CONF_DIR-$seafile_path}/conf/ccnet.conf" ]; then ++ USER_MGR_DB=${SEAFILE_UCI_CONF_DIR-$seafile_path}/ccnet/PeerMgr/usermgr.db ++ GRP_MGR_DB=${SEAFILE_UCI_CONF_DIR-$seafile_path}/ccnet/GroupMgr/groupmgr.db + else +- echo "${seafile_path}/conf/ccnet.conf does not exists." ++ echo "${SEAFILE_UCI_CONF_DIR-$seafile_path}/conf/ccnet.conf does not exists." + read -p "Please provide your ccnet.conf path(e.g. /data/haiwen/conf/ccnet.conf): " ccnet_conf_path + if [ -f ${ccnet_conf_path} ]; then + USER_MGR_DB=$(dirname $(dirname "${ccnet_conf_path}"))/ccnet/PeerMgr/usermgr.db +@@ -50,11 +52,11 @@ sed 's/email TEXT, role TEXT/email VARCH + ########## seafile + rm -rf ${SEAFILE_DB} + +-if [ -f "${seafile_path}/seafile-data/seafile.db" ]; then +- echo "sqlite3 ${seafile_path}/seafile-data/seafile.db .dump | python sqlite2mysql.py > ${SEAFILE_DB}" +- sqlite3 ${seafile_path}/seafile-data/seafile.db .dump | python sqlite2mysql.py > ${SEAFILE_DB} ++if [ -f "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db" ]; then ++ echo "sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db .dump | python sqlite2mysql.py > ${SEAFILE_DB}" ++ sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db .dump | python sqlite2mysql.py > ${SEAFILE_DB} + else +- echo "${seafile_path}/seafile-data/seafile.db does not exists." ++ echo "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db does not exists." + read -p "Please provide your seafile.db path(e.g. /data/haiwen/seafile-data/seafile.db): " seafile_db_path + if [ -f ${seafile_db_path} ];then + echo "sqlite3 ${seafile_db_path} .dump | python sqlite2mysql.py > ${SEAFILE_DB}" +@@ -74,11 +76,11 @@ sed 's/user_name TEXT/user_name VARCHAR( + ########## seahub + rm -rf ${SEAHUB_DB} + +-if [ -f "${seafile_path}/seahub.db" ]; then +- echo "sqlite3 ${seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB}" +- sqlite3 ${seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB} ++if [ -f "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db" ]; then ++ echo "sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB}" ++ sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB} + else +- echo "${seafile_path}/seahub.db does not exists." ++ echo "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db does not exists." + read -p "Please prove your seahub.db path(e.g. /data/haiwen/seahub.db): " seahub_db_path + if [ -f ${seahub_db_path} ]; then + echo "sqlite3 ${seahub_db_path} .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB}" +--- a/scripts/upgrade/minor-upgrade.sh ++++ b/scripts/upgrade/minor-upgrade.sh +@@ -1,5 +1,7 @@ + #!/bin/bash + ++/etc/init.d/seafile-server generate_uci_conf && . /var/run/seafile/uci.conf ++ + SCRIPT=$(readlink -f "$0") # haiwen/seafile-server-1.3.0/upgrade/upgrade_xx_xx.sh + UPGRADE_DIR=$(dirname "$SCRIPT") # haiwen/seafile-server-1.3.0/upgrade/ + INSTALLPATH=$(dirname "$UPGRADE_DIR") # haiwen/seafile-server-1.3.0/ +@@ -15,11 +17,11 @@ read dummy + + media_dir=${INSTALLPATH}/seahub/media + orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars +-dest_avatar_dir=${TOPDIR}/seahub-data/avatars ++dest_avatar_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data/avatars + seafile_server_symlink=${TOPDIR}/seafile-server-latest +-default_conf_dir=${TOPDIR}/conf +-default_ccnet_conf_dir=${TOPDIR}/ccnet +-seahub_data_dir=${TOPDIR}/seahub-data ++default_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf ++default_ccnet_conf_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/ccnet ++seahub_data_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data + elasticsearch_config_file=${seafile_server_symlink}/pro/elasticsearch/config/jvm.options + + function migrate_avatars() { +@@ -37,7 +39,7 @@ function migrate_avatars() { + elif [[ ! -L ${orig_avatar_dir} ]]; then + mv "${orig_avatar_dir}"/* "${dest_avatar_dir}" 2>/dev/null 1>&2 + rm -rf "${orig_avatar_dir}" +- ln -s ../../../seahub-data/avatars "${media_dir}" ++ ln -s ${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data/avatars "${media_dir}" + fi + echo + echo "DONE" +@@ -51,14 +53,14 @@ function make_media_custom_symlink() { + return + + elif [[ ! -e "${media_symlink}" ]]; then +- ln -s ../../../seahub-data/custom "${media_symlink}" ++ ln -s ${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data/custom "${media_symlink}" + return + + + elif [[ -d "${media_symlink}" ]]; then + cp -rf "${media_symlink}" "${seahub_data_dir}/" + rm -rf "${media_symlink}" +- ln -s ../../../seahub-data/custom "${media_symlink}" ++ ln -s ${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data/custom "${media_symlink}" + fi + + } +--- a/server/seaf-server.c ++++ b/server/seaf-server.c +@@ -767,8 +767,12 @@ static void start_rpc_service (const cha + "set_server_config_boolean", + searpc_signature_int__string_string_int()); + ++ const char *socket_dir = g_getenv ("SEAFILE_UCI_SOCKET_DIR"); ++ + if (rpc_pipe_path) { + pipe_path = g_build_path ("/", rpc_pipe_path, SEAFILE_RPC_PIPE_NAME, NULL); ++ } else if (socket_dir) { ++ pipe_path = g_build_path ("/", socket_dir, SEAFILE_RPC_PIPE_NAME, NULL); + } else { + pipe_path = g_build_path ("/", seafile_dir, SEAFILE_RPC_PIPE_NAME, NULL); + } +@@ -973,8 +977,14 @@ main (int argc, char **argv) + + if (seafile_dir == NULL) + seafile_dir = g_build_filename (ccnet_dir, "seafile", NULL); +- if (logfile == NULL) +- logfile = g_build_filename (seafile_dir, "seafile.log", NULL); ++ if (logfile == NULL) { ++ char *log_dir = g_strdup (g_getenv("SEAFILE_UCI_LOG_DIR")); ++ if (!log_dir) { ++ log_dir = g_strdup (seafile_dir); ++ } ++ logfile = g_build_filename (log_dir, "seafile.log", NULL); ++ g_free (log_dir); ++ } + + if (seafile_log_init (logfile, "info", "debug") < 0) { + seaf_warning ("Failed to init log.\n"); diff --git a/net/seafile-server/patches/023-pgrep-patterns.patch b/net/seafile-server/patches/023-pgrep-patterns.patch new file mode 100644 index 000000000..c60154a88 --- /dev/null +++ b/net/seafile-server/patches/023-pgrep-patterns.patch @@ -0,0 +1,73 @@ +--- a/scripts/seaf-gc.sh ++++ b/scripts/seaf-gc.sh +@@ -63,8 +63,8 @@ function validate_already_running () { + 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 "ccnet-server" "ccnet-server -F ${default_conf_dir} -c ${default_ccnet_conf_dir}" ++ check_component_running "seaf-server" "seaf-server -F ${default_conf_dir} -c ${default_ccnet_conf_dir}" + check_component_running "fileserver" "fileserver -c ${default_ccnet_conf_dir}" + check_component_running "seafdav" "wsgidav.server.server_cli" + } +--- a/scripts/seafile.sh ++++ b/scripts/seafile.sh +@@ -107,8 +107,8 @@ function validate_already_running () { + 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 "ccnet-server" "ccnet-server -F ${central_config_dir} -c ${default_ccnet_conf_dir}" ++ check_component_running "seaf-server" "seaf-server -F ${central_config_dir} -c ${default_ccnet_conf_dir}" + check_component_running "fileserver" "fileserver -c ${default_ccnet_conf_dir}" + check_component_running "seafdav" "wsgidav.server.server_cli" + } +@@ -149,8 +149,8 @@ function stop_seafile_server () { + + 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 "ccnet-server -F ${central_config_dir} -c ${default_ccnet_conf_dir}" ++ pkill -f "seaf-server -F ${central_config_dir} -c ${default_ccnet_conf_dir}" + pkill -f "fileserver -c ${default_ccnet_conf_dir}" + pkill -f "soffice.*--invisible --nocrashreport" + pkill -f "wsgidav.server.server_cli" +--- a/scripts/seahub.sh ++++ b/scripts/seahub.sh +@@ -94,10 +94,10 @@ function validate_seafile_data_dir () { + } + + function validate_seahub_running () { +- if pgrep -f "${manage_py}" 2>/dev/null 1>&2; then ++ if pgrep -f "${manage_py} runfcgi" 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 ++ elif pgrep -f "$gunicorn_exe seahub.wsgi:application -c ${gunicorn_conf}" 2>/dev/null 1>&2; then + echo "Seahub is already running." + exit 1; + fi +@@ -165,7 +165,7 @@ function start_seahub () { + + # Ensure seahub is started successfully + sleep 5 +- if ! pgrep -f "seahub.wsgi:application" 2>/dev/null 1>&2; then ++ if ! pgrep -f "$gunicorn_exe seahub.wsgi:application -c ${gunicorn_conf}" 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; +@@ -235,9 +235,9 @@ function clear_sessions () { + function stop_seahub () { + if [[ -f ${pidfile} ]]; then + echo "Stopping seahub ..." +- pkill -9 -f "/usr/bin/gunicorn3" ++ pkill -9 -f "$gunicorn_exe seahub.wsgi:application -c ${gunicorn_conf}" + sleep 1 +- if pgrep -f "/usr/bin/gunicorn3" 2>/dev/null 1>&2 ; then ++ if pgrep -f "$gunicorn_exe seahub.wsgi:application -c ${gunicorn_conf}" 2>/dev/null 1>&2 ; then + echo 'Failed to stop seahub.' + exit 1 + fi diff --git a/net/seafile-server/patches/024-seahub-pyc.patch b/net/seafile-server/patches/024-seahub-pyc.patch new file mode 100644 index 000000000..697ab9973 --- /dev/null +++ b/net/seafile-server/patches/024-seahub-pyc.patch @@ -0,0 +1,42 @@ +--- a/scripts/reset-admin.sh ++++ b/scripts/reset-admin.sh +@@ -51,5 +51,5 @@ export SEAFILE_CONF_DIR=${default_seafil + export SEAFILE_CENTRAL_CONF_DIR=${central_config_dir} + export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3.6/site-packages:${INSTALLPATH}/seafile/lib64/python3.6/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH + +-manage_py=${INSTALLPATH}/seahub/manage.py ++manage_py=${INSTALLPATH}/seahub/manage.pyc + exec "$PYTHON" "$manage_py" createsuperuser +--- a/scripts/seahub.sh ++++ b/scripts/seahub.sh +@@ -22,7 +22,7 @@ default_seafile_data_dir=${SEAFILE_UCI_D + central_config_dir=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf + seafile_rpc_pipe_path=${SEAFILE_UCI_SOCKET_DIR-$INSTALLPATH/runtime} + +-manage_py=${INSTALLPATH}/seahub/manage.py ++manage_py=${INSTALLPATH}/seahub/manage.pyc + gunicorn_conf=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf/gunicorn.conf.py + pidfile=${SEAFILE_UCI_PID_DIR-$TOPDIR/pids}/seahub.pid + errorlog=${SEAFILE_UCI_LOG_DIR-$TOPDIR/logs}/gunicorn_error.log +--- a/scripts/setup-seafile-mysql.py ++++ b/scripts/setup-seafile-mysql.py +@@ -1083,7 +1083,7 @@ class SeahubConfigurator(AbstractConfigu + fp.write('# -*- coding: utf-8 -*-') + + def write_secret_key(self, fp): +- script = os.path.join(env_mgr.install_path, 'seahub/tools/secret_key_generator.py') ++ script = os.path.join(env_mgr.install_path, 'seahub/tools/secret_key_generator.pyc') + cmd = [ + Utils.get_python_executable(), + script, +--- a/scripts/setup-seafile.sh ++++ b/scripts/setup-seafile.sh +@@ -519,7 +519,7 @@ gen_seafdav_conf; + # generate seahub/settings.py + # ------------------------------------------- + dest_settings_py=${SEAFILE_UCI_CONF_DIR-$TOPDIR}/conf/seahub_settings.py +-seahub_secret_keygen=${INSTALLPATH}/seahub/tools/secret_key_generator.py ++seahub_secret_keygen=${INSTALLPATH}/seahub/tools/secret_key_generator.pyc + + if [[ ! -f ${dest_settings_py} ]]; then + key=$($PYTHON "${seahub_secret_keygen}") diff --git a/net/seafile-server/patches/025-command-names.patch b/net/seafile-server/patches/025-command-names.patch new file mode 100644 index 000000000..18f116473 --- /dev/null +++ b/net/seafile-server/patches/025-command-names.patch @@ -0,0 +1,180 @@ +--- a/scripts/reset-admin.sh ++++ b/scripts/reset-admin.sh +@@ -37,7 +37,7 @@ function check_python_executable() { + function validate_seafile_data_dir () { + if [[ ! -d ${default_seafile_data_dir} ]]; then + echo "Error: there is no seafile server data directory." +- echo "Have you run setup-seafile.sh before this?" ++ echo "Have you run setup-seafile before this?" + echo "" + exit 1; + fi +--- a/scripts/seaf-fsck.sh ++++ b/scripts/seaf-fsck.sh +@@ -25,7 +25,7 @@ function usage () { + 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 "Have you run setup-seafile before this?" + echo "" + exit -1; + fi +@@ -34,7 +34,7 @@ function validate_ccnet_conf_dir () { + function validate_seafile_data_dir () { + if [[ ! -d ${default_seafile_data_dir} ]]; then + echo "Error: there is no seafile server data directory." +- echo "Have you run setup-seafile.sh before this?" ++ echo "Have you run setup-seafile before this?" + echo "" + exit 1; + fi +--- a/scripts/seaf-fuse.sh ++++ b/scripts/seaf-fuse.sh +@@ -41,7 +41,7 @@ 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 "Have you run setup-seafile before this?" + echo "" + exit -1; + fi +@@ -50,7 +50,7 @@ function validate_ccnet_conf_dir () { + function validate_seafile_data_dir () { + if [[ ! -d ${default_seafile_data_dir} ]]; then + echo "Error: there is no seafile server data directory." +- echo "Have you run setup-seafile.sh before this?" ++ echo "Have you run setup-seafile before this?" + echo "" + exit 1; + fi +@@ -67,7 +67,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 + echo +- echo "Warning: seafile-controller not running. Have you run \"./seafile.sh start\" ?" ++ echo "Warning: seafile-controller not running. Have you run \"service seafile-server start\" ?" + echo + fi + } +--- a/scripts/seaf-gc.sh ++++ b/scripts/seaf-gc.sh +@@ -27,7 +27,7 @@ function usage () { + 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 "Have you run setup-seafile before this?" + echo "" + exit -1; + fi +@@ -36,7 +36,7 @@ function validate_ccnet_conf_dir () { + function validate_seafile_data_dir () { + if [[ ! -d ${default_seafile_data_dir} ]]; then + echo "Error: there is no seafile server data directory." +- echo "Have you run setup-seafile.sh before this?" ++ echo "Have you run setup-seafile before this?" + echo "" + exit 1; + fi +@@ -58,7 +58,7 @@ function check_component_running() { + + function validate_already_running () { + if pid=$(pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null); then +- echo "seafile server is still running, stop it by \"seafile.sh stop\"" ++ echo "seafile server is still running, stop it by \"service seafile-server stop\"" + echo + exit 1; + fi +--- a/scripts/seafile.sh ++++ b/scripts/seafile.sh +@@ -53,7 +53,7 @@ function validate_running_user () { + 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 "Have you run setup-seafile before this?" + echo "" + exit -1; + fi +@@ -62,7 +62,7 @@ function validate_ccnet_conf_dir () { + 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 "Have you run setup-seafile before this?" + echo "" + exit -1; + fi +@@ -71,7 +71,7 @@ function validate_central_conf_dir () { + function validate_seafile_data_dir () { + if [[ ! -d ${default_seafile_data_dir} ]]; then + echo "Error: there is no seafile server data directory." +- echo "Have you run setup-seafile.sh before this?" ++ echo "Have you run setup-seafile before this?" + echo "" + exit 1; + fi +--- a/scripts/seahub.sh ++++ b/scripts/seahub.sh +@@ -78,7 +78,7 @@ function check_python_executable() { + 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 "Have you run setup-seafile before this?" + echo "" + exit -1; + fi +@@ -87,7 +87,7 @@ function validate_ccnet_conf_dir () { + function validate_seafile_data_dir () { + if [[ ! -d ${default_seafile_data_dir} ]]; then + echo "Error: there is no seafile server data directory." +- echo "Have you run setup-seafile.sh before this?" ++ echo "Have you run setup-seafile before this?" + echo "" + exit 1; + fi +@@ -133,7 +133,7 @@ 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 "Warning: seafile-controller not running. Have you run \"service seafile-server start\" ?" + echo + exit 1 + fi +@@ -167,7 +167,7 @@ function start_seahub () { + sleep 5 + if ! pgrep -f "$gunicorn_exe seahub.wsgi:application -c ${gunicorn_conf}" 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" ++ echo "Please try to run \"service seafile-server start\" again" + exit 1; + fi + echo +--- a/scripts/setup-seafile-mysql.py ++++ b/scripts/setup-seafile-mysql.py +@@ -1557,8 +1557,7 @@ def report_success(): + Your seafile server configuration has been finished successfully. + ----------------------------------------------------------------- + +-run seafile server: ./seafile.sh { start | stop | restart } +-run seahub server: ./seahub.sh { start | stop | restart } ++run seafile server: service seafile-server { start | stop | restart } + + ----------------------------------------------------------------- + If you are behind a firewall, remember to allow input/output of these tcp ports: +--- a/scripts/setup-seafile.sh ++++ b/scripts/setup-seafile.sh +@@ -718,8 +718,7 @@ 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 | stop | restart }" ++echo "run seafile server: service seafile-server { start | stop | restart }" + echo + echo "-----------------------------------------------------------------" + echo "If the server is behind a firewall, remember to open these tcp ports:" diff --git a/net/seafile-server/patches/030-controller-pid-dir-permissions.patch b/net/seafile-server/patches/030-controller-pid-dir-permissions.patch new file mode 100644 index 000000000..dfd2bfc3e --- /dev/null +++ b/net/seafile-server/patches/030-controller-pid-dir-permissions.patch @@ -0,0 +1,11 @@ +--- a/controller/seafile-controller.c ++++ b/controller/seafile-controller.c +@@ -485,7 +485,7 @@ init_pidfile_path (SeafileController *ct + pid_dir = g_build_filename (topdir, "pids", NULL); + } + 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/030-pidfiles-in-same-directory.patch b/net/seafile-server/patches/030-pidfiles-in-same-directory.patch deleted file mode 100644 index 033dd86a0..000000000 --- a/net/seafile-server/patches/030-pidfiles-in-same-directory.patch +++ /dev/null @@ -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); - } diff --git a/net/seafile-server/patches/031-sqlite2mysql-bash-python3.patch b/net/seafile-server/patches/031-sqlite2mysql-bash-python3.patch new file mode 100644 index 000000000..9359f9b30 --- /dev/null +++ b/net/seafile-server/patches/031-sqlite2mysql-bash-python3.patch @@ -0,0 +1,61 @@ +--- 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. +@@ -38,10 +38,10 @@ fi + + rm -rf ${CCNET_DB} + +-echo "sqlite3 ${USER_MGR_DB} .dump | python sqlite2mysql.py > ${CCNET_DB}" +-sqlite3 ${USER_MGR_DB} .dump | python sqlite2mysql.py > ${CCNET_DB} +-echo "sqlite3 ${GRP_MGR_DB} .dump | python sqlite2mysql.py >> ${CCNET_DB}" +-sqlite3 ${GRP_MGR_DB} .dump | python sqlite2mysql.py >> ${CCNET_DB} ++echo "sqlite3 ${USER_MGR_DB} .dump | python3 sqlite2mysql.py > ${CCNET_DB}" ++sqlite3 ${USER_MGR_DB} .dump | python3 sqlite2mysql.py > ${CCNET_DB} ++echo "sqlite3 ${GRP_MGR_DB} .dump | python3 sqlite2mysql.py >> ${CCNET_DB}" ++sqlite3 ${GRP_MGR_DB} .dump | python3 sqlite2mysql.py >> ${CCNET_DB} + + # change ctime from INTEGER to BIGINT in EmailUser table + sed 's/ctime INTEGER/ctime BIGINT/g' ${CCNET_DB} > ${CCNET_DB}.tmp && mv ${CCNET_DB}.tmp ${CCNET_DB} +@@ -53,14 +53,14 @@ sed 's/email TEXT, role TEXT/email VARCH + rm -rf ${SEAFILE_DB} + + if [ -f "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db" ]; then +- echo "sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db .dump | python sqlite2mysql.py > ${SEAFILE_DB}" +- sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db .dump | python sqlite2mysql.py > ${SEAFILE_DB} ++ echo "sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db .dump | python3 sqlite2mysql.py > ${SEAFILE_DB}" ++ sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db .dump | python3 sqlite2mysql.py > ${SEAFILE_DB} + else + echo "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db does not exists." + read -p "Please provide your seafile.db path(e.g. /data/haiwen/seafile-data/seafile.db): " seafile_db_path + if [ -f ${seafile_db_path} ];then +- echo "sqlite3 ${seafile_db_path} .dump | python sqlite2mysql.py > ${SEAFILE_DB}" +- sqlite3 ${seafile_db_path} .dump | python sqlite2mysql.py > ${SEAFILE_DB} ++ echo "sqlite3 ${seafile_db_path} .dump | python3 sqlite2mysql.py > ${SEAFILE_DB}" ++ sqlite3 ${seafile_db_path} .dump | python3 sqlite2mysql.py > ${SEAFILE_DB} + else + echo "${seafile_db_path} does not exists, quit." + exit 1 +@@ -77,14 +77,14 @@ sed 's/user_name TEXT/user_name VARCHAR( + rm -rf ${SEAHUB_DB} + + if [ -f "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db" ]; then +- echo "sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB}" +- sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB} ++ echo "sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python3 sqlite2mysql.py > ${SEAHUB_DB}" ++ sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python3 sqlite2mysql.py > ${SEAHUB_DB} + else + echo "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db does not exists." + read -p "Please prove your seahub.db path(e.g. /data/haiwen/seahub.db): " seahub_db_path + if [ -f ${seahub_db_path} ]; then +- echo "sqlite3 ${seahub_db_path} .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB}" +- sqlite3 ${seahub_db_path} .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB} ++ echo "sqlite3 ${seahub_db_path} .dump | tr -d '\n' | sed 's/;/;\n/g' | python3 sqlite2mysql.py > ${SEAHUB_DB}" ++ sqlite3 ${seahub_db_path} .dump | tr -d '\n' | sed 's/;/;\n/g' | python3 sqlite2mysql.py > ${SEAHUB_DB} + else + echo "${seahub_db_path} does not exists, quit." + exit 1 diff --git a/net/seafile-server/patches/032-seafile-no-stat.patch b/net/seafile-server/patches/032-seafile-no-stat.patch new file mode 100644 index 000000000..2a63e35c8 --- /dev/null +++ b/net/seafile-server/patches/032-seafile-no-stat.patch @@ -0,0 +1,15 @@ +--- a/scripts/seafile.sh ++++ b/scripts/seafile.sh +@@ -42,10 +42,9 @@ fi + function validate_running_user () { + real_data_dir=`readlink -f ${default_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." ++ if [[ -z "$(find "${real_data_dir}" -user "${running_user}" -maxdepth 0)" ]]; then ++ echo "Error: the user running the script (\"${running_user}\") is not the owner of \"${real_data_dir}\" folder, you should use the owner of \"${real_data_dir}\" to run the script." + exit -1; + fi + } diff --git a/net/seafile-server/patches/033-seahub-do-not-create-admin.patch b/net/seafile-server/patches/033-seahub-do-not-create-admin.patch new file mode 100644 index 000000000..529730cc9 --- /dev/null +++ b/net/seafile-server/patches/033-seahub-do-not-create-admin.patch @@ -0,0 +1,56 @@ +--- a/scripts/check_init_admin.py ++++ b/scripts/check_init_admin.py +@@ -310,7 +310,7 @@ def create_admin(email, passwd): + 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('Let\'s create the admin account') + print('----------------------------------------') + def validate(email): + # whitespace is not allowed +@@ -350,8 +350,15 @@ def ask_admin_password(): + + rpc = RPC() + +-def main(): ++def main(argv): ++ if len(argv) > 1 and argv[1] == 'has-admin': ++ sys.exit(1 if need_create_admin() else 0) ++ + if not need_create_admin(): ++ print('') ++ print('A seafile admin account already exists.') ++ print('Log into seahub to add additional accounts.') ++ print('If you cannot log in, run reset-seafile-admin to add a new admin account.') + return + + password_file = os.path.join(os.environ['SEAFILE_CENTRAL_CONF_DIR'], 'admin.txt') +@@ -369,7 +376,7 @@ def main(): + + if __name__ == '__main__': + try: +- main() ++ main(sys.argv) + except KeyboardInterrupt: + print('\n\n\n') + print(Utils.highlight('Aborted.')) +@@ -379,3 +386,4 @@ if __name__ == '__main__': + print() + print(Utils.highlight('Error happened during creating seafile admin.')) + print() ++ sys.exit(1) +--- a/scripts/seahub.sh ++++ b/scripts/seahub.sh +@@ -250,7 +250,10 @@ function stop_seahub () { + + function check_init_admin() { + check_init_admin_script=${INSTALLPATH}/check_init_admin.py +- if ! $PYTHON $check_init_admin_script; then ++ if ! $PYTHON $check_init_admin_script has-admin; then ++ echo "Error: there is no seafile admin account." ++ echo "Have you run create-seafile-admin before this?" ++ echo "" + exit 1 + fi + } diff --git a/net/seafile-server/patches/034-seaf-fuse-no-fuse_opt_h.patch b/net/seafile-server/patches/034-seaf-fuse-no-fuse_opt_h.patch new file mode 100644 index 000000000..1d2c3851c --- /dev/null +++ b/net/seafile-server/patches/034-seaf-fuse-no-fuse_opt_h.patch @@ -0,0 +1,10 @@ +--- a/fuse/seaf-fuse.c ++++ b/fuse/seaf-fuse.c +@@ -5,7 +5,6 @@ + + #define FUSE_USE_VERSION 26 + #include +-#include + + #include + #include diff --git a/net/seafile-server/patches/040-seafile-admin.patch b/net/seafile-server/patches/040-seafile-admin.patch deleted file mode 100644 index 1f0a7db61..000000000 --- a/net/seafile-server/patches/040-seafile-admin.patch +++ /dev/null @@ -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 ') diff --git a/net/seafile-server/patches/040-setup-skip-dir-check.patch b/net/seafile-server/patches/040-setup-skip-dir-check.patch new file mode 100644 index 000000000..ebac515e4 --- /dev/null +++ b/net/seafile-server/patches/040-setup-skip-dir-check.patch @@ -0,0 +1,22 @@ +--- a/scripts/setup-seafile-mysql.py ++++ b/scripts/setup-seafile-mysql.py +@@ -316,9 +316,6 @@ class EnvManager(object): + os.path.join(self.install_path, 'runtime'), + ] + +- for path in paths: +- error_if_not_exists(path) +- + if os.path.exists(ccnet_config.ccnet_dir): + Utils.error('Ccnet config dir \"%s\" already exists.' % ccnet_config.ccnet_dir) + +--- a/scripts/setup-seafile.sh ++++ b/scripts/setup-seafile.sh +@@ -415,7 +415,6 @@ if [[ $# -ge 1 && "$1" == "auto" ]]; the + need_pause=0 + fi + +-check_sanity; + if [[ "${need_pause}" == "1" ]]; then + welcome; + fi diff --git a/net/seafile-server/patches/041-setup-add-custom-seahub-settings.patch b/net/seafile-server/patches/041-setup-add-custom-seahub-settings.patch new file mode 100644 index 000000000..99b274609 --- /dev/null +++ b/net/seafile-server/patches/041-setup-add-custom-seahub-settings.patch @@ -0,0 +1,27 @@ +--- a/scripts/setup-seafile-mysql.py ++++ b/scripts/setup-seafile-mysql.py +@@ -1101,6 +1101,10 @@ class SeahubConfigurator(AbstractConfigu + } + } + ++# Custom settings for OpenWrt ++USE_I18N = False ++USER_PASSWORD_MIN_LENGTH = 8 ++USER_STRONG_PASSWORD_REQUIRED = True + ''' + text = template % dict(name=db_config.seahub_db_name, + username=db_config.seafile_mysql_user, +--- a/scripts/setup-seafile.sh ++++ b/scripts/setup-seafile.sh +@@ -525,6 +525,11 @@ if [[ ! -f ${dest_settings_py} ]]; then + cat > ${dest_settings_py} </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 diff --git a/net/seafile-server/patches/080-Remove-API-deprecated-in-openssl-1.1.patch b/net/seafile-server/patches/080-Remove-API-deprecated-in-openssl-1.1.patch deleted file mode 100644 index 0e4272632..000000000 --- a/net/seafile-server/patches/080-Remove-API-deprecated-in-openssl-1.1.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 13f95a28ce12216ba51cf0ca8d61c3d89689d02b Mon Sep 17 00:00:00 2001 -From: Eneas U de Queiroz -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 ---- - 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 - diff --git a/net/seafile-server/patches/090-django-11-compat.patch b/net/seafile-server/patches/090-django-11-compat.patch deleted file mode 100644 index 273a5807b..000000000 --- a/net/seafile-server/patches/090-django-11-compat.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 115a4583deb9ae11adbc419ea87c990d0b8572fe Mon Sep 17 00:00:00 2001 -From: Joffrey Darcq -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 -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') - diff --git a/net/seafile-server/patches/100-seafile-admin-Make-sure-ccnet-is-running.patch b/net/seafile-server/patches/100-seafile-admin-Make-sure-ccnet-is-running.patch deleted file mode 100644 index a665e4528..000000000 --- a/net/seafile-server/patches/100-seafile-admin-Make-sure-ccnet-is-running.patch +++ /dev/null @@ -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 '-----------------------------------------------------------------' diff --git a/net/seafile-server/patches/110-libevhtp-linking.patch b/net/seafile-server/patches/110-libevhtp-linking.patch index a19a58c9c..846dbd200 100644 --- a/net/seafile-server/patches/110-libevhtp-linking.patch +++ b/net/seafile-server/patches/110-libevhtp-linking.patch @@ -2,11 +2,9 @@ Author: David Barbion 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 >= +--- a/configure.ac ++++ b/configure.ac +@@ -224,6 +224,10 @@ PKG_CHECK_MODULES(LIBEVENT, [libevent_op AC_SUBST(LIBEVENT_CFLAGS) AC_SUBST(LIBEVENT_LIBS) @@ -17,24 +15,22 @@ Index: seafile-server/configure.ac 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 +--- a/server/Makefile.am ++++ b/server/Makefile.am @@ -13,6 +13,7 @@ AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir) @GLIB2_CFLAGS@ \ @MSVC_CFLAGS@ \ @LIBARCHIVE_CFLAGS@ \ + @LIBEVHTP_CFLAGS@ \ + @MYSQL_CFLAGS@ \ -Wall - bin_PROGRAMS = seaf-server -@@ -114,7 +115,7 @@ seaf_server_SOURCES = \ +@@ -73,7 +74,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@ \ + @LIBARCHIVE_LIBS@ @LIB_ICONV@ \ diff --git a/net/seafile-server/patches/120-recent-libevhtp.patch b/net/seafile-server/patches/120-recent-libevhtp.patch index cc33ab45c..5f2c94e0f 100644 --- a/net/seafile-server/patches/120-recent-libevhtp.patch +++ b/net/seafile-server/patches/120-recent-libevhtp.patch @@ -7,11 +7,9 @@ Description: Fix download stalling on recent libevhtp [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 @@ +--- a/server/access-file.c ++++ b/server/access-file.c +@@ -661,7 +661,7 @@ do_file(evhtp_request_t *req, SeafRepo * /* Block any new request from this connection before finish * handling this request. */ @@ -20,7 +18,7 @@ Index: seafile-server/server/access-file.c /* Kick start data transfer by sending out http headers. */ evhtp_send_reply_start(req, EVHTP_RES_OK); -@@ -967,7 +967,7 @@ +@@ -1021,7 +1021,7 @@ do_file_range (evhtp_request_t *req, Sea /* Block any new request from this connection before finish * handling this request. */ @@ -29,7 +27,7 @@ Index: seafile-server/server/access-file.c /* Kick start data transfer by sending out http headers. */ evhtp_send_reply_start(req, EVHTP_RES_PARTIAL); -@@ -1032,7 +1032,7 @@ +@@ -1091,7 +1091,7 @@ start_download_zip_file (evhtp_request_t /* Block any new request from this connection before finish * handling this request. */ @@ -38,7 +36,7 @@ Index: seafile-server/server/access-file.c /* Kick start data transfer by sending out http headers. */ evhtp_send_reply_start(req, EVHTP_RES_OK); -@@ -1365,7 +1365,7 @@ +@@ -1435,7 +1435,7 @@ do_block(evhtp_request_t *req, SeafRepo /* Block any new request from this connection before finish * handling this request. */ @@ -47,11 +45,9 @@ Index: seafile-server/server/access-file.c /* 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 @@ +--- a/server/upload-file.c ++++ b/server/upload-file.c +@@ -2196,6 +2196,7 @@ out: if (res != EVHTP_RES_OK) { /* Don't receive any data before the connection is closed. */ //evhtp_request_pause (req); @@ -59,7 +55,7 @@ Index: seafile-server/server/upload-file.c /* Set keepalive to 0. This will cause evhtp to close the * connection after sending the reply. -@@ -2271,6 +2272,7 @@ +@@ -2513,6 +2514,7 @@ upload_headers_cb (evhtp_request_t *req, err: /* Don't receive any data before the connection is closed. */ //evhtp_request_pause (req); diff --git a/net/seafile-server/patches/130-newer-libevhtp.patch b/net/seafile-server/patches/130-newer-libevhtp.patch index 554166ee8..70d4b2873 100644 --- a/net/seafile-server/patches/130-newer-libevhtp.patch +++ b/net/seafile-server/patches/130-newer-libevhtp.patch @@ -2,11 +2,9 @@ Author: Alexandre Rossi 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 @@ +--- a/server/upload-file.c ++++ b/server/upload-file.c +@@ -2201,7 +2201,7 @@ out: /* Set keepalive to 0. This will cause evhtp to close the * connection after sending the reply. */ @@ -15,7 +13,7 @@ Index: seafile-server/server/upload-file.c fsm->state = RECV_ERROR; } -@@ -2260,8 +2260,8 @@ +@@ -2502,8 +2502,8 @@ upload_headers_cb (evhtp_request_t *req, } /* Set up per-request hooks, so that we can read file data piece by piece. */ @@ -26,7 +24,7 @@ Index: seafile-server/server/upload-file.c /* Set arg for upload_cb or update_cb. */ req->cbarg = fsm; -@@ -2277,7 +2277,7 @@ +@@ -2519,7 +2519,7 @@ err: /* Set keepalive to 0. This will cause evhtp to close the * connection after sending the reply. */ @@ -35,12 +33,8 @@ Index: seafile-server/server/upload-file.c 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); +@@ -2620,32 +2620,32 @@ upload_file_init (evhtp_t *htp, const ch + g_free (cluster_shared_dir); 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); @@ -53,16 +47,12 @@ Index: seafile-server/server/upload-file.c 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, "^/upload-blks-aj/.*", upload_blks_ajax_cb, NULL); */ + /* evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL); */ - cb = evhtp_set_regex_cb (htp, "^/update/.*", update_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); @@ -72,11 +62,11 @@ Index: seafile-server/server/upload-file.c 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-blks-aj/.*", update_blks_ajax_cb, NULL); */ + /* evhtp_set_hook(&cb->hooks, 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);