seafile-server: Update to 7.1.2, revamp package

* Package scripts that are shipped by upstream in their binary download

  * Includes setup scripts (setup-seafile.sh to use SQLite,
    setup-seafile-mysql.{sh,py} to use MySQL) and control scripts
    (seafile.sh, seahub.sh)

  * Does not include seafile-admin, which is not shipped in upstream's
    binary download. Combined with the fact that it hasn't been updated
    to Python 3 suggests the script has been abandoned.

* Replace previous init scripts with a simplified script

  * Previous init scripts (seafile.init, seahub.init) were modified from
    older versions of seafile.sh and seahub.sh, but they haven't kept up
    with changes to upstream's scripts

  * New init script (seafile-server.init) start/stops both Seafile and
    Seahub (there is no need to control them separately) by calling
    upstream's control scripts

* Replace previous package config file with new config file

  * Options in previous config file (seafile.conf) were mainly for using
    Seahub in FastCGI mode. FastCGI was deprecated in Django 1.7 and
    removed in 1.9; upstream's control script will only start Seahub
    using Gunicorn. (Options for Gunicorn including port number can be
    changed by editing /etc/seafile/conf/gunicorn.conf.py.)

  * New config file (seafile-server.config) has one option that controls
    where the Seafile/Seahub data directories are stored

* Patch scripts/binaries to use standard, system-wide directory
  locations

  * Script files (wrappers for binaries) in /usr/bin
  * Binaries (not meant to be run directly by the user) in /usr/libexec
  * Config files in /etc/seafile
  * Pid/socket files in /var/run/seafile
  * Logs in /var/log/seafile

* Include a new script to create the first admin account

  * With upstream's original scripts, the user is required to
    interactively create the first admin account when Seahub is started
    for the first time

  * The user will now use the new script (create-seafile-admin.sh) to
    create the first admin account after setup (using setup-seafile.sh
    or setup-seafile-mysql.sh) and before starting Seafile/Seahub

  * seahub.sh is patched to only check if there is at least one admin
    account and exit with an error if there is no admin account

* Remove build config options and add seafile-server-fuse package

  * The console option controls whether the console window is shown when
    Seafile server is run on Windows. It has no use on Linux.

  * The fuse option controls whether seaf-fuse is built. (seaf-fuse is a
    FUSE implementation that allows the Seafile database/file system to
    be mounted to a local directory.) seaf-fuse is now always built and
    is available in a separate package (seafile-server-fuse).

