mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Add sources
This commit is contained in:
parent
a65a1045f6
commit
2e47976ec5
5406 changed files with 1041073 additions and 38 deletions
|
@ -1 +1 @@
|
||||||
Seafile 3.0.4 32bit packaged for Yunohost
|
Seafile 3.1.1 64bit packaged for Yunohost
|
|
@ -4,5 +4,4 @@ location PATHTOCHANGE {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
client_max_body_size 10G;
|
client_max_body_size 10G;
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,7 +18,8 @@
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a domain for Seafile"
|
"en": "Choose a domain for Seafile"
|
||||||
},
|
},
|
||||||
"example": "domain.org"
|
"example": "domain.org",
|
||||||
|
"default": "wireynh2.mikangali.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
|
final_path=/var/www/seafile
|
||||||
|
seafile_version=3.1.1
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a seafile
|
sudo yunohost app checkurl $domain$path -a seafile
|
||||||
|
@ -10,45 +11,33 @@ if [[ ! $? -eq 0 ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check dependencies
|
# Check dependencies
|
||||||
sudo apt-get install -y python2.7 python-setuptools python-simplejson python-imaging python-mysqldb
|
sudo apt-get install -y python2.7 python-setuptools python-simplejson python-imaging sqlite3
|
||||||
|
|
||||||
# Generate random DES key & password
|
|
||||||
deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
|
||||||
db_pwd_ccnet=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
|
||||||
db_pwd_seafile=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
|
||||||
db_pwd_seahub=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
|
||||||
|
|
||||||
# Use same database name and user
|
|
||||||
db_user_ccnet=seafile_ccnet
|
|
||||||
db_user_seafile=seafile_seafile
|
|
||||||
db_user_seahub=seafile_seahub
|
|
||||||
|
|
||||||
# Initialize databases and store mysql password for upgrade
|
|
||||||
sudo yunohost app initdb $seafile_ccnet -p $db_pwd -s $(readlink -e ../conf/SQL/ccnet_mysql.initial.sql)
|
|
||||||
sudo yunohost app setting seafile mysqlpwd_ccnet -v $db_pwd_ccnet
|
|
||||||
|
|
||||||
sudo yunohost app initdb $db_user_seafile -p $db_pwd -s $(readlink -e ../conf/SQL/seafile_mysql.initial.sql)
|
|
||||||
sudo yunohost app setting seafile mysqlpwd_seafile -v $db_pwd_seafile
|
|
||||||
|
|
||||||
sudo yunohost app initdb $seafile_seahub -p $db_pwd -s $(readlink -e ../conf/SQL/seahub_mysql.initial.sql)
|
|
||||||
sudo yunohost app setting seafile mysqlpwd_seahub -v $db_pwd_seahub
|
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
final_path=/var/www/seafile
|
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
sudo wget https://bitbucket.org/haiwen/seafile/downloads/seafile-server_3.0.4_i386.tar.gz
|
sudo cp -R ../sources/* $final_path/
|
||||||
sudo tar xvzf seafile-server_*.tar.gz
|
|
||||||
sudo rm seafile-*.tar.gz
|
|
||||||
cd seafile-server-*
|
|
||||||
|
|
||||||
# Set permissions to roundcube directory
|
# Set permissions to seafile directory
|
||||||
sudo chown -R www-data: $final_path
|
#sudo chown -R www-data: $final_path
|
||||||
|
sudo chmod +x $final_path/seafile-server-$seafile_version/seafile.sh
|
||||||
|
|
||||||
|
# Change configuration
|
||||||
|
# Port
|
||||||
|
# Domain
|
||||||
|
# Admin account
|
||||||
|
|
||||||
|
# Add Seafile Server to startup
|
||||||
|
# TODO
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/seafile.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/seafile.conf
|
||||||
|
|
||||||
|
# Start Seafile Server
|
||||||
|
cd $final_path/seafile-server-*
|
||||||
|
sudo ./seafile.sh start
|
||||||
|
sudo ./seahub.sh start
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
db_user=seafile
|
|
||||||
db_name=seafile
|
|
||||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
|
||||||
domain=$(sudo yunohost app setting seafile domain)
|
domain=$(sudo yunohost app setting seafile domain)
|
||||||
|
|
||||||
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
cd /var/www/seafile/seafile-server-*
|
||||||
|
sudo ./seafile.sh stop
|
||||||
|
sudo ./seahub.sh stop
|
||||||
|
|
||||||
sudo rm -rf /var/www/seafile
|
sudo rm -rf /var/www/seafile
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/seafile.conf
|
sudo rm -f /etc/nginx/conf.d/$domain.d/seafile.conf
|
BIN
sources/ccnet/GroupMgr/groupmgr.db
Normal file
BIN
sources/ccnet/GroupMgr/groupmgr.db
Normal file
Binary file not shown.
BIN
sources/ccnet/OrgMgr/orgmgr.db
Normal file
BIN
sources/ccnet/OrgMgr/orgmgr.db
Normal file
Binary file not shown.
BIN
sources/ccnet/PeerMgr/usermgr.db
Normal file
BIN
sources/ccnet/PeerMgr/usermgr.db
Normal file
Binary file not shown.
11
sources/ccnet/ccnet.conf
Normal file
11
sources/ccnet/ccnet.conf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[General]
|
||||||
|
USER_NAME = Yunohost
|
||||||
|
ID = c1ee2e49c1517ee297a25f3bad4c674341956b9c
|
||||||
|
NAME = Yunohost
|
||||||
|
SERVICE_URL = http://wireynh2.mikangali.com:8000
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
PORT = 10001
|
||||||
|
|
||||||
|
[Client]
|
||||||
|
PORT = 13418
|
0
sources/ccnet/ccnet.db
Normal file
0
sources/ccnet/ccnet.db
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
peer/c1ee2e49c1517ee297a25f3bad4c674341956b9c
|
||||||
|
name Yunohost
|
||||||
|
service-url http://wireynh2.mikangali.com:8000
|
||||||
|
pubkey 40K2tAhc2dcQU68MCU+zX3+fzJCZwCMbIcWahbfaBDEue684qPXO7Tr19WSJQvKHmZc/fpYUKQNFPM9r471cqPHhfzhatdI8SkZw/w8sORmif1S9EHxSoxDxEzafCR9efqPQejbu4fe64muhyeACIL0ru0hZNqdRGu/BjWldMIwz/WdPqqQnp4ghCH/sndYr34u52V+vnkMiTOR9tlUHZzl9TAz/LffnGBwN29gCxg43ZG+f7WhWVpap7Kb7HN91aIEMoW3EZgLMF2GsWfc2jxxaB3Q1xKYPMlU2gOlGez1/QOp7qz4CDb4ohl+lIhKaa6LDxL3zgu7/RLMsVkaJkw== Iw==
|
BIN
sources/ccnet/misc/config.db
Normal file
BIN
sources/ccnet/misc/config.db
Normal file
Binary file not shown.
27
sources/ccnet/mykey.peer
Normal file
27
sources/ccnet/mykey.peer
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEogIBAAKCAQEA40K2tAhc2dcQU68MCU+zX3+fzJCZwCMbIcWahbfaBDEue684
|
||||||
|
qPXO7Tr19WSJQvKHmZc/fpYUKQNFPM9r471cqPHhfzhatdI8SkZw/w8sORmif1S9
|
||||||
|
EHxSoxDxEzafCR9efqPQejbu4fe64muhyeACIL0ru0hZNqdRGu/BjWldMIwz/WdP
|
||||||
|
qqQnp4ghCH/sndYr34u52V+vnkMiTOR9tlUHZzl9TAz/LffnGBwN29gCxg43ZG+f
|
||||||
|
7WhWVpap7Kb7HN91aIEMoW3EZgLMF2GsWfc2jxxaB3Q1xKYPMlU2gOlGez1/QOp7
|
||||||
|
qz4CDb4ohl+lIhKaa6LDxL3zgu7/RLMsVkaJkwIBIwKCAQB04Hs4BE0CUVjalInY
|
||||||
|
5ykMisc2ATkg/ByVBon7oGF+f7GBcA6Cx479qUtLAIEbHaTSpY5eW8/ak/e437PU
|
||||||
|
NYAcXyODQY28mAG/zHSgbjQAG8/pto0ea9K6QzonI2e7jHm9eNGd8F2YyIv/ao24
|
||||||
|
R1GNLhZ9kuwNep69ZVw6GO4Y9q0yFykeE/XVxP5DVptnJNv/bJ0LvJ8YyN92vxJn
|
||||||
|
qsiu3v8cO+kcT8v4cudJcL1xy31ig1V1eSiNRc3qq+wQJi6cSufv+OPPzf2DpHNG
|
||||||
|
3J1vTCYDZJSgocXCn5msVwHUVdI18Lxam3HST9yCUxOAFlL7R6hcFtwtctzDAor4
|
||||||
|
5p7rAoGBAP+jimy8z7TEBGtivDxnqcLL1/5fm4KeNrVIOXmxBOn2uj20BFbRljHi
|
||||||
|
Lwc+2Qb/TQj3pEAc7HyJ0X/4sS1altIMSX8JJrk6JtEUTLPeMkFQyLWet4sLWKqu
|
||||||
|
OZgmT19Xa+8mnVgHBtBl8Yxt5z7lWyqMLpWwXrM8DrS9Imv1iTubAoGBAOOU6L2l
|
||||||
|
H2o1oRyUm0kmgS8U0lE4RzCIvrqBU+50oHrHIvo2d7hscTbS1Laqo8RNCtcQzADB
|
||||||
|
ZZkr2eCrp4K/U7qBpecMxqWJko4RVTTHUN+QlOi3eRfyvYBtOp42KZx4uOkjMe5J
|
||||||
|
XkYdFOEbD8BR4Vy99xFhTz7SDyt+KEBgUjVpAoGBAPhVuat1lpJYBEsPdQd6pOkd
|
||||||
|
yoITu6N1HzPCgPnfKVhOw4xluxKCdKV8oraU0tOY67+Revxz3mpZ/rbUVFfxmdNc
|
||||||
|
ZKdKt+cijBuQD/8vnoiXnmdJuZ0DtTgW9h7GITgLx++h2q1Ip4idi4+7OGj8D2sp
|
||||||
|
F0+VY08HJDqL2EueEEiHAoGAdQrA1o9vPe+x8XD/Z3LjWgq1Tld1EaVpZzsyeqJh
|
||||||
|
KTM2j082QZbbI4JexFfB7+0bhIxLqJ35vHzztV+X+hlBANT2PE+2nkbAZlIOkCv9
|
||||||
|
tM4DcF5biKi5OrvVAOinr46K+45xczus05ntexU7TPbo7d4KCPA3YiLjOvBseOEU
|
||||||
|
VfsCgYEA/xsbL2d9HfXnHUMzXSbFuBDHQndwnXZrz9W5gSq4N4N/ZyEtUbytBYsI
|
||||||
|
VFYwn4edPNTk8ye6bw/WMGlMS/YM0zFqcwPoIxCzipz9jRoHmaUBYmdm9R5OLmhG
|
||||||
|
980RjA9eDt0qO+jROHMCdfoc4owPg6DeqxC9G14kSJFkh5qKKZQ=
|
||||||
|
-----END RSA PRIVATE KEY-----
|
1
sources/ccnet/seafile.ini
Normal file
1
sources/ccnet/seafile.ini
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/var/www/seafile/seafile-data
|
5
sources/conf/seafdav.conf
Normal file
5
sources/conf/seafdav.conf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[WEBDAV]
|
||||||
|
enabled = false
|
||||||
|
port = 8080
|
||||||
|
fastcgi = false
|
||||||
|
share_name = /
|
BIN
sources/installed/seafile-server_3.1.1_x86-64.tar
Normal file
BIN
sources/installed/seafile-server_3.1.1_x86-64.tar
Normal file
Binary file not shown.
9
sources/logs/ccnet.log
Normal file
9
sources/logs/ccnet.log
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[08/06/14 22:20:03] ../common/session.c(385): Listen on 127.0.0.1 13418
|
||||||
|
[08/06/14 22:20:03] ../common/session.c(257): Update pubinfo file
|
||||||
|
[08/06/14 22:20:03] ../common/connect-mgr.c(515): Opened port 10001 to listen for incoming peer connections
|
||||||
|
[08/06/14 22:20:04] ../common/session.c(365): Accepted a local client
|
||||||
|
[08/06/14 22:20:04] ../common/session.c(365): Accepted a local client
|
||||||
|
[08/06/14 22:20:04] ../common/session.c(365): Accepted a local client
|
||||||
|
[08/06/14 22:20:04] ../common/session.c(365): Accepted a local client
|
||||||
|
[08/06/14 22:20:13] ../common/session.c(365): Accepted a local client
|
||||||
|
[08/06/14 22:20:38] ../common/peer.c(942): Local peer down
|
15
sources/logs/controller.log
Normal file
15
sources/logs/controller.log
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[08/06/14 22:20:03] seafile-controller.c(155): starting ccnet-server ...
|
||||||
|
[08/06/14 22:20:03] seafile-controller.c(74): spawn_process: ccnet-server -c /var/www/seafile/ccnet -f /var/www/seafile/logs/ccnet.log -d -P /var/www/seafile/pids/ccnet.pid
|
||||||
|
[08/06/14 22:20:03] seafile-controller.c(89): spawned ccnet-server, pid 8067
|
||||||
|
[08/06/14 22:20:04] seafile-controller.c(594): ccnet daemon connected.
|
||||||
|
[08/06/14 22:20:04] seafile-controller.c(186): starting seaf-server ...
|
||||||
|
[08/06/14 22:20:04] seafile-controller.c(74): spawn_process: seaf-server -c /var/www/seafile/ccnet -d /var/www/seafile/seafile-data -l /var/www/seafile/logs/seafile.log -P /var/www/seafile/pids/seaf-server.pid
|
||||||
|
[08/06/14 22:20:04] seafile-controller.c(89): spawned seaf-server, pid 8071
|
||||||
|
[08/06/14 22:20:04] seafile-controller.c(423): pid file /var/www/seafile/pids/fileserver.pid does not exist
|
||||||
|
[08/06/14 22:20:04] seafile-controller.c(74): spawn_process: fileserver -c /var/www/seafile/ccnet -d /var/www/seafile/seafile-data -l /var/www/seafile/logs/fileserver.log -P /var/www/seafile/pids/fileserver.pid
|
||||||
|
[08/06/14 22:20:04] seafile-controller.c(89): spawned fileserver, pid 8072
|
||||||
|
[08/06/14 22:20:04] seafile-controller.c(567): seafdav not enabled.
|
||||||
|
[08/06/14 22:20:14] seafile-controller.c(423): pid file /var/www/seafile/pids/fileserver.pid does not exist
|
||||||
|
[08/06/14 22:20:14] seafile-controller.c(448): fileserver need restart...
|
||||||
|
[08/06/14 22:20:14] seafile-controller.c(74): spawn_process: fileserver -c /var/www/seafile/ccnet -d /var/www/seafile/seafile-data -l /var/www/seafile/logs/fileserver.log -P /var/www/seafile/pids/fileserver.pid
|
||||||
|
[08/06/14 22:20:14] seafile-controller.c(89): spawned fileserver, pid 8092
|
3
sources/logs/fileserver.log
Normal file
3
sources/logs/fileserver.log
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[08/06/14 22:20:04] Seafile tmp dir /var/www/seafile/seafile-data/tmpfiles does not exist and is unable to create
|
||||||
|
[08/06/14 22:20:04] Failed to create seafile session.
|
||||||
|
[08/06/14 22:20:14] fileserver.c(337): host = 0.0.0.0, port = 8082
|
3
sources/logs/seafile.log
Normal file
3
sources/logs/seafile.log
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[08/06/14 22:20:05] ../common/mq-mgr.c(60): [mq client] mq cilent is started
|
||||||
|
[08/06/14 22:20:05] ../common/mq-mgr.c(106): [mq mgr] publish to hearbeat mq: seaf_server.heartbeat
|
||||||
|
[08/06/14 22:20:05] listen-mgr.c(115): listen on port 12001 for block tranfer
|
0
sources/logs/seahub.log
Normal file
0
sources/logs/seahub.log
Normal file
0
sources/logs/seahub_django_request.log
Normal file
0
sources/logs/seahub_django_request.log
Normal file
1
sources/pids/ccnet.pid
Normal file
1
sources/pids/ccnet.pid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
8070
|
1
sources/pids/fileserver.pid
Normal file
1
sources/pids/fileserver.pid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
8093
|
1
sources/pids/seaf-server.pid
Normal file
1
sources/pids/seaf-server.pid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
8074
|
BIN
sources/seafile-data/library-template/seafile-tutorial.doc
Normal file
BIN
sources/seafile-data/library-template/seafile-tutorial.doc
Normal file
Binary file not shown.
5
sources/seafile-data/seafile.conf
Normal file
5
sources/seafile-data/seafile.conf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[network]
|
||||||
|
port=12001
|
||||||
|
|
||||||
|
[fileserver]
|
||||||
|
port=8082
|
BIN
sources/seafile-data/seafile.db
Normal file
BIN
sources/seafile-data/seafile.db
Normal file
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
{"description": "Added \"seafile-tutorial.doc\"", "root_id": "9831d33808cb73a85d4f56bdd6d767f85c4714a8", "no_local_history": 1, "repo_category": null, "commit_id": "033e4ead0ed10e2fbae39ed8b2a1785632553181", "repo_name": "My Library Template", "parent_id": "1f4714e629603dc5b0fc5c7ff7301d5cdbb54fcc", "repo_id": "4b859100-8af7-44f9-b6ed-aad56267a223", "creator_name": "System", "version": 1, "second_parent_id": null, "creator": "0000000000000000000000000000000000000000", "ctime": 1407378005, "repo_desc": "Template for creating 'My Libray' for users"}
|
|
@ -0,0 +1 @@
|
||||||
|
{"description": "Template for creating 'My Libray' for users", "root_id": "0000000000000000000000000000000000000000", "no_local_history": 1, "repo_category": null, "commit_id": "1f4714e629603dc5b0fc5c7ff7301d5cdbb54fcc", "repo_name": "My Library Template", "parent_id": null, "repo_id": "4b859100-8af7-44f9-b6ed-aad56267a223", "creator_name": "System", "version": 1, "second_parent_id": null, "creator": "0000000000000000000000000000000000000000", "ctime": 1407378005, "repo_desc": "Template for creating 'My Libray' for users"}
|
|
@ -0,0 +1 @@
|
||||||
|
xœ%ŒË E¥™µÊ£¥þ†KãdH&i‹4©Mÿ]ÀÕÜ99÷îà(âš\»ûäÊ«µ±Ó0J†^ .';9Þ{+¼áš)¦%çÃ`
œ:X‚ÃÒ¢×úÿ’'Œu涥ŒK“2-Õê%ŨS®¦1Hh<ÍxÎï"™ùâ³–}Ûr±¥<…äíÕH‰Œ‰ÂZ7<5A>5§7¥
|
|
@ -0,0 +1 @@
|
||||||
|
xœËA@0@ѫȬ-¦:r™2’† *ÄÝÕî¿ÅÀÏk?uaˆPg
8k5—(£F6•+=²-9Íc<C38D>DžE 2´y1Ü’.<2E>hˆ’<CB86>kûRž²Ç°.¿Þ„ŒŽ
|
371
sources/seafile-server-3.1.1/check_init_admin.py
Normal file
371
sources/seafile-server-3.1.1/check_init_admin.py
Normal file
|
@ -0,0 +1,371 @@
|
||||||
|
#coding: UTF-8
|
||||||
|
|
||||||
|
'''This script would check if there is admin, and prompt the user to create a new one if non exist'''
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import glob
|
||||||
|
import subprocess
|
||||||
|
import hashlib
|
||||||
|
import getpass
|
||||||
|
import uuid
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
from ConfigParser import ConfigParser
|
||||||
|
|
||||||
|
try:
|
||||||
|
import readline # pylint: disable=W0611
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
SERVER_MANUAL_HTTP = 'https://github.com/haiwen/seafile/wiki'
|
||||||
|
|
||||||
|
class Utils(object):
|
||||||
|
'''Groups all helper functions here'''
|
||||||
|
@staticmethod
|
||||||
|
def welcome():
|
||||||
|
'''Show welcome message'''
|
||||||
|
welcome_msg = '''\
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
This script will guide you to setup your seafile server using MySQL.
|
||||||
|
Make sure you have read seafile server manual at
|
||||||
|
|
||||||
|
%s
|
||||||
|
|
||||||
|
Press ENTER to continue
|
||||||
|
-----------------------------------------------------------------''' % SERVER_MANUAL_HTTP
|
||||||
|
print welcome_msg
|
||||||
|
raw_input()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def highlight(content):
|
||||||
|
'''Add ANSI color to content to get it highlighted on terminal'''
|
||||||
|
return '\x1b[33m%s\x1b[m' % content
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def info(msg):
|
||||||
|
print msg
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def error(msg):
|
||||||
|
'''Print error and exit'''
|
||||||
|
print
|
||||||
|
print 'Error: ' + msg
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run_argv(argv, cwd=None, env=None, suppress_stdout=False, suppress_stderr=False):
|
||||||
|
'''Run a program and wait it to finish, and return its exit code. The
|
||||||
|
standard output of this program is supressed.
|
||||||
|
|
||||||
|
'''
|
||||||
|
with open(os.devnull, 'w') as devnull:
|
||||||
|
if suppress_stdout:
|
||||||
|
stdout = devnull
|
||||||
|
else:
|
||||||
|
stdout = sys.stdout
|
||||||
|
|
||||||
|
if suppress_stderr:
|
||||||
|
stderr = devnull
|
||||||
|
else:
|
||||||
|
stderr = sys.stderr
|
||||||
|
|
||||||
|
proc = subprocess.Popen(argv,
|
||||||
|
cwd=cwd,
|
||||||
|
stdout=stdout,
|
||||||
|
stderr=stderr,
|
||||||
|
env=env)
|
||||||
|
return proc.wait()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmdline, cwd=None, env=None, suppress_stdout=False, suppress_stderr=False):
|
||||||
|
'''Like run_argv but specify a command line string instead of argv'''
|
||||||
|
with open(os.devnull, 'w') as devnull:
|
||||||
|
if suppress_stdout:
|
||||||
|
stdout = devnull
|
||||||
|
else:
|
||||||
|
stdout = sys.stdout
|
||||||
|
|
||||||
|
if suppress_stderr:
|
||||||
|
stderr = devnull
|
||||||
|
else:
|
||||||
|
stderr = sys.stderr
|
||||||
|
|
||||||
|
proc = subprocess.Popen(cmdline,
|
||||||
|
cwd=cwd,
|
||||||
|
stdout=stdout,
|
||||||
|
stderr=stderr,
|
||||||
|
env=env,
|
||||||
|
shell=True)
|
||||||
|
return proc.wait()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def prepend_env_value(name, value, env=None, seperator=':'):
|
||||||
|
'''prepend a new value to a list'''
|
||||||
|
if env is None:
|
||||||
|
env = os.environ
|
||||||
|
|
||||||
|
try:
|
||||||
|
current_value = env[name]
|
||||||
|
except KeyError:
|
||||||
|
current_value = ''
|
||||||
|
|
||||||
|
new_value = value
|
||||||
|
if current_value:
|
||||||
|
new_value += seperator + current_value
|
||||||
|
|
||||||
|
env[name] = new_value
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def must_mkdir(path):
|
||||||
|
'''Create a directory, exit on failure'''
|
||||||
|
try:
|
||||||
|
os.mkdir(path)
|
||||||
|
except OSError, e:
|
||||||
|
Utils.error('failed to create directory %s:%s' % (path, e))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def must_copy(src, dst):
|
||||||
|
'''Copy src to dst, exit on failure'''
|
||||||
|
try:
|
||||||
|
shutil.copy(src, dst)
|
||||||
|
except Exception, e:
|
||||||
|
Utils.error('failed to copy %s to %s: %s' % (src, dst, e))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def find_in_path(prog):
|
||||||
|
if 'win32' in sys.platform:
|
||||||
|
sep = ';'
|
||||||
|
else:
|
||||||
|
sep = ':'
|
||||||
|
|
||||||
|
dirs = os.environ['PATH'].split(sep)
|
||||||
|
for d in dirs:
|
||||||
|
d = d.strip()
|
||||||
|
if d == '':
|
||||||
|
continue
|
||||||
|
path = os.path.join(d, prog)
|
||||||
|
if os.path.exists(path):
|
||||||
|
return path
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_python_executable():
|
||||||
|
'''Return the python executable. This should be the PYTHON environment
|
||||||
|
variable which is set in setup-seafile-mysql.sh
|
||||||
|
|
||||||
|
'''
|
||||||
|
return os.environ['PYTHON']
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def read_config(fn):
|
||||||
|
'''Return a case sensitive ConfigParser by reading the file "fn"'''
|
||||||
|
cp = ConfigParser()
|
||||||
|
cp.optionxform = str
|
||||||
|
cp.read(fn)
|
||||||
|
|
||||||
|
return cp
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def write_config(cp, fn):
|
||||||
|
'''Return a case sensitive ConfigParser by reading the file "fn"'''
|
||||||
|
with open(fn, 'w') as fp:
|
||||||
|
cp.write(fp)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def ask_question(desc,
|
||||||
|
key=None,
|
||||||
|
note=None,
|
||||||
|
default=None,
|
||||||
|
validate=None,
|
||||||
|
yes_or_no=False,
|
||||||
|
password=False):
|
||||||
|
'''Ask a question, return the answer.
|
||||||
|
@desc description, e.g. "What is the port of ccnet?"
|
||||||
|
|
||||||
|
@key a name to represent the target of the question, e.g. "port for
|
||||||
|
ccnet server"
|
||||||
|
|
||||||
|
@note additional information for the question, e.g. "Must be a valid
|
||||||
|
port number"
|
||||||
|
|
||||||
|
@default the default value of the question. If the default value is
|
||||||
|
not None, when the user enter nothing and press [ENTER], the default
|
||||||
|
value would be returned
|
||||||
|
|
||||||
|
@validate a function that takes the user input as the only parameter
|
||||||
|
and validate it. It should return a validated value, or throws an
|
||||||
|
"InvalidAnswer" exception if the input is not valid.
|
||||||
|
|
||||||
|
@yes_or_no If true, the user must answer "yes" or "no", and a boolean
|
||||||
|
value would be returned
|
||||||
|
|
||||||
|
@password If true, the user input would not be echoed to the
|
||||||
|
console
|
||||||
|
|
||||||
|
'''
|
||||||
|
assert key or yes_or_no
|
||||||
|
# Format description
|
||||||
|
print
|
||||||
|
if note:
|
||||||
|
desc += '\n' + note
|
||||||
|
|
||||||
|
desc += '\n'
|
||||||
|
if yes_or_no:
|
||||||
|
desc += '[ yes or no ]'
|
||||||
|
else:
|
||||||
|
if default:
|
||||||
|
desc += '[ default "%s" ]' % default
|
||||||
|
else:
|
||||||
|
desc += '[ %s ]' % key
|
||||||
|
|
||||||
|
desc += ' '
|
||||||
|
while True:
|
||||||
|
# prompt for user input
|
||||||
|
if password:
|
||||||
|
answer = getpass.getpass(desc).strip()
|
||||||
|
else:
|
||||||
|
answer = raw_input(desc).strip()
|
||||||
|
|
||||||
|
# No user input: use default
|
||||||
|
if not answer:
|
||||||
|
if default:
|
||||||
|
answer = default
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Have user input: validate answer
|
||||||
|
if yes_or_no:
|
||||||
|
if answer not in ['yes', 'no']:
|
||||||
|
print Utils.highlight('\nPlease answer yes or no\n')
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
return answer == 'yes'
|
||||||
|
else:
|
||||||
|
if validate:
|
||||||
|
try:
|
||||||
|
return validate(answer)
|
||||||
|
except InvalidAnswer, e:
|
||||||
|
print Utils.highlight('\n%s\n' % e)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
return answer
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def validate_port(port):
|
||||||
|
try:
|
||||||
|
port = int(port)
|
||||||
|
except ValueError:
|
||||||
|
raise InvalidAnswer('%s is not a valid port' % Utils.highlight(port))
|
||||||
|
|
||||||
|
if port <= 0 or port > 65535:
|
||||||
|
raise InvalidAnswer('%s is not a valid port' % Utils.highlight(port))
|
||||||
|
|
||||||
|
return port
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidAnswer(Exception):
|
||||||
|
def __init__(self, msg):
|
||||||
|
Exception.__init__(self)
|
||||||
|
self.msg = msg
|
||||||
|
def __str__(self):
|
||||||
|
return self.msg
|
||||||
|
|
||||||
|
### END of Utils
|
||||||
|
####################
|
||||||
|
|
||||||
|
class RPC(object):
|
||||||
|
def __init__(self):
|
||||||
|
import ccnet
|
||||||
|
ccnet_dir = os.environ['CCNET_CONF_DIR']
|
||||||
|
self.rpc_client = ccnet.CcnetThreadedRpcClient(ccnet.ClientPool(ccnet_dir))
|
||||||
|
|
||||||
|
def get_db_email_users(self):
|
||||||
|
return self.rpc_client.get_emailusers('DB', 0, 1)
|
||||||
|
|
||||||
|
def create_admin(self, email, user):
|
||||||
|
return self.rpc_client.add_emailuser(email, user, 1, 1)
|
||||||
|
|
||||||
|
def need_create_admin():
|
||||||
|
users = rpc.get_db_email_users()
|
||||||
|
return len(users) == 0
|
||||||
|
|
||||||
|
def create_admin(email, passwd):
|
||||||
|
if rpc.create_admin(email, passwd) < 0:
|
||||||
|
raise Exception('failed to create admin')
|
||||||
|
else:
|
||||||
|
print '\n\n'
|
||||||
|
print '----------------------------------------'
|
||||||
|
print 'Successfully created seafile admin'
|
||||||
|
print '----------------------------------------'
|
||||||
|
print '\n\n'
|
||||||
|
|
||||||
|
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 '----------------------------------------'
|
||||||
|
def validate(email):
|
||||||
|
# whitespace is not allowed
|
||||||
|
if re.match(r'[\s]', email):
|
||||||
|
raise InvalidAnswer('%s is not a valid email address' % Utils.highlight(email))
|
||||||
|
# must be a valid email address
|
||||||
|
if not re.match(r'^.+@.*\..+$', email):
|
||||||
|
raise InvalidAnswer('%s is not a valid email address' % Utils.highlight(email))
|
||||||
|
|
||||||
|
return email
|
||||||
|
|
||||||
|
key = 'admin email'
|
||||||
|
question = 'What is the ' + Utils.highlight('email') + ' for the admin account?'
|
||||||
|
return Utils.ask_question(question,
|
||||||
|
key=key,
|
||||||
|
validate=validate)
|
||||||
|
|
||||||
|
def ask_admin_password():
|
||||||
|
def validate(password):
|
||||||
|
key = 'admin password again'
|
||||||
|
question = 'Enter the ' + Utils.highlight('password again:')
|
||||||
|
password_again = Utils.ask_question(question,
|
||||||
|
key=key,
|
||||||
|
password=True)
|
||||||
|
|
||||||
|
if password_again != password:
|
||||||
|
raise InvalidAnswer('password mismatch')
|
||||||
|
|
||||||
|
return password
|
||||||
|
|
||||||
|
key = 'admin password'
|
||||||
|
question = 'What is the ' + Utils.highlight('password') + ' for the admin account?'
|
||||||
|
return Utils.ask_question(question,
|
||||||
|
key=key,
|
||||||
|
password=True,
|
||||||
|
validate=validate)
|
||||||
|
|
||||||
|
rpc = RPC()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if not need_create_admin():
|
||||||
|
return
|
||||||
|
|
||||||
|
email = ask_admin_email()
|
||||||
|
passwd = ask_admin_password()
|
||||||
|
|
||||||
|
create_admin(email, passwd)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
|
main()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print '\n\n\n'
|
||||||
|
print Utils.highlight('Aborted.')
|
||||||
|
print
|
||||||
|
sys.exit(1)
|
||||||
|
except Exception, e:
|
||||||
|
print
|
||||||
|
print Utils.highlight('Error happened during creating seafile admin.')
|
||||||
|
print
|
55
sources/seafile-server-3.1.1/reset-admin.sh
Normal file
55
sources/seafile-server-3.1.1/reset-admin.sh
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT=$(readlink -f "$0")
|
||||||
|
INSTALLPATH=$(dirname "${SCRIPT}")
|
||||||
|
TOPDIR=$(dirname "${INSTALLPATH}")
|
||||||
|
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||||
|
|
||||||
|
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
|
||||||
|
elif which python2.6 2>/dev/null 1>&2; then
|
||||||
|
PYTHON=python2.6
|
||||||
|
elif which python26 2>/dev/null 1>&2; then
|
||||||
|
PYTHON=python26
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||||
|
echo "Install python 2.6+ 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 read_seafile_data_dir () {
|
||||||
|
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
|
||||||
|
if [[ ! -f ${seafile_ini} ]]; then
|
||||||
|
echo "${seafile_ini} not found. Now quit"
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
check_python_executable;
|
||||||
|
read_seafile_data_dir;
|
||||||
|
|
||||||
|
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||||
|
export SEAFILE_CONF_DIR=${seafile_data_dir}
|
||||||
|
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||||
|
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||||
|
|
||||||
|
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||||
|
exec "$PYTHON" "$manage_py" createsuperuser
|
0
sources/seafile-server-3.1.1/runtime/access.log
Normal file
0
sources/seafile-server-3.1.1/runtime/access.log
Normal file
0
sources/seafile-server-3.1.1/runtime/error.log
Normal file
0
sources/seafile-server-3.1.1/runtime/error.log
Normal file
12
sources/seafile-server-3.1.1/runtime/seahub.conf
Normal file
12
sources/seafile-server-3.1.1/runtime/seahub.conf
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
daemon = True
|
||||||
|
workers = 3
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
runtime_dir = os.path.dirname(__file__)
|
||||||
|
pidfile = os.path.join(runtime_dir, '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
|
1
sources/seafile-server-3.1.1/runtime/seahub.pid
Normal file
1
sources/seafile-server-3.1.1/runtime/seahub.pid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
8112
|
133
sources/seafile-server-3.1.1/seaf-fuse.sh
Normal file
133
sources/seafile-server-3.1.1/seaf-fuse.sh
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
SCRIPT=$(readlink -f "$0")
|
||||||
|
INSTALLPATH=$(dirname "${SCRIPT}")
|
||||||
|
TOPDIR=$(dirname "${INSTALLPATH}")
|
||||||
|
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||||
|
seaf_fuse=${INSTALLPATH}/seafile/bin/seaf-fuse
|
||||||
|
|
||||||
|
export PATH=${INSTALLPATH}/seafile/bin:$PATH
|
||||||
|
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||||
|
|
||||||
|
script_name=$0
|
||||||
|
function usage () {
|
||||||
|
echo "usage : "
|
||||||
|
echo "$(basename ${script_name}) { start <mount-point> | stop | restart <mount-point> } "
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# check args
|
||||||
|
if [[ "$1" != "start" && "$1" != "stop" && "$1" != "restart" ]]; then
|
||||||
|
usage;
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ($1 == "start" || $1 == "restart" ) && $# != 2 ]]; then
|
||||||
|
usage;
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "stop" && $# != 1 ]]; then
|
||||||
|
usage;
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mount_point=$2
|
||||||
|
|
||||||
|
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 ""
|
||||||
|
exit -1;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function read_seafile_data_dir () {
|
||||||
|
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
|
||||||
|
if [[ ! -f ${seafile_ini} ]]; then
|
||||||
|
echo "${seafile_ini} not found. Now quit"
|
||||||
|
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_already_running () {
|
||||||
|
if pid=$(pgrep -f "seaf-fuse -c ${default_ccnet_conf_dir}" 2>/dev/null); then
|
||||||
|
echo "seaf-fuse is already running, pid $pid"
|
||||||
|
echo
|
||||||
|
exit 1;
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_seaf_fuse () {
|
||||||
|
validate_already_running;
|
||||||
|
warning_if_seafile_not_running;
|
||||||
|
validate_ccnet_conf_dir;
|
||||||
|
read_seafile_data_dir;
|
||||||
|
|
||||||
|
echo "Starting seaf-fuse, please wait ..."
|
||||||
|
|
||||||
|
logfile=${TOPDIR}/logs/seaf-fuse.log
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_fuse} \
|
||||||
|
-c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}" -l "${logfile}" \
|
||||||
|
"${mount_point}"
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# check if seaf-fuse started successfully
|
||||||
|
if ! pgrep -f "seaf-fuse -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
|
||||||
|
echo "Failed to start seaf-fuse"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "seaf-fuse started"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop_seaf_fuse() {
|
||||||
|
if ! pgrep -f "seaf-fuse -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
|
||||||
|
echo "seaf-fuse not running yet"
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Stopping seaf-fuse ..."
|
||||||
|
pkill -SIGTERM -f "seaf-fuse -c ${default_ccnet_conf_dir}"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function restart_seaf_fuse () {
|
||||||
|
stop_seaf_fuse
|
||||||
|
sleep 2
|
||||||
|
start_seaf_fuse
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
"start" )
|
||||||
|
start_seaf_fuse;
|
||||||
|
;;
|
||||||
|
"stop" )
|
||||||
|
stop_seaf_fuse;
|
||||||
|
;;
|
||||||
|
"restart" )
|
||||||
|
restart_seaf_fuse;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "Done."
|
152
sources/seafile-server-3.1.1/seafile.sh
Normal file
152
sources/seafile-server-3.1.1/seafile.sh
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: seafile
|
||||||
|
# Required-Start: $local_fs $remote_fs $network
|
||||||
|
# Required-Stop: $local_fs
|
||||||
|
# Default-Start: 1 2 3 4 5
|
||||||
|
# Default-Stop:
|
||||||
|
# Short-Description: Starts Seafile Server
|
||||||
|
# Description: starts Seafile Server
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
SCRIPT=$(readlink -f "$0")
|
||||||
|
INSTALLPATH=$(dirname "${SCRIPT}")
|
||||||
|
TOPDIR=$(dirname "${INSTALLPATH}")
|
||||||
|
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||||
|
ccnet_pidfile=${INSTALLPATH}/runtime/ccnet.pid
|
||||||
|
seaf_controller="${INSTALLPATH}/seafile/bin/seafile-controller"
|
||||||
|
|
||||||
|
|
||||||
|
export PATH=${INSTALLPATH}/seafile/bin:$PATH
|
||||||
|
export ORIG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
|
||||||
|
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||||
|
|
||||||
|
script_name=$0
|
||||||
|
function usage () {
|
||||||
|
echo "usage : "
|
||||||
|
echo "$(basename ${script_name}) { start | stop | restart } "
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# check args
|
||||||
|
if [[ $# != 1 || ( "$1" != "start" && "$1" != "stop" && "$1" != "restart" ) ]]; then
|
||||||
|
usage;
|
||||||
|
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 setup-seafile.sh before this?"
|
||||||
|
echo ""
|
||||||
|
exit -1;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function read_seafile_data_dir () {
|
||||||
|
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
|
||||||
|
if [[ ! -f ${seafile_ini} ]]; then
|
||||||
|
echo "${seafile_ini} not found. Now quit"
|
||||||
|
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 ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} --test -c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}"; then
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_component_running() {
|
||||||
|
name=$1
|
||||||
|
cmd=$2
|
||||||
|
if pid=$(pgrep -f "$cmd" 2>/dev/null); then
|
||||||
|
echo "[$name] is running, pid $pid. You can stop it by: "
|
||||||
|
echo
|
||||||
|
echo " kill $pid"
|
||||||
|
echo
|
||||||
|
echo "Stop it and try again."
|
||||||
|
echo
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function validate_already_running () {
|
||||||
|
if pid=$(pgrep -f "seafile-controller -c ${default_ccnet_conf_dir}" 2>/dev/null); then
|
||||||
|
echo "Seafile controller is already running, pid $pid"
|
||||||
|
echo
|
||||||
|
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 "fileserver" "fileserver -c ${default_ccnet_conf_dir}"
|
||||||
|
check_component_running "seafdav" "wsgidav.server.run_server"
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_seafile_server () {
|
||||||
|
validate_already_running;
|
||||||
|
validate_ccnet_conf_dir;
|
||||||
|
read_seafile_data_dir;
|
||||||
|
test_config;
|
||||||
|
|
||||||
|
echo "Starting seafile server, please wait ..."
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} -c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}"
|
||||||
|
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
# check if seafile server started successfully
|
||||||
|
if ! pgrep -f "seafile-controller -c ${default_ccnet_conf_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 -c ${default_ccnet_conf_dir}" 2>/dev/null 1>&2; then
|
||||||
|
echo "seafile server not running yet"
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
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 "fileserver -c ${default_ccnet_conf_dir}"
|
||||||
|
pkill -f "soffice.*--invisible --nocrashreport"
|
||||||
|
pkill -f "wsgidav.server.run_server"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function restart_seafile_server () {
|
||||||
|
stop_seafile_server;
|
||||||
|
sleep 2
|
||||||
|
start_seafile_server;
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
"start" )
|
||||||
|
start_seafile_server;
|
||||||
|
;;
|
||||||
|
"stop" )
|
||||||
|
stop_seafile_server;
|
||||||
|
;;
|
||||||
|
"restart" )
|
||||||
|
restart_seafile_server;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "Done."
|
BIN
sources/seafile-server-3.1.1/seafile/bin/ccnet-init
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/ccnet-init
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/bin/ccnet-server
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/ccnet-server
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/bin/fileserver
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/fileserver
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/bin/seaf-fsck
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/seaf-fsck
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/bin/seaf-fuse
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/seaf-fuse
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/bin/seaf-migrate
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/seaf-migrate
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/bin/seaf-server
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/seaf-server
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/bin/seaf-server-init
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/seaf-server-init
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/bin/seafile-controller
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/seafile-controller
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/bin/seafserv-gc
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/seafserv-gc
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/bin/seafserv-tool
Normal file
BIN
sources/seafile-server-3.1.1/seafile/bin/seafserv-tool
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/docs/seafile-tutorial.doc
Normal file
BIN
sources/seafile-server-3.1.1/seafile/docs/seafile-tutorial.doc
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libacl.so.1
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libacl.so.1
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libarchive.so.12
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libarchive.so.12
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libattr.so.1
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libattr.so.1
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libbz2.so.1
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libbz2.so.1
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libccnet.so
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libccnet.so
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libccnet.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libccnet.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libccnet.so.0.0.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libccnet.so.0.0.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libcom_err.so.2
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libcom_err.so.2
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libcrypt.so.1
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libcrypt.so.1
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libcrypto.so.1.0.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libcrypto.so.1.0.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libcrypto.so.6
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libcrypto.so.6
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libevent-2.0.so.5
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libevent-2.0.so.5
Normal file
Binary file not shown.
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libffi.so.5
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libffi.so.5
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libfuse.so.2
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libfuse.so.2
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libgio-2.0.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libgio-2.0.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libglib-2.0.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libglib-2.0.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libgmodule-2.0.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libgmodule-2.0.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libgobject-2.0.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libgobject-2.0.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libgssapi_krb5.so.2
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libgssapi_krb5.so.2
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libgthread-2.0.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libgthread-2.0.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libjansson.so.4
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libjansson.so.4
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libk5crypto.so.3
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libk5crypto.so.3
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libkeyutils.so.1
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libkeyutils.so.1
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libkrb5.so.3
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libkrb5.so.3
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libkrb5support.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libkrb5support.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/liblber-2.3.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/liblber-2.3.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libldap-2.3.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libldap-2.3.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libmysqlclient.so.15
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libmysqlclient.so.15
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libnsl.so.1
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libnsl.so.1
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libpq.so.4
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libpq.so.4
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libsasl2.so.2
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libsasl2.so.2
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libseafile.so
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libseafile.so
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libseafile.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libseafile.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libseafile.so.0.0.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libseafile.so.0.0.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libsearpc.so
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libsearpc.so
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libsearpc.so.1
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libsearpc.so.1
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libsearpc.so.1.0.2
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libsearpc.so.1.0.2
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libsepol.so.1
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libsepol.so.1
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libsqlite3.so.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libsqlite3.so.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libssl.so.1.0.0
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libssl.so.1.0.0
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libssl.so.6
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libssl.so.6
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libuuid.so.1
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libuuid.so.1
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libxml2.so.2
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libxml2.so.2
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libz.so.1
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libz.so.1
Normal file
Binary file not shown.
BIN
sources/seafile-server-3.1.1/seafile/lib/libzdb.so.9
Normal file
BIN
sources/seafile-server-3.1.1/seafile/lib/libzdb.so.9
Normal file
Binary file not shown.
|
@ -0,0 +1,7 @@
|
||||||
|
from ccnet.errors import NetworkError
|
||||||
|
from ccnet.sync_client import SyncClient
|
||||||
|
|
||||||
|
from ccnet.pool import ClientPool
|
||||||
|
from ccnet.rpc import RpcClientBase, CcnetRpcClient, CcnetThreadedRpcClient
|
||||||
|
|
||||||
|
from ccnet.message import Message
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue