Переглянути джерело

seafile: import seafile-server package and its dependencies

Signed-off-by: Gergely Kiss <mail.gery@gmail.com>
Tested-by: Gergely Kiss <mail.gery@gmail.com>
Gergely Kiss 10 роки тому
джерело
коміт
8e781d1a48

+ 84
- 0
libs/libsearpc/Makefile Переглянути файл

@@ -0,0 +1,84 @@
1
+#
2
+# Copyright (C) 2007-2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=libsearpc
11
+PKG_VERSION:=3.0-latest
12
+PKG_RELEASE:=1
13
+PKG_LICENSE:=GPL-3.0
14
+
15
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16
+PKG_SOURCE:=v$(PKG_VERSION).tar.gz
17
+PKG_SOURCE_URL:=https://github.com/haiwen/libsearpc/archive/
18
+PKG_MD5SUM:=32a6eaafe16d8c0c0e320b4a08a4d8f6
19
+PKG_CAT:=zcat
20
+PKG_FIXUP:=autoreconf
21
+PKG_INSTALL:=1
22
+
23
+include $(INCLUDE_DIR)/package.mk
24
+include $(INCLUDE_DIR)/nls.mk
25
+
26
+define Package/libsearpc
27
+    SECTION:=libs
28
+    CATEGORY:=Libraries
29
+    TITLE:=Seafile RPC Library
30
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
31
+    URL:=http://seafile.com/
32
+    DEPENDS:=+glib2 +jansson +python $(ICONV_DEPENDS)
33
+endef
34
+
35
+define Package/libsearpc/description
36
+    Searpc is a simple C language RPC framework based on GObject system.
37
+    Searpc handles the serialization/deserialization part of RPC,
38
+    the transport part is left to users.
39
+endef
40
+
41
+CONFIGURE_ARGS += --enable-compile-demo=no \
42
+		    --disable-server-pkg
43
+
44
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv
45
+
46
+include $(INCLUDE_DIR)/host-build.mk
47
+
48
+define Host/Configure
49
+endef
50
+
51
+define Host/Compile
52
+endef
53
+
54
+define Host/Install
55
+	$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
56
+	$(INSTALL_BIN) $(HOST_BUILD_DIR)/lib/searpc-codegen.py $(STAGING_DIR_HOST)/bin/
57
+endef
58
+
59
+$(eval $(call HostBuild))
60
+
61
+Hooks/Prepare/Post += delete_source_package
62
+
63
+define delete_source_package
64
+	# deleting source package as its filename is ambiguous
65
+	rm -f $(DL_DIR)/$(PKG_SOURCE)
66
+endef
67
+
68
+define Build/InstallDev
69
+	$(INSTALL_DIR) $(1)/usr/{bin,include}
70
+	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
71
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsearpc.so* $(1)/usr/lib/
72
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/searpc* $(1)/usr/include/
73
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libsearpc.pc $(1)/usr/lib/pkgconfig/
74
+	$(CP) $(PKG_INSTALL_DIR)/usr/bin/searpc-codegen.py $(1)/usr/bin/
75
+endef
76
+
77
+define Package/libsearpc/install
78
+	$(INSTALL_DIR) $(1)/usr/lib
79
+	$(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
80
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsearpc.so* $(1)/usr/lib/
81
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/pysearpc $(1)/usr/lib/python2.7/site-packages/
82
+endef
83
+
84
+$(eval $(call BuildPackage,libsearpc))

+ 81
- 0
net/seafile-ccnet/Makefile Переглянути файл

@@ -0,0 +1,81 @@
1
+#
2
+# Copyright (C) 2007-2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=seafile-ccnet
11
+PKG_VERSION:=3.1.7
12
+PKG_RELEASE:=1
13
+PKG_LICENSE:=GPL-3.0
14
+
15
+PKG_BUILD_DIR:=$(BUILD_DIR)/ccnet-$(PKG_VERSION)-server
16
+PKG_SOURCE:=v$(PKG_VERSION)-server.tar.gz
17
+PKG_SOURCE_URL:=https://github.com/haiwen/ccnet/archive/
18
+PKG_MD5SUM:=ed6d58bcce31d33847f536d129cfb404
19
+PKG_CAT:=zcat
20
+PKG_FIXUP:=autoreconf
21
+PKG_INSTALL:=1
22
+
23
+include $(INCLUDE_DIR)/package.mk
24
+include $(INCLUDE_DIR)/nls.mk
25
+
26
+define Package/seafile-ccnet
27
+    SECTION:=net
28
+    CATEGORY:=Network
29
+    TITLE:=Seafile server - ccnet component
30
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
31
+    URL:=http://seafile.com/
32
+    DEPENDS:=+libsearpc +libevent2 +libopenssl \
33
+		+glib2 +python +libzdb +libuuid \
34
+		+libpthread +libsqlite3 +jansson $(ICONV_DEPENDS)
35
+endef
36
+
37
+define Package/seafile-ccnet/description
38
+   Ccnet is a framework for writing networked applications in C.
39
+endef
40
+
41
+CONFIGURE_ARGS += --disable-client \
42
+		    --enable-server \
43
+		    --disable-ldap \
44
+		    --disable-cluster \
45
+		    --enable-python \
46
+		    --disable-server-pkg \
47
+		    --disable-static-build \
48
+		    --disable-compile-demo \
49
+		    --disable-console
50
+
51
+PKG_BUILD_DEPENDS:=vala/host \
52
+		   libsearpc/host
53
+
54
+Hooks/Prepare/Post += delete_source_package
55
+
56
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
57
+		    -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
58
+
59
+define delete_source_package
60
+	# deleting downloaded source package as its filename is ambiguous
61
+	rm -f $(DL_DIR)/$(PKG_SOURCE)
62
+endef
63
+
64
+define Package/seafile-ccnet/install
65
+	$(INSTALL_DIR) $(1)/usr/{bin,lib}
66
+	$(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
67
+	$(CP) $(PKG_INSTALL_DIR)/usr/bin/ccnet* $(1)/usr/bin/
68
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/ccnet $(1)/usr/lib/python2.7/site-packages/
69
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/
70
+endef
71
+
72
+define Build/InstallDev
73
+	$(INSTALL_DIR) $(1)/usr/include
74
+	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
75
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/ccnet* $(1)/usr/include/
76
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libccnet.pc $(1)/usr/lib/pkgconfig/
77
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.a $(1)/usr/lib/
78
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/
79
+endef
80
+
81
+$(eval $(call BuildPackage,seafile-ccnet))

+ 82
- 0
net/seafile-seahub/Makefile Переглянути файл

@@ -0,0 +1,82 @@
1
+#
2
+# Copyright (C) 2007-2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=seafile-seahub
11
+PKG_VERSION:=3.1.7
12
+PKG_RELEASE:=1
13
+PKG_LICENSE:=Apache-2.0
14
+
15
+PKG_BUILD_DIR:=$(BUILD_DIR)/seahub-$(PKG_VERSION)-server
16
+PKG_SOURCE:=v$(PKG_VERSION)-server.tar.gz
17
+PKG_SOURCE_URL:=https://github.com/haiwen/seahub/archive/
18
+PKG_MD5SUM:=d019b7171ed23817025cba55554b90d9
19
+PKG_CAT:=zcat
20
+
21
+include $(INCLUDE_DIR)/package.mk
22
+
23
+define Package/seafile-seahub
24
+    SECTION:=net
25
+    CATEGORY:=Network
26
+    TITLE:=Seafile server - seahub component
27
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
28
+    URL:=http://seafile.com/
29
+    DEPENDS:=+python +simplejson +python-imglib +python-setuptools
30
+endef
31
+
32
+define Package/seafile-seahub/description
33
+   The web end of seafile server.
34
+
35
+   NOTE: in order to have better performance, language support is turned off by default.
36
+   Please set 'USE_I18N = True' in seahub_settings.py to support multiple languages.
37
+endef
38
+
39
+PKG_BUILD_DEPENDS:=python-setuptools
40
+Hooks/Prepare/Post += delete_source_package
41
+
42
+define delete_source_package
43
+	# deleting downloaded source package as its filename is ambiguous
44
+	rm -f $(DL_DIR)/$(PKG_SOURCE)
45
+endef
46
+
47
+define Build/Configure
48
+endef
49
+
50
+define Build/Compile
51
+endef
52
+
53
+define Package/seafile-seahub/install
54
+	$(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/seahub
55
+	$(CP) $(PKG_BUILD_DIR)/{locale,media,seahub,sql,subdomain,tests,thirdpart,tools} $(1)/usr/share/seafile/seafile-server/seahub/
56
+	$(CP) $(PKG_BUILD_DIR)/*.{sh,template,py,txt} $(1)/usr/share/seafile/seafile-server/seahub/
57
+	$(CP) $(PKG_BUILD_DIR)/{CONTRIBUTORS,HACKING,README.markdown} $(1)/usr/share/seafile/seafile-server/seahub/
58
+	$(CP) $(PKG_BUILD_DIR)/pylintrc* $(1)/usr/share/seafile/seafile-server/seahub/
59
+	# Installing python dependencies
60
+	export PYTHONPATH="$(1)/usr/share/seafile/seafile-server/seahub/thirdpart:$(STAGING_DIR)/$(PYTHON_PKG_DIR)"; \
61
+	export PYTHONOPTIMIZE=""; \
62
+	export PYTHONDONTWRITEBYTECODE=1; \
63
+	    easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://www.djangoproject.com/m/releases/1.5/Django-1.5.8.tar.gz; \
64
+	    easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z -N https://github.com/djblets/djblets/archive/release-0.6.14.tar.gz; \
65
+	    easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/g/gunicorn/gunicorn-0.16.1.tar.gz; \
66
+	    easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/s/six/six-1.4.1.tar.gz; \
67
+	    easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/c/chardet/chardet-2.1.1.tar.gz; \
68
+	    easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/2.6/f/flup/flup-1.0.2-py2.6.egg; \
69
+	    easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/l/lockfile/lockfile-0.9.1.tar.gz; \
70
+	    easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/p/python-daemon/python-daemon-1.5.5.tar.gz; \
71
+	    easy_install -d $(1)/usr/share/seafile/seafile-server/seahub/thirdpart -Z https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-1.5.tar.gz
72
+	    # fix python exec path in scripts
73
+	    sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/env python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/chardetect.py
74
+	    sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/env python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/django-admin.py
75
+	    sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/env python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/gunicorn
76
+	    sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/env python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/gunicorn_django
77
+	    sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/env python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/gunicorn_paster
78
+	find $(PKG_BUILD_DIR) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f
79
+	sed -i "s/\(SEAFILE_VERSION\s*=\s*\)'\([0-9]\.[0-9]\.[0-9]\)'/\1'$(PKG_VERSION)'/g" $(1)/usr/share/seafile/seafile-server/seahub/seahub/settings.py
80
+endef
81
+
82
+$(eval $(call BuildPackage,seafile-seahub))

+ 30
- 0
net/seafile-seahub/patches/010-default-config.patch Переглянути файл

@@ -0,0 +1,30 @@
1
+diff -rupN seahub-3.1.7-server.orig/seahub/settings.py seahub-3.1.7-server/seahub/settings.py
2
+--- seahub-3.1.7-server.orig/seahub/settings.py	2014-10-20 09:32:35.000000000 +0200
3
++++ seahub-3.1.7-server/seahub/settings.py	2014-12-10 15:47:21.625104606 +0100
4
+@@ -46,7 +46,7 @@ SITE_ID = 1
5
+ 
6
+ # If you set this to False, Django will make some optimizations so as not
7
+ # to load the internationalization machinery.
8
+-USE_I18N = True
9
++USE_I18N = False
10
+ 
11
+ # If you set this to False, Django will not format dates, numbers and
12
+ # calendars according to the current locale.
13
+@@ -209,7 +209,7 @@ SHOW_REPO_DOWNLOAD_BUTTON = False
14
+ REPO_PASSWORD_MIN_LENGTH = 8
15
+ 
16
+ # mininum length for user's password
17
+-USER_PASSWORD_MIN_LENGTH = 6
18
++USER_PASSWORD_MIN_LENGTH = 8
19
+ 
20
+ # LEVEL based on four types of input:
21
+ # num, upper letter, lower letter, other symbols
22
+@@ -218,7 +218,7 @@ USER_PASSWORD_STRENGTH_LEVEL = 3
23
+ 
24
+ # default False, only check USER_PASSWORD_MIN_LENGTH
25
+ # when True, check password strength level, STRONG(or above) is allowed
26
+-USER_STRONG_PASSWORD_REQUIRED = False
27
++USER_STRONG_PASSWORD_REQUIRED = True
28
+ 
29
+ # Using server side crypto by default, otherwise, let user choose crypto method.
30
+ FORCE_SERVER_CRYPTO = True

+ 123
- 0
net/seafile-server/Makefile Переглянути файл

@@ -0,0 +1,123 @@
1
+#
2
+# Copyright (C) 2007-2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=seafile-server
11
+PKG_VERSION:=3.1.7
12
+PKG_RELEASE:=1
13
+PKG_LICENSE:=GPL-3.0
14
+
15
+PKG_BUILD_DIR:=$(BUILD_DIR)/seafile-$(PKG_VERSION)-server
16
+PKG_SOURCE:=v$(PKG_VERSION)-server.tar.gz
17
+PKG_SOURCE_URL:=https://github.com/haiwen/seafile/archive/
18
+PKG_MD5SUM:=af35324998b6c98fe1442d5d775871ee
19
+PKG_CAT:=zcat
20
+PKG_FIXUP:=autoreconf
21
+PKG_INSTALL:=1
22
+
23
+include $(INCLUDE_DIR)/package.mk
24
+include $(INCLUDE_DIR)/nls.mk
25
+
26
+define Package/seafile-server
27
+    SECTION:=net
28
+    CATEGORY:=Network
29
+    TITLE:=Seafile server
30
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
31
+    URL:=http://seafile.com/
32
+    DEPENDS:=+shadow-useradd +libarchive +libopenssl +glib2 +seafile-ccnet +libsearpc +sqlite3-cli +python-mysql \
33
+		+jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 +libmysqlclient +libevhtp \
34
+		+libpthread +libuuid +seafile-seahub +bash +sudo +procps +procps-pkill $(ICONV_DEPENDS)
35
+endef
36
+
37
+define Package/seafile-server/description
38
+   Open source cloud storage with advanced features on privacy protection and teamwork.
39
+endef
40
+
41
+CONFIGURE_ARGS += --disable-riak \
42
+		    --disable-client \
43
+		    --disable-fuse \
44
+		    --enable-server \
45
+		    --enable-python \
46
+		    --disable-static-build \
47
+		    --disable-server-pkg \
48
+		    --disable-console
49
+
50
+PKG_BUILD_DEPENDS:=vala/host \
51
+		    libsearpc/host
52
+
53
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
54
+		    -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
55
+
56
+Hooks/Prepare/Post += delete_source_package
57
+
58
+define delete_source_package
59
+	# deleting downloaded source package as its filename is ambiguous
60
+	rm -f $(DL_DIR)/$(PKG_SOURCE)
61
+endef
62
+
63
+define Package/seafile-server/install
64
+	$(INSTALL_DIR) $(1)/usr/{bin,lib}
65
+	$(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
66
+	$(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/runtime
67
+	$(INSTALL_DIR) $(1)/etc/init.d
68
+	$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
69
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seafile/ $(1)/usr/lib/python2.7/site-packages/
70
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seaserv/ $(1)/usr/lib/python2.7/site-packages/
71
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
72
+	$(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
73
+	$(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
74
+	$(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
75
+	$(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
76
+	$(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
77
+	$(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
78
+	$(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
79
+endef
80
+
81
+define Build/InstallDev
82
+	$(INSTALL_DIR) $(1)/usr/include
83
+	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
84
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
85
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
86
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
87
+endef
88
+
89
+define Package/seafile-server/postinst
90
+#!/bin/sh
91
+
92
+if ! id -u seafile >/dev/null 2>&1; then
93
+    useradd seafile -d "/usr/share/seafile" -s /bin/sh; fi
94
+
95
+chown -R seafile:seafile /usr/share/seafile/
96
+chmod -R o-rwx /usr/share/seafile/
97
+
98
+if [ ! -d "/usr/share/seafile/seafile-data" ]
99
+then
100
+   echo "*** Installation completed, running configuration script..."
101
+   /etc/init.d/seafile setup
102
+
103
+   if [ $$? -ne 0 ]
104
+   then
105
+      echo
106
+      echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
107
+      echo "*** \"/etc/init.d/seafile setup\""
108
+   fi
109
+echo
110
+echo "*** NOTE: you need to create an admin account before using Seafile."
111
+echo "*** Please run \"/etc/init.d/seafile create_admin\" to do so."
112
+fi
113
+
114
+/etc/init.d/seafile enable
115
+/etc/init.d/seafile restart
116
+endef
117
+
118
+define Package/seafile-server/prerm
119
+#!/bin/sh
120
+/etc/init.d/seafile stop
121
+endef
122
+
123
+$(eval $(call BuildPackage,seafile-server))

+ 46
- 0
net/seafile-server/files/seafile.init Переглянути файл

@@ -0,0 +1,46 @@
1
+#!/bin/sh /etc/rc.common
2
+
3
+START=99
4
+APP=seafile
5
+EXTRA_HELP="	setup	Runs the setup script
6
+	create_admin	Creates the administrative login
7
+	reset_admin	Alias to create_admin"
8
+EXTRA_COMMANDS="setup create_admin reset_admin"
9
+
10
+export PATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PATH"
11
+export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH"
12
+
13
+start() {
14
+	if [ ! -d /var/run/seafile ]
15
+	then
16
+	    mkdir /var/run/seafile
17
+	    chown seafile:seafile /var/run/seafile
18
+	    chmod o-rwx /var/run/seafile
19
+	fi
20
+
21
+	cd "/usr/share/seafile" && \
22
+	    sudo PYTHONPATH="$PYTHONPATH" -u seafile -E \
23
+	    "/usr/bin/seafile-admin" start
24
+}
25
+
26
+stop() {
27
+	cd "/usr/share/seafile" && \
28
+	    sudo PYTHONPATH="$PYTHONPATH" -u seafile -E \
29
+	    "/usr/bin/seafile-admin" stop
30
+}
31
+
32
+setup() {
33
+	cd "/usr/share/seafile" && \
34
+	    sudo PYTHONPATH="$PYTHONPATH" -u seafile -E \
35
+	    "/usr/bin/seafile-admin" setup
36
+}
37
+
38
+create_admin() {
39
+	cd "/usr/share/seafile" && \
40
+	    sudo PYTHONPATH="$PYTHONPATH" -u seafile -E \
41
+	    "/usr/bin/seafile-admin" create-admin
42
+}
43
+
44
+reset_admin() {
45
+	create_admin
46
+}

+ 12
- 0
net/seafile-server/patches/010-makefile-fix.patch Переглянути файл

@@ -0,0 +1,12 @@
1
+diff -rupN seafile-3.1.7-server.orig/fileserver/Makefile.am seafile-3.1.7-server/fileserver/Makefile.am
2
+--- seafile-3.1.7-server.orig/fileserver/Makefile.am	2014-10-16 05:30:04.000000000 +0200
3
++++ seafile-3.1.7-server/fileserver/Makefile.am	2014-12-08 00:16:44.289364980 +0100
4
+@@ -6,7 +6,7 @@ AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir)
5
+ 	-I$(top_srcdir)/lib \
6
+ 	-I$(top_builddir)/lib \
7
+ 	-I$(top_srcdir)/common \
8
+-	-I$(includedir) \
9
++	-I$(STAGING_DIR)$(includedir) \
10
+ 	@CCNET_CFLAGS@ \
11
+ 	@SEARPC_CFLAGS@ \
12
+ 	@GLIB2_CFLAGS@ \

+ 40
- 0
net/seafile-server/patches/020-script-patches.patch Переглянути файл

@@ -0,0 +1,40 @@
1
+diff -rupN seafile-3.1.7-server.orig/scripts/seaf-gc.sh seafile-3.1.7-server/scripts/seaf-gc.sh
2
+--- seafile-3.1.7-server.orig/scripts/seaf-gc.sh	2014-10-16 05:30:04.000000000 +0200
3
++++ seafile-3.1.7-server/scripts/seaf-gc.sh	2014-12-13 00:51:12.919136978 +0100
4
+@@ -6,11 +6,10 @@ SCRIPT=$(readlink -f "$0")
5
+ INSTALLPATH=$(dirname "${SCRIPT}")
6
+ TOPDIR=$(dirname "${INSTALLPATH}")
7
+ default_ccnet_conf_dir=${TOPDIR}/ccnet
8
+-seaf_gc=${INSTALLPATH}/seafile/bin/seafserv-gc
9
++seaf_gc=/usr/bin/seafserv-gc
10
+ seaf_gc_opts=""
11
+ 
12
+-export PATH=${INSTALLPATH}/seafile/bin:$PATH
13
+-export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
14
++export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH"
15
+ 
16
+ script_name=$0
17
+ function usage () {
18
+@@ -78,9 +77,7 @@ function run_seaf_gc () {
19
+ 
20
+     echo "Starting seafserv-gc, please wait ..."
21
+ 
22
+-    LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_gc} \
23
+-        -c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}" \
24
+-        ${seaf_gc_opts}
25
++    ${seaf_gc} -c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}" ${seaf_gc_opts}
26
+ 
27
+     echo "seafserv-gc run done"
28
+     echo
29
+diff -rupN seafile-3.1.7-server.orig/scripts/setup-seafile-mysql.sh seafile-3.1.7-server/scripts/setup-seafile-mysql.sh
30
+--- seafile-3.1.7-server.orig/scripts/setup-seafile-mysql.sh	2014-10-16 05:30:04.000000000 +0200
31
++++ seafile-3.1.7-server/scripts/setup-seafile-mysql.sh	2014-12-13 00:51:49.242172631 +0100
32
+@@ -9,6 +9,8 @@ set -e
33
+ SCRIPT=$(readlink -f "$0")
34
+ INSTALLPATH=$(dirname "${SCRIPT}")
35
+ 
36
++export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH"
37
++
38
+ cd "$INSTALLPATH"
39
+ 
40
+ python_script=setup-seafile-mysql.py

+ 24
- 0
net/seafile-server/patches/030-pidfiles-in-same-directory.patch Переглянути файл

@@ -0,0 +1,24 @@
1
+diff -rupN seafile-3.1.7-server.orig/controller/seafile-controller.c seafile-3.1.7-server/controller/seafile-controller.c
2
+--- seafile-3.1.7-server.orig/controller/seafile-controller.c	2014-10-16 05:30:04.000000000 +0200
3
++++ seafile-3.1.7-server/controller/seafile-controller.c	2014-11-28 16:50:24.053674057 +0100
4
+@@ -21,7 +21,7 @@
5
+ 
6
+ SeafileController *ctl;
7
+ 
8
+-static char *controller_pidfile = NULL;
9
++static char *controller_pidfile = "/var/run/seafile/seafile-controller.pid";
10
+ 
11
+ char *bin_dir = NULL;
12
+ char *installpath = NULL;
13
+@@ -614,9 +614,9 @@ stop_ccnet_server ()
14
+ static void
15
+ init_pidfile_path (SeafileController *ctl)
16
+ {
17
+-    char *pid_dir = g_build_filename (topdir, "pids", NULL);
18
++    char *pid_dir = g_path_get_dirname (controller_pidfile);
19
+     if (!g_file_test(pid_dir, G_FILE_TEST_EXISTS)) {
20
+-        if (g_mkdir(pid_dir, 0777) < 0) {
21
++        if (g_mkdir(pid_dir, 0755) < 0) {
22
+             seaf_warning("failed to create pid dir %s: %s", pid_dir, strerror(errno));
23
+             controller_exit(1);
24
+         }

+ 53
- 0
net/seafile-server/patches/040-seafile-admin.patch Переглянути файл

@@ -0,0 +1,53 @@
1
+diff -rupN seafile-3.1.7-server.orig/tools/seafile-admin seafile-3.1.7-server/tools/seafile-admin
2
+--- seafile-3.1.7-server.orig/tools/seafile-admin	2014-10-16 05:30:04.000000000 +0200
3
++++ seafile-3.1.7-server/tools/seafile-admin	2014-12-12 12:09:00.703175935 +0100
4
+@@ -416,13 +416,15 @@ def create_gunicorn_conf():
5
+     content = '''\
6
+ import os
7
+ daemon = True
8
+-workers = 3
9
++workers = 1
10
++threads = 3
11
+ 
12
+ # Logging
13
+ runtime_dir = os.path.dirname(__file__)
14
+-pidfile = os.path.join(runtime_dir, 'seahub.pid')
15
++pidfile = '/var/run/seafile/seahub.pid'
16
+ errorlog = os.path.join(runtime_dir, 'error.log')
17
+-accesslog = os.path.join(runtime_dir, 'access.log')
18
++# uncomment if you need access logging (works only in fastcgi mode)
19
++#accesslog = os.path.join(runtime_dir, 'access.log')
20
+ '''
21
+     try:
22
+         with open(confpath, 'w') as fp:
23
+@@ -607,6 +609,7 @@ def start_seahub_gunicorn():
24
+         'gunicorn_django',
25
+         '-c', conf[CONF_SEAHUB_CONF],
26
+         '-b', '0.0.0.0:%s' % conf[CONF_SEAHUB_PORT],
27
++        '-t', '120',
28
+     ]
29
+ 
30
+     info('Starting seahub...')
31
+@@ -738,10 +741,9 @@ def setup_seafile(args):
32
+     print '-----------------------------------------------------------------'
33
+     print '-----------------------------------------------------------------'
34
+     print
35
+-    print 'To start/stop seafile server:'
36
++    print 'To start, stop or restart seafile server, please run as root:'
37
+     print
38
+-    print highlight('         $ cd %s' % cwd)
39
+-    print highlight('         $ %s { start | stop }' % SCRIPT_NAME)
40
++    print highlight('         # /etc/init.d/seafile { start | stop | restart }')
41
+     print
42
+     print 'If you have any problem, refer to\n'
43
+     print
44
+@@ -802,8 +804,7 @@ def start_seafile(args):
45
+ def stop_seafile(dummy):
46
+     info('Stopping seafile server')
47
+     pkill('seafile-controller')
48
+-    runtime_dir = os.path.join(cwd, 'seafile-server', 'runtime')
49
+-    pidfile = os.path.join(runtime_dir, 'seahub.pid')
50
++    pidfile = '/var/run/seafile/seahub.pid'
51
+     try:
52
+         with open(pidfile, 'r') as fp:
53
+             pid = fp.read().strip('\n ')