* Add myself as a maintainer

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
Jeffery To
2020-03-07 06:59:29 +08:00
parent 1d275a8f27
commit cbfd166b15
42 changed files with 1895 additions and 865 deletions
@@ -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)
@@ -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)
@@ -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
@@ -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.
@@ -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
@@ -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");
@@ -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
@@ -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}")
@@ -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 <port> | stop | restart <port> }
+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 <port> | stop | restart <port> }"
+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:"
@@ -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);
}
@@ -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);
}
@@ -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
@@ -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
}
@@ -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
}
@@ -0,0 +1,10 @@
--- a/fuse/seaf-fuse.c
+++ b/fuse/seaf-fuse.c
@@ -5,7 +5,6 @@
#define FUSE_USE_VERSION 26
#include <fuse.h>
-#include <fuse_opt.h>
#include <glib.h>
#include <glib-object.h>
@@ -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 ')
@@ -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
@@ -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} <<EOF
# -*- coding: utf-8 -*-
SECRET_KEY = "$key"
+
+# Custom settings for OpenWrt
+USE_I18N = False
+USER_PASSWORD_MIN_LENGTH = 8
+USER_STRONG_PASSWORD_REQUIRED = True
EOF
fi
@@ -0,0 +1,20 @@
--- a/scripts/setup-seafile-mysql.py
+++ b/scripts/setup-seafile-mysql.py
@@ -1543,7 +1543,6 @@ def main():
seahub_config.do_syncdb()
seahub_config.prepare_avatar_dir()
# db_config.create_seahub_admin()
- user_manuals_handler.copy_user_manuals()
create_seafile_server_symlink()
set_file_perm()
--- a/scripts/setup-seafile.sh
+++ b/scripts/setup-seafile.sh
@@ -709,7 +709,6 @@ chmod 0700 "$default_conf_dir"
# -------------------------------------------
# copy user manuals to library template
# -------------------------------------------
-copy_user_manuals;
# -------------------------------------------
# final message
@@ -0,0 +1,40 @@
--- a/scripts/setup-seafile-mysql.py
+++ b/scripts/setup-seafile-mysql.py
@@ -1543,7 +1543,6 @@ def main():
seahub_config.do_syncdb()
seahub_config.prepare_avatar_dir()
# db_config.create_seahub_admin()
- create_seafile_server_symlink()
set_file_perm()
--- a/scripts/setup-seafile.sh
+++ b/scripts/setup-seafile.sh
@@ -689,17 +689,6 @@ fi
# /data/haiwen/
# -- seafile-server-2.0.4
# -- seafile-server-latest # symlink to 2.0.4
-seafile_server_symlink=${TOPDIR}/seafile-server-latest
-echo
-echo -n "creating seafile-server-latest symbolic link ... "
-if ! ln -s $(basename ${INSTALLPATH}) ${seafile_server_symlink}; then
- echo
- echo
- echo "Failed to create symbolic link ${seafile_server_symlink}"
- err_and_quit;
-fi
-echo "done"
-echo
chmod 0600 "$dest_settings_py"
chmod 0700 "$default_ccnet_conf_dir"
--- a/scripts/upgrade/minor-upgrade.sh
+++ b/scripts/upgrade/minor-upgrade.sh
@@ -162,7 +162,6 @@ make_media_custom_symlink;
move_old_elasticsearch_config_to_latest;
-update_latest_symlink;
echo "DONE"
@@ -0,0 +1,32 @@
--- a/scripts/setup-seafile.sh
+++ b/scripts/setup-seafile.sh
@@ -418,9 +418,9 @@ fi
if [[ "${need_pause}" == "1" ]]; then
welcome;
fi
-sleep .5
+sleep 1
check_system_dependency;
-sleep .5
+sleep 1
check_existing_ccnet;
check_existing_seafile;
@@ -438,7 +438,7 @@ if [[ "$fileserver_port" == "" ]]; then
fi
-sleep .5
+sleep 1
printf "\nThis is your config information:\n\n"
@@ -475,7 +475,7 @@ fi
echo
-sleep 0.5
+sleep 1
# -------------------------------------------
# Create seafile conf
@@ -0,0 +1,39 @@
--- a/scripts/setup-seafile-mysql.py
+++ b/scripts/setup-seafile-mysql.py
@@ -1203,7 +1203,7 @@ USER_STRONG_PASSWORD_REQUIRED = True
try:
media_dir = os.path.join(env_mgr.install_path, 'seahub', 'media')
- orig_avatar_dir = os.path.join(media_dir, 'avatars')
+ orig_avatar_dir = os.path.join(media_dir, 'avatars_default')
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')
@@ -1214,8 +1214,8 @@ USER_STRONG_PASSWORD_REQUIRED = True
if not os.path.exists(seahub_data_dir):
os.mkdir(seahub_data_dir)
- shutil.move(orig_avatar_dir, dest_avatar_dir)
- os.symlink(dest_avatar_dir, orig_avatar_dir)
+ shutil.copytree(orig_avatar_dir, dest_avatar_dir)
+ os.symlink(dest_avatar_dir, os.path.join(media_dir, 'avatars'))
except Exception as e:
Utils.error('Failed to prepare seahub avatars dir: %s' % e)
--- a/scripts/setup-seafile.sh
+++ b/scripts/setup-seafile.sh
@@ -676,12 +676,12 @@ echo "Done."
# prepare avatar folder
media_dir=${INSTALLPATH}/seahub/media
-orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
+orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars_default
dest_avatar_dir=${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data/avatars
if [[ ! -d ${dest_avatar_dir} ]]; then
mkdir -p "${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data"
- mv "${orig_avatar_dir}" "${dest_avatar_dir}"
+ cp -pr "${orig_avatar_dir}" "${dest_avatar_dir}"
ln -s ${SEAFILE_UCI_DATA_DIR-$TOPDIR}/seahub-data/avatars ${media_dir}
fi
@@ -0,0 +1,24 @@
--- a/scripts/setup-seafile-mysql.py
+++ b/scripts/setup-seafile-mysql.py
@@ -1556,6 +1556,9 @@ def report_success():
Your seafile server configuration has been finished successfully.
-----------------------------------------------------------------
+You will need to create an admin account before starting seafile server.
+
+create admin account: create-seafile-admin
run seafile server: service seafile-server { start | stop | restart }
-----------------------------------------------------------------
--- a/scripts/setup-seafile.sh
+++ b/scripts/setup-seafile.sh
@@ -710,6 +710,9 @@ echo "----------------------------------
echo "Your seafile server configuration has been completed successfully."
echo "-----------------------------------------------------------------"
echo
+echo "You will need to create an admin account before starting seafile server."
+echo
+echo "create admin account: create-seafile-admin"
echo "run seafile server: service seafile-server { start | stop | restart }"
echo
echo "-----------------------------------------------------------------"
@@ -6,16 +6,7 @@
pcfiles = libseafile.pc
pkgconfig_DATA = $(pcfiles)
pkgconfigdir = $(libdir)/pkgconfig
@@ -33,7 +35,7 @@ seafile_HEADERS = seafile-object.h
seafile-object.h: ${seafile_object_define}
rm -f $@
- valac --pkg posix ${seafile_object_define} -C -H seafile-object.h
+ "$(STAGING_DIR_HOSTPKG)/bin/valac" --pkg posix ${seafile_object_define} -C -H seafile-object.h
DISTCLEANFILES = ${searpc_gen}
@@ -56,7 +58,7 @@ rpc_table.stamp: ${top_srcdir}/lib/rpc_table.py
@@ -56,7 +58,7 @@ rpc_table.stamp: ${top_srcdir}/lib/rpc_t
@rm -f rpc_table.tmp
@touch rpc_table.tmp
@echo "[libsearpc]: generating rpc header files"
@@ -24,15 +15,6 @@
@echo "[libsearpc]: done"
@mv -f rpc_table.tmp $@
@@ -66,7 +68,7 @@ vala.stamp: ${seafile_object_define}
rm -f ${seafile_object_gen}
@rm -f vala.tmp
@touch vala.tmp
- valac -C --pkg posix $^
+ "$(STAGING_DIR_HOSTPKG)/bin/valac" -C --pkg posix $^
@mv -f vala.tmp $@
${seafile_object_gen}: vala.stamp
@@ -82,5 +84,5 @@ install-data-local:
if MACOS
sed -i '' -e "s|(DESTDIR)|${DESTDIR}|g" $(pcfiles)
@@ -9,7 +9,7 @@
public int64 size { get; set; }
public int64 file_count { get; set; }
public string last_modifier { get; set; }
@@ -45,7 +45,7 @@ public class Repo : Object {
@@ -46,7 +46,7 @@ public class Repo : Object {
public string repo_id { get; set; }
public string repo_name { get; set; }
public string repo_desc { get; set; }
@@ -18,7 +18,7 @@
// Section 2: Encryption related
// Members in this section should be set for every Repo object
@@ -68,7 +68,7 @@ public class Repo : Object {
@@ -70,7 +70,7 @@ public class Repo : Object {
get { return _relay_id; }
set { _relay_id = value; }
}
@@ -27,7 +27,7 @@
public bool auto_sync { get; set; }
public bool worktree_invalid { get; set; }
@@ -162,7 +162,7 @@ public class DeletedEntry : Object {
@@ -164,7 +164,7 @@ public class DeletedEntry : Object {
public string obj_name { get; set; }
public string basedir { get; set; }
public int mode { get; set; }
@@ -1,20 +0,0 @@
--- a/scripts/seaf-fuse.sh
+++ b/scripts/seaf-fuse.sh
@@ -7,7 +7,7 @@ INSTALLPATH=$(dirname "${SCRIPT}")
TOPDIR=$(dirname "${INSTALLPATH}")
default_ccnet_conf_dir=${TOPDIR}/ccnet
default_conf_dir=${TOPDIR}/conf
-seaf_fuse=${INSTALLPATH}/seafile/bin/seaf-fuse
+seaf_fuse=/usr/bin/seaf-fuse
export PATH=${INSTALLPATH}/seafile/bin:$PATH
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
@@ -68,7 +68,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
+ 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
@@ -1,35 +0,0 @@
From 13f95a28ce12216ba51cf0ca8d61c3d89689d02b Mon Sep 17 00:00:00 2001
From: Eneas U de Queiroz <cote2004-github@yahoo.com>
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 <cote2004-github@yahoo.com>
---
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
@@ -1,61 +0,0 @@
From 115a4583deb9ae11adbc419ea87c990d0b8572fe Mon Sep 17 00:00:00 2001
From: Joffrey Darcq <j-off@live.fr>
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 <j-off@live.fr>
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')
@@ -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 '-----------------------------------------------------------------'
@@ -2,11 +2,9 @@ Author: David Barbion <davidb@230ruedubac.fr>
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@ \
@@ -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);
@@ -2,11 +2,9 @@ Author: Alexandre Rossi <alexandre.rossi@gmail.com>
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,17 +47,13 @@ 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-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, "^/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, "^/update/.*", update_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-api/.*", update_api_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);