* 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>lilik-openwrt-22.03
@ -1,12 +0,0 @@ | |||
menu "Configuration" | |||
depends on PACKAGE_seafile-server | |||
config SEAFILE_FUSE_SUPPORT | |||
bool "Enable FUSE support" | |||
select PACKAGE_libfuse | |||
default n | |||
config SEAFILE_CONSOLE_SUPPORT | |||
bool "Enable seafile server console" | |||
default n | |||
endmenu |
@ -0,0 +1,114 @@ | |||
# Seafile Server on OpenWrt | |||
## Installation Notes | |||
### First-time Installation | |||
1. Consider where you would like the Seafile data directory | |||
(`seafile-data`), Seahub data directory (`seahub-data`), and the | |||
Seahub database (`seahub.db`, if you will be using SQLite) to be | |||
stored. | |||
This location can be configured in `/etc/config/seafile-server` | |||
(using the _data_dir_ option); the default is `/usr/share/seafile`. | |||
If you are certain you will use a custom location, set this location | |||
in `/etc/config/seafile-server` before continuing with the other | |||
installation steps. | |||
2. Run one of the two setup scripts: | |||
* To use SQLite: | |||
# setup-seafile | |||
* To use MySQL: | |||
# setup-seafile-mysql | |||
3. Create a Seafile admin account: | |||
# create-seafile-admin | |||
4. Start Seafile server: | |||
# service seafile-server start | |||
### Upgrading | |||
Please run the appropriate upgrade scripts in | |||
`/usr/share/seafile/seafile-server/upgrade` before using the new | |||
version. | |||
For more information, see | |||
https://download.seafile.com/published/seafile-manual/upgrade/upgrade.md. | |||
Note that since version 7.1, configuration files are stored in | |||
`/etc/seafile` instead of `/usr/share/seafile`. | |||
If you are upgrading from a version before 7.1: | |||
1. Run the upgrade scripts in | |||
`/usr/share/seafile/seafile-server/upgrade` up to 7.1. | |||
2. Move the `conf` and `ccnet` directories from `/usr/share/seafile` to | |||
`/etc/seafile`. | |||
3. If you are using a custom Seafile data directory location and have | |||
set this in `ccnet/seafile.ini`: | |||
Starting with 7.1, the Seafile data directory location will be taken | |||
from `/etc/config/seafile-server`, and any setting in | |||
`ccnet/seafile.ini` will be ignored. | |||
It is strongly recommended to migrate the custom location setting to | |||
`/etc/config/seafile-server` and rename/remove the `seafile.ini` | |||
file. | |||
Note that the _data_dir_ option in /etc/config/seafile-server | |||
determines the *parent* path to the Seafile data directory (along | |||
with the Seahub data directory and the Seahub database, if you are | |||
using SQLite). The actual Seafile data directory must be named | |||
`seafile-data`. | |||
For example, if your Seafile data directory is | |||
`/srv/seafile/my-seafile-data`: | |||
1. Rename the directory to `seafile-data`, so now the Seafile data | |||
directory is `/srv/seafile/seafile-data`. | |||
2. Move the Seahub data directory (`seahub-data`) from | |||
`/usr/share/seafile` into `/srv/seafile`. | |||
3. If you are using SQLite, move the Seahub database (`seahub.db`) | |||
from `/usr/share/seafile` into `/srv/seafile`. | |||
4. Set the _data_dir_ option in `/etc/config/seafile-server` to the | |||
parent path, `/srv/seafile`. | |||
5. Rename or delete `ccnet/seafile.ini`. | |||
4. Review/update your Seahub settings. In previous versions of the | |||
Seahub OpenWrt package, some of Seahub's default settings (in | |||
`/usr/share/seafile/seafile-server/seahub/seahub/settings.py`) were | |||
modified from the defaults shipped by upstream. | |||
Starting with 7.1, Seahub's default settings are the same as | |||
[upstream][seahub_settings], with custom settings added to | |||
`/etc/seafile/conf/seahub_settings.py` during setup for new | |||
installations. | |||
To use the same custom settings in your upgraded installation, add | |||
these lines to `/etc/seafile/conf/seahub_settings.py`: | |||
# Custom settings for OpenWrt | |||
USE_I18N = False | |||
USER_PASSWORD_MIN_LENGTH = 8 | |||
USER_STRONG_PASSWORD_REQUIRED = True | |||
[seahub_settings]: https://github.com/haiwen/seahub/blob/v7.1.2-server/seahub/settings.py | |||
5. Continue running the upgrade scripts up to the new version. | |||
@ -0,0 +1,10 @@ | |||
#!/bin/sh | |||
TOPDIR=/usr/share/seafile | |||
INSTALLPATH=$TOPDIR/seafile-server | |||
seafile start || exit 1 | |||
seahub python-env python3 "$INSTALLPATH/check_init_admin.py" | |||
seafile stop |
@ -0,0 +1,11 @@ | |||
config seafile-server | |||
# | |||
# Directory that holds: | |||
# | |||
# * Seafile data directory (seafile-data) | |||
# * Seahub data directory (seahub-data) | |||
# * Seahub database (seahub.db), if using SQLite | |||
# | |||
# Default: /usr/share/seafile | |||
# | |||
option data_dir /usr/share/seafile |
@ -0,0 +1,74 @@ | |||
#!/bin/sh /etc/rc.common | |||
START=99 | |||
STOP=01 | |||
EXTRA_COMMANDS="generate_uci_conf" | |||
TOPDIR=/usr/share/seafile | |||
INSTALLPATH=$TOPDIR/seafile-server | |||
uci_conf=/var/run/seafile/uci.conf | |||
default_data_dir=$TOPDIR | |||
seafile_server_latest_symlink=$TOPDIR/seafile-server-latest | |||
seafile_data_dir_symlink=$TOPDIR/seafile-data | |||
seahub_avatars_symlink=$INSTALLPATH/seahub/media/avatars | |||
seahub_custom_media_symlink=$INSTALLPATH/seahub/media/custom | |||
read_uci_section() { | |||
local cfg="$1" | |||
local data_dir | |||
config_get data_dir "$cfg" data_dir "$default_data_dir" | |||
uci_data_dir="$data_dir" | |||
} | |||
generate_uci_conf() { | |||
local uci_data_dir="$default_data_dir" | |||
config_load seafile-server | |||
config_foreach read_uci_section seafile-server | |||
mkdir -p "$uci_data_dir" | |||
mkdir -p "${uci_conf%/*}" | |||
cat <<- EOF > "$uci_conf" | |||
export SEAFILE_UCI_CONF_DIR=/etc/seafile | |||
export SEAFILE_UCI_DATA_DIR="$uci_data_dir" | |||
export SEAFILE_UCI_LOG_DIR=/var/log/seafile | |||
export SEAFILE_UCI_PID_DIR=/var/run/seafile | |||
export SEAFILE_UCI_SOCKET_DIR=/var/run/seafile | |||
EOF | |||
[ ! -L "$seafile_server_latest_symlink" ] || rm -f "$seafile_server_latest_symlink" | |||
[ ! -L "$seafile_data_dir_symlink" ] || rm -f "$seafile_data_dir_symlink" | |||
[ ! -L "$seahub_avatars_symlink" ] || \ | |||
[ "$(readlink -f "$seahub_avatars_symlink")" = "$uci_data_dir/seahub-data/avatars" ] || \ | |||
ln -snf "$uci_data_dir/seahub-data/avatars" "$seahub_avatars_symlink" | |||
[ ! -L "$seahub_custom_media_symlink" ] || \ | |||
[ "$(readlink -f "$seahub_custom_media_symlink")" = "$uci_data_dir/seahub-data/custom" ] || \ | |||
ln -snf "$uci_data_dir/seahub-data/custom" "$seahub_custom_media_symlink" | |||
} | |||
start() { | |||
seafile start || return | |||
if ! seahub start; then | |||
seafile stop | |||
return 1 | |||
fi | |||
} | |||
stop() { | |||
seahub stop | |||
seahub_ret=$? | |||
seafile stop | |||
seafile_ret=$? | |||
[ "$seahub_ret" -eq 0 ] && [ "$seafile_ret" -eq 0 ] | |||
} | |||
restart() { | |||
stop | |||
sleep 2 | |||
start | |||
} |
@ -0,0 +1 @@ | |||
/etc/seafile/ |
@ -1,12 +0,0 @@ | |||
# Start Seahub in fastcgi mode - 1 = enable, 0 = disable | |||
SEAHUB_FASTCGI=0 | |||
# Listen on the port specified below (defaults to 8000) | |||
SEAHUB_PORT=8000 | |||
# Method of serving requests (fastcgi mode only) - threaded or prefork | |||
# Using threaded mode is recommended as it consumes less resources | |||
SEAHUB_METHOD=threaded | |||
# The maximum number of worker processes/threads (fastcgi mode only) | |||
# General formula: (2 x $num_cores) + 1 | |||
# To set the number of workers in WSGI mode (which is the default) | |||
# please edit /usr/share/seafile/seafile-server/runtime/seahub.conf | |||
SEAHUB_WORKERS=3 |
@ -1,157 +0,0 @@ | |||
#!/bin/bash /etc/rc.common | |||
START=98 | |||
APP=seafile | |||
EXTRA_HELP=" setup Runs the setup script | |||
create_admin Creates the administrative login | |||
reset_admin Alias to create_admin" | |||
EXTRA_COMMANDS="setup create_admin reset_admin" | |||
TOPDIR=/usr/share/seafile | |||
default_ccnet_conf_dir=${TOPDIR}/ccnet | |||
central_config_dir=${TOPDIR}/conf | |||
seaf_controller=/usr/bin/seafile-controller | |||
function validate_ccnet_conf_dir () { | |||
if [[ ! -d ${default_ccnet_conf_dir} ]]; then | |||
echo "Error: there is no ccnet config directory." | |||
echo "Have you run \"/etc/init.d/seafile setup\"?" | |||
echo "" | |||
exit 1 | |||
fi | |||
} | |||
function validate_central_conf_dir () { | |||
if [[ ! -d ${central_config_dir} ]]; then | |||
echo "Error: there is no conf/ directory." | |||
echo "Have you run \"/etc/init.d/seafile setup\"?" | |||
echo "" | |||
exit 1 | |||
fi | |||
} | |||
function read_seafile_data_dir () { | |||
seafile_ini=${default_ccnet_conf_dir}/seafile.ini | |||
if [[ ! -f ${seafile_ini} ]]; then | |||
echo "Error: ${seafile_ini} not found." | |||
exit 1 | |||
fi | |||
seafile_data_dir=$(cat "${seafile_ini}") | |||
if [[ ! -d ${seafile_data_dir} ]]; then | |||
echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits." | |||
echo "Please check it first, or create this directory yourself." | |||
echo "" | |||
exit 1 | |||
fi | |||
} | |||
function test_config() { | |||
if ! ${seaf_controller} --test \ | |||
-c "${default_ccnet_conf_dir}" \ | |||
-d "${seafile_data_dir}" \ | |||
-F "${central_config_dir}" ; then | |||
exit 1 | |||
fi | |||
} | |||
function check_component_running() { | |||
name=$1 | |||
cmd=$2 | |||
if pid=$(pgrep -f "$cmd" 2>/dev/null); then | |||
return 1 | |||
fi | |||
} | |||
function validate_already_running () { | |||
check_component_running "seafile-controller" "seafile-controller -F ${central_config_dir}" || return 1 | |||
check_component_running "ccnet-server" "ccnet-server -F ${central_config_dir}" || return 1 | |||
check_component_running "seaf-server" "seaf-server -F ${central_config_dir}" || return 1 | |||
check_component_running "fileserver" "fileserver -F ${central_config_dir}" || return 1 | |||
check_component_running "seafdav" "wsgidav.server.run_server" || return 1 | |||
} | |||
function start_seafile_server () { | |||
if ! validate_already_running; then | |||
if [[ "$name" == "seafile-controller" ]]; then | |||
echo "Seafile already running." | |||
else | |||
echo "Error: component [$name] is already running. Please try stopping it manually by running \"kill $pid\"." | |||
echo "To force killing the process, use \"kill -9 $pid\"." | |||
fi | |||
exit 1 | |||
fi | |||
validate_central_conf_dir | |||
validate_ccnet_conf_dir | |||
read_seafile_data_dir | |||
test_config | |||
echo "Starting seafile server, please wait ..." | |||
${seaf_controller} \ | |||
-F "${central_config_dir}" \ | |||
-c "${default_ccnet_conf_dir}" \ | |||
-d "${seafile_data_dir}" | |||
sleep 3 | |||
# check if seafile server started successfully | |||
if ! pgrep -f "seafile-controller -F ${central_config_dir}" 2>/dev/null 1>&2; then | |||
echo "Failed to start seafile server" | |||
exit 1 | |||
fi | |||
echo "Seafile server started" | |||
echo | |||
} | |||
function stop_seafile_server () { | |||
if ! pgrep -f "seafile-controller -F ${central_config_dir}" 2>/dev/null 1>&2; then | |||
echo "Seafile server not running" | |||
else | |||
echo "Stopping seafile server ..." | |||
pkill -SIGTERM -f "seafile-controller -F ${central_config_dir}" | |||
pkill -f "ccnet-server -F ${central_config_dir}" | |||
pkill -f "seaf-server -F ${central_config_dir}" | |||
pkill -f "fileserver -F ${central_config_dir}" | |||
pkill -f "soffice.*--invisible --nocrashreport" | |||
pkill -f "wsgidav.server.run_server" | |||
retry=1 | |||
while ! validate_already_running && [ $retry -lt 60 ]; do sleep 1; ((retry++)); done | |||
if ! validate_already_running; then | |||
echo "Error: [$name] component is still running. Please try stopping it manually by running \"kill $pid\"." | |||
echo "To force killing the process, use \"kill -9 $pid\"." | |||
fi | |||
fi | |||
} | |||
function restart_seafile_server () { | |||
stop_seafile_server | |||
start_seafile_server | |||
} | |||
function start() { | |||
start_seafile_server | |||
} | |||
function stop() { | |||
stop_seafile_server | |||
} | |||
function restart() { | |||
restart_seafile_server | |||
} | |||
function setup() { | |||
cd "$TOPDIR" && \ | |||
/usr/bin/seafile-admin setup | |||
} | |||
function create_admin() { | |||
cd "$TOPDIR" && \ | |||
/usr/bin/seafile-admin create-admin | |||
} | |||
function reset_admin() { | |||
create_admin | |||
} |
@ -1,226 +0,0 @@ | |||
#!/bin/bash /etc/rc.common | |||
START=99 | |||
APP=seahub | |||
EXTRA_HELP=" clearsessions Clears expired sessions from database" | |||
EXTRA_COMMANDS="clearsessions" | |||
SEAHUB_FASTCGI=0 | |||
SEAHUB_PORT=8000 | |||
SEAHUB_METHOD=threaded | |||
SEAHUB_WORKERS=3 | |||
[ -f /etc/config/seafile ] && \ | |||
. /etc/config/seafile | |||
INSTALLPATH=/usr/share/seafile/seafile-server | |||
TOPDIR=$(dirname "${INSTALLPATH}") | |||
default_ccnet_conf_dir=${TOPDIR}/ccnet | |||
central_config_dir=${TOPDIR}/conf | |||
manage_py=${INSTALLPATH}/seahub/manage.py | |||
gunicorn_conf=${INSTALLPATH}/runtime/seahub.conf | |||
pidfile=/var/run/seafile/seahub.pid | |||
errorlog=${INSTALLPATH}/runtime/error.log | |||
accesslog=${INSTALLPATH}/runtime/access.log | |||
gunicorn_exe=/usr/bin/gunicorn | |||
function check_python_executable() { | |||
if [[ "$PYTHON" != "" && -x $PYTHON ]]; then | |||
return 0 | |||
fi | |||
if which python2.7 2>/dev/null 1>&2; then | |||
PYTHON=python2.7 | |||
elif which python27 2>/dev/null 1>&2; then | |||
PYTHON=python27 | |||
else | |||
echo | |||
echo "Can't find a python executable of version 2.7 or above in PATH" | |||
echo "Install python 2.7+ before continue." | |||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it" | |||
echo | |||
exit 1 | |||
fi | |||
} | |||
function validate_ccnet_conf_dir() { | |||
if [[ ! -d ${default_ccnet_conf_dir} ]]; then | |||
echo "Error: there is no ccnet config directory." | |||
echo "Have you run '/etc/init.d/seafile setup'?" | |||
echo "" | |||
exit 1 | |||
fi | |||
} | |||
function read_seafile_data_dir() { | |||
seafile_ini=${default_ccnet_conf_dir}/seafile.ini | |||
if [[ ! -f ${seafile_ini} ]]; then | |||
echo "Error: ${seafile_ini} not found." | |||
exit 1 | |||
fi | |||
seafile_data_dir=$(cat "${seafile_ini}") | |||
if [[ ! -d ${seafile_data_dir} ]]; then | |||
echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits." | |||
echo "Please check it first, or create this directory yourself." | |||
echo "" | |||
exit 1 | |||
fi | |||
} | |||
function validate_seahub_running() { | |||
if pid=$(pgrep -f "${manage_py}" 2>/dev/null); then | |||
return 1 | |||
elif pid=$(pgrep -f "seahub.wsgi:application" 2>/dev/null); then | |||
return 1 | |||
fi | |||
} | |||
function validate_port() { | |||
if ! [[ ${SEAHUB_PORT} =~ ^[1-9][0-9]{1,4}$ ]] ; then | |||
printf "\033[033m${SEAHUB_PORT}\033[m is not a valid port number\n" | |||
exit 1 | |||
fi | |||
} | |||
function warning_if_seafile_not_running() { | |||
if ! pgrep -f "seafile-controller -F ${central_config_dir}" 2>/dev/null 1>&2; then | |||
echo | |||
echo "Error: seafile-controller not running. Have you run \"/etc/init.d/seafile start\"?" | |||
echo | |||
exit 1 | |||
fi | |||
} | |||
function prepare_seahub_log_dir() { | |||
logdir="${TOPDIR}/logs" | |||
if ! [[ -d "${logsdir}" ]]; then | |||
if ! mkdir -p "${logdir}"; then | |||
echo "Error: failed to create log dir \"${logdir}\"" | |||
exit 1 | |||
fi | |||
fi | |||
export SEAHUB_LOG_DIR="${logdir}" | |||
} | |||
function before_start() { | |||
prepare_env | |||
warning_if_seafile_not_running | |||
if ! validate_seahub_running; then | |||
echo "Seahub is already running." | |||
exit 1 | |||
fi | |||
prepare_seahub_log_dir | |||
validate_port | |||
} | |||
function start_seahub() { | |||
before_start | |||
echo "Starting seahub at port ${SEAHUB_PORT} ..." | |||
check_init_admin | |||
$PYTHON $gunicorn_exe seahub.wsgi:application -c "${gunicorn_conf}" -b "0.0.0.0:${SEAHUB_PORT}" --preload | |||
# Ensure seahub is started successfully | |||
retry=1 | |||
while ! validate_seahub_running && [[ ! -f "${pidfile}" ]] && [[ $retry -lt 120 ]]; do sleep 1; ((retry++)); done | |||
if ! validate_seahub_running && [[ -f "${pidfile}" ]]; then | |||
echo | |||
echo "Seahub is started" | |||
echo | |||
else | |||
printf "\033[33mError: Seahub failed to start.\033[m\n" | |||
exit 1 | |||
fi | |||
} | |||
function start_seahub_fastcgi() { | |||
before_start | |||
# Returns 127.0.0.1 if SEAFILE_FASTCGI_HOST is unset or hasn't got any value, | |||
# otherwise returns value of SEAFILE_FASTCGI_HOST environment variable | |||
address=`(test -z "$SEAFILE_FASTCGI_HOST" && echo "127.0.0.1") || echo $SEAFILE_FASTCGI_HOST` | |||
echo "Starting seahub (fastcgi) at ${address}:${SEAHUB_PORT} ..." | |||
check_init_admin | |||
$PYTHON "${manage_py}" runfcgi host=${address} port=${SEAHUB_PORT} pidfile=${pidfile} \ | |||
outlog=${accesslog} errlog=${errorlog} maxchildren=${SEAHUB_WORKERS} method=${SEAHUB_METHOD} | |||
# Ensure seahub is started successfully | |||
retry=1 | |||
while ! validate_seahub_running && [[ ! -f "${pidfile}" ]] && [[ $retry -lt 120 ]]; do sleep 1; ((retry++)); done | |||
if ! validate_seahub_running && [[ -f "${pidfile}" ]]; then | |||
echo | |||
echo "Seahub is started" | |||
echo | |||
else | |||
printf "\033[33mError: Seahub failed to start.\033[m\n" | |||
exit 1 | |||
fi | |||
} | |||
function prepare_env() { | |||
check_python_executable | |||
validate_ccnet_conf_dir | |||
read_seafile_data_dir | |||
export CCNET_CONF_DIR=${default_ccnet_conf_dir} | |||
export SEAFILE_CONF_DIR=${seafile_data_dir} | |||
export SEAFILE_CENTRAL_CONF_DIR=${central_config_dir} | |||
export PYTHONPATH="${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:${PYTHONPATH}" | |||
} | |||
function clear_sessions() { | |||
prepare_env | |||
echo "Start clear expired session records ..." | |||
$PYTHON "${manage_py}" clearsessions | |||
echo | |||
echo "Done" | |||
echo | |||
} | |||
function stop_seahub() { | |||
if [[ -f ${pidfile} ]]; then | |||
pid=$(cat "${pidfile}") | |||
echo "Stopping seahub ..." | |||
kill ${pid} | |||
rm -f ${pidfile} | |||
retry=1 | |||
while ! validate_seahub_running && [ $retry -lt 60 ]; do sleep 1; ((retry++)); done | |||
if ! validate_seahub_running; then | |||
echo "Error: seahub cannot be stopped. Please try stopping it manually by running \"kill $(echo "$pid" | tr '\n' ' ')\"." | |||
echo "To force killing the processes, use \"kill -9 $(echo "$pid" | tr '\n' ' ')\"." | |||
fi | |||
else | |||
echo "Seahub is not running" | |||
fi | |||
} | |||
function check_init_admin() { | |||
check_init_admin_script=${INSTALLPATH}/check_init_admin.py | |||
if ! $PYTHON $check_init_admin_script; then | |||
exit 1 | |||
fi | |||
} | |||
function start() { | |||
if [ "$SEAHUB_FASTCGI" == "1" ]; then | |||
start_seahub_fastcgi | |||
else | |||
start_seahub | |||
fi | |||
} | |||
function stop() { | |||
stop_seahub | |||
} | |||
function restart() { | |||
stop | |||
start | |||
} | |||
function clearsessions() { | |||
clear_sessions | |||
} |
@ -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 'To start/stop seafile server:' | |||
+ print 'To start, stop or restart seafile:' | |||
+ print highlight(' # /etc/init.d/seafile { start | stop | restart }') | |||
- print highlight(' $ cd %s' % cwd) | |||
- print highlight(' $ %s { start | stop }' % SCRIPT_NAME) | |||
+ print 'To start, stop or restart seahub:' | |||
+ print highlight(' # /etc/init.d/seahub { start | stop | restart }') | |||
print 'If you have any problem, refer to\n' | |||
@@ -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 "-----------------------------------------------------------------" |
@ -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() | |||
@@ -509,7 +509,7 @@ def init_seahub(): | |||
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 '-----------------------------------------------------------------' |