1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-08-28 11:30:57 +00:00

Merge pull request #294 from haiwen/fix_setup_mysql

Fix setup seafile mysql script.
This commit is contained in:
Daniel Pan 2019-12-03 16:16:53 +08:00 committed by GitHub
commit bd7c08624d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 185 additions and 241 deletions

View File

@ -22,7 +22,7 @@ except ImportError:
pass
SERVER_MANUAL_HTTP = 'https://github.com/haiwen/seafile/wiki'
SERVER_MANUAL_HTTP = 'https://download.seafile.com/published/seafile-manual/home.md'
class Utils(object):
'''Groups all helper functions here'''

View File

@ -4,6 +4,7 @@ SCRIPT=$(readlink -f "$0")
INSTALLPATH=$(dirname "${SCRIPT}")
TOPDIR=$(dirname "${INSTALLPATH}")
default_ccnet_conf_dir=${TOPDIR}/ccnet
default_seafile_data_dir=${TOPDIR}/seafile-data
central_config_dir=${TOPDIR}/conf
function check_python_executable() {
@ -31,26 +32,20 @@ function check_python_executable() {
fi
}
function read_seafile_data_dir () {
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
if [[ ! -f ${seafile_ini} ]]; then
echo "${seafile_ini} not found. Now quit"
exit 1
fi
seafile_data_dir=$(cat "${seafile_ini}")
if [[ ! -d ${seafile_data_dir} ]]; then
echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits."
echo "Please check it first, or create this directory yourself."
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 ""
exit 1;
fi
}
check_python_executable;
read_seafile_data_dir;
validate_seafile_data_dir;
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
export SEAFILE_CONF_DIR=${seafile_data_dir}
export SEAFILE_CONF_DIR=${default_seafile_data_dir}
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

View File

@ -6,6 +6,7 @@ SCRIPT=$(readlink -f "$0")
INSTALLPATH=$(dirname "${SCRIPT}")
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
@ -28,16 +29,10 @@ function validate_ccnet_conf_dir () {
fi
}
function read_seafile_data_dir () {
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
if [[ ! -f ${seafile_ini} ]]; then
echo "${seafile_ini} not found. Now quit"
exit 1
fi
seafile_data_dir=$(cat "${seafile_ini}")
if [[ ! -d ${seafile_data_dir} ]]; then
echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits."
echo "Please check it first, or create this directory yourself."
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 ""
exit 1;
fi
@ -45,13 +40,13 @@ function read_seafile_data_dir () {
function run_seaf_fsck () {
validate_ccnet_conf_dir;
read_seafile_data_dir;
validate_seafile_data_dir;
echo "Starting seaf-fsck, please wait ..."
echo
LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_fsck} \
-c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}" \
-c "${default_ccnet_conf_dir}" -d "${default_seafile_data_dir}" \
-F "${default_conf_dir}" \
${seaf_fsck_opts}

View File

@ -6,6 +6,7 @@ SCRIPT=$(readlink -f "$0")
INSTALLPATH=$(dirname "${SCRIPT}")
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
@ -44,16 +45,10 @@ function validate_ccnet_conf_dir () {
fi
}
function read_seafile_data_dir () {
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
if [[ ! -f ${seafile_ini} ]]; then
echo "${seafile_ini} not found. Now quit"
exit 1
fi
seafile_data_dir=$(cat "${seafile_ini}")
if [[ ! -d ${seafile_data_dir} ]]; then
echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits."
echo "Please check it first, or create this directory yourself."
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 ""
exit 1;
fi
@ -79,7 +74,7 @@ function start_seaf_fuse () {
validate_already_running;
warning_if_seafile_not_running;
validate_ccnet_conf_dir;
read_seafile_data_dir;
validate_seafile_data_dir;
echo "Starting seaf-fuse, please wait ..."
@ -87,7 +82,7 @@ function start_seaf_fuse () {
LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_fuse} \
-c "${default_ccnet_conf_dir}" \
-d "${seafile_data_dir}" \
-d "${default_seafile_data_dir}" \
-F "${default_conf_dir}" \
-l "${logfile}" \
"$@"

View File

@ -6,6 +6,7 @@ SCRIPT=$(readlink -f "$0")
INSTALLPATH=$(dirname "${SCRIPT}")
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_opts=""
@ -30,16 +31,10 @@ function validate_ccnet_conf_dir () {
fi
}
function read_seafile_data_dir () {
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
if [[ ! -f ${seafile_ini} ]]; then
echo "${seafile_ini} not found. Now quit"
exit 1
fi
seafile_data_dir=$(cat "${seafile_ini}")
if [[ ! -d ${seafile_data_dir} ]]; then
echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits."
echo "Please check it first, or create this directory yourself."
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 ""
exit 1;
fi
@ -75,13 +70,13 @@ function validate_already_running () {
function run_seaf_gc () {
validate_already_running;
validate_ccnet_conf_dir;
read_seafile_data_dir;
validate_seafile_data_dir;
echo "Starting seafserv-gc, please wait ..."
LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_gc} \
-c "${default_ccnet_conf_dir}" \
-d "${seafile_data_dir}" \
-d "${default_seafile_data_dir}" \
-F "${default_conf_dir}" \
${seaf_gc_opts}

View File

@ -16,10 +16,10 @@ SCRIPT=$(readlink -f "$0")
INSTALLPATH=$(dirname "${SCRIPT}")
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"
export PATH=${INSTALLPATH}/seafile/bin:$PATH
export ORIG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
@ -38,7 +38,7 @@ if [[ $# != 1 || ( "$1" != "start" && "$1" != "stop" && "$1" != "restart" ) ]];
fi
function validate_running_user () {
real_data_dir=`readlink -f ${seafile_data_dir}`
real_data_dir=`readlink -f ${default_seafile_data_dir}`
running_user=`id -un`
data_dir_owner=`stat -c %U ${real_data_dir}`
@ -66,16 +66,10 @@ function validate_central_conf_dir () {
fi
}
function read_seafile_data_dir () {
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
if [[ ! -f ${seafile_ini} ]]; then
echo "${seafile_ini} not found. Now quit"
exit 1
fi
seafile_data_dir=$(cat "${seafile_ini}")
if [[ ! -d ${seafile_data_dir} ]]; then
echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits."
echo "Please check it first, or create this directory yourself."
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 ""
exit 1;
fi
@ -84,7 +78,7 @@ function read_seafile_data_dir () {
function test_config() {
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} --test \
-c "${default_ccnet_conf_dir}" \
-d "${seafile_data_dir}" \
-d "${default_seafile_data_dir}" \
-F "${central_config_dir}" ; then
exit 1;
fi
@ -121,7 +115,7 @@ function start_seafile_server () {
validate_already_running;
validate_central_conf_dir;
validate_ccnet_conf_dir;
read_seafile_data_dir;
validate_seafile_data_dir;
validate_running_user;
test_config;
@ -130,7 +124,7 @@ function start_seafile_server () {
mkdir -p $TOPDIR/logs
LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_controller} \
-c "${default_ccnet_conf_dir}" \
-d "${seafile_data_dir}" \
-d "${default_seafile_data_dir}" \
-F "${central_config_dir}"
sleep 3

View File

@ -16,6 +16,7 @@ SCRIPT=$(readlink -f "$0")
INSTALLPATH=$(dirname "${SCRIPT}")
TOPDIR=$(dirname "${INSTALLPATH}")
default_ccnet_conf_dir=${TOPDIR}/ccnet
default_seafile_data_dir=${TOPDIR}/seafile-data
central_config_dir=${TOPDIR}/conf
manage_py=${INSTALLPATH}/seahub/manage.py
@ -80,16 +81,10 @@ function validate_ccnet_conf_dir () {
fi
}
function read_seafile_data_dir () {
seafile_ini=${default_ccnet_conf_dir}/seafile.ini
if [[ ! -f ${seafile_ini} ]]; then
echo "${seafile_ini} not found. Now quit"
exit 1
fi
seafile_data_dir=$(cat "${seafile_ini}")
if [[ ! -d ${seafile_data_dir} ]]; then
echo "Your seafile server data directory \"${seafile_data_dir}\" is invalid or doesn't exits."
echo "Please check it first, or create this directory yourself."
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 ""
exit 1;
fi
@ -203,7 +198,7 @@ function start_seahub_fastcgi () {
function prepare_env() {
check_python_executable;
validate_ccnet_conf_dir;
read_seafile_data_dir;
validate_seafile_data_dir;
if [[ -z "$LANG" ]]; then
echo "LANG is not set in ENV, set to en_US.UTF-8"
@ -215,7 +210,7 @@ function prepare_env() {
fi
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
export SEAFILE_CONF_DIR=${seafile_data_dir}
export SEAFILE_CONF_DIR=${default_seafile_data_dir}
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:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH

View File

@ -24,7 +24,7 @@ except ImportError:
pass
SERVER_MANUAL_HTTP = 'https://github.com/haiwen/seafile/wiki'
SERVER_MANUAL_HTTP = 'https://download.seafile.com/published/seafile-manual/home.md'
class Utils(object):
'''Groups all helper functions here'''
@ -376,6 +376,7 @@ class AbstractDBConfigurator(AbstractConfigurator):
AbstractConfigurator.__init__(self)
self.mysql_host = 'localhost'
self.mysql_port = 3306
self.unix_socket = "/var/run/mysqld/mysqld.sock"
self.use_existing_db = False
@ -476,12 +477,15 @@ Please choose a way to initialize seafile databases:
print('done')
def check_mysql_user(self, user, password, host=None):
def check_mysql_user(self, user, password, host=None, unix_socket=None):
print('\nverifying password of user %s ... ' % user, end=' ')
kwargs = dict(host=host or self.mysql_host,
port=self.mysql_port,
kwargs = dict(port=self.mysql_port,
user=user,
passwd=password)
if unix_socket:
kwargs['unix_socket'] = unix_socket
else:
kwargs['host'] = host or self.mysql_host
try:
conn = pymysql.connect(**kwargs)
@ -565,7 +569,7 @@ class NewDBConfigurator(AbstractDBConfigurator):
# accessed from localhost with unix socket. So we retry with
# localhost when failing with 127.0.0.1.
if self.mysql_host == '127.0.0.1':
self.root_conn = self.check_mysql_user('root', password, host='localhost')
self.root_conn = self.check_mysql_user('root', password, unix_socket=self.unix_socket)
else:
raise
return password
@ -915,14 +919,14 @@ class CcnetConfigurator(AbstractConfigurator):
class SeafileConfigurator(AbstractConfigurator):
def __init__(self):
AbstractConfigurator.__init__(self)
self.seafile_dir = None
self.seafile_dir = os.path.join(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')
def ask_questions(self):
if not self.seafile_dir:
self.ask_seafile_dir()
# if not self.seafile_dir:
# self.ask_seafile_dir()
# self.ask_port()
if not self.fileserver_port:
self.ask_fileserver_port()
@ -942,7 +946,10 @@ class SeafileConfigurator(AbstractConfigurator):
time.sleep(1)
self.generate_db_conf()
self.write_seafile_ini()
## use default seafile-data path: seafile_data_dir=${TOPDIR}/seafile-data
# self.write_seafile_ini()
print('done')
def generate_db_conf(self):

View File

@ -12,10 +12,7 @@ default_logs_dir=${TOPDIR}/logs
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
use_existing_ccnet="false"
use_existing_seafile="false"
server_manual_http="https://github.com/haiwen/seafile/wiki"
server_manual_http='https://download.seafile.com/published/seafile-manual/home.md'
function welcome () {
echo "-----------------------------------------------------------------"
@ -72,20 +69,18 @@ function read_yes_no () {
function check_existing_ccnet () {
if [[ -d ${default_ccnet_conf_dir} ]]; then
echo "It seems that you have created a ccnet configuration before. "
echo "Would you like to use the existing configuration?"
if ! read_yes_no; then
echo
echo "Please remove the existing configuration before continuing."
echo "You can do it by running \"rm -rf ${default_ccnet_conf_dir}\""
echo "\033[31m Error: \033[0m Ccnet config dir \"${default_ccnet_conf_dir}\" already exists."
echo
exit 1;
else
echo
echo "Existing ccnet configuration is being used."
use_existing_ccnet=true
fi
echo
}
function check_existing_seafile () {
if [[ -d ${default_seafile_data_dir} ]]; then
echo "\033[31m Error: \033[0m Seafile server data dir \"${default_seafile_data_dir}\" already exists."
echo
exit 1;
fi
echo
}
@ -201,37 +196,37 @@ function get_server_ip_or_domain () {
echo
}
function get_ccnet_server_port () {
question="What tcp port do you want to use for ccnet server?"
hint="10001 is the recommended port."
default="10001"
ask_question "${question}\n${hint}" "${default}"
read server_port
if [[ "${server_port}" == "" ]]; then
server_port="${default}"
fi
if [[ ! ${server_port} =~ ^[0-9]+$ ]]; then
echo "\"${server_port}\" is not a valid port number. "
get_ccnet_server_port
fi
echo
}
# function get_ccnet_server_port () {
# question="What tcp port do you want to use for ccnet server?"
# hint="10001 is the recommended port."
# default="10001"
# ask_question "${question}\n${hint}" "${default}"
# read server_port
# if [[ "${server_port}" == "" ]]; then
# server_port="${default}"
# fi
# if [[ ! ${server_port} =~ ^[0-9]+$ ]]; then
# echo "\"${server_port}\" is not a valid port number. "
# get_ccnet_server_port
# fi
# echo
# }
function get_seafile_server_port () {
question="What tcp port would you like to use for seafile server?"
hint="12001 is the recommended port."
default="12001"
ask_question "${question}\n${hint}" "${default}"
read seafile_server_port
if [[ "${seafile_server_port}" == "" ]]; then
seafile_server_port="${default}"
fi
if [[ ! ${seafile_server_port} =~ ^[0-9]+$ ]]; then
echo "\"${seafile_server_port}\" is not a valid port number. "
get_seafile_server_port
fi
echo
}
# function get_seafile_server_port () {
# question="What tcp port would you like to use for seafile server?"
# hint="12001 is the recommended port."
# default="12001"
# ask_question "${question}\n${hint}" "${default}"
# read seafile_server_port
# if [[ "${seafile_server_port}" == "" ]]; then
# seafile_server_port="${default}"
# fi
# if [[ ! ${seafile_server_port} =~ ^[0-9]+$ ]]; then
# echo "\"${seafile_server_port}\" is not a valid port number. "
# get_seafile_server_port
# fi
# echo
# }
function get_fileserver_port () {
question="What tcp port do you want to use for seafile fileserver?"
@ -250,45 +245,45 @@ function get_fileserver_port () {
}
function get_seafile_data_dir () {
question="Where would you like to store your seafile data?"
note="Please use a volume with enough free space."
default=${default_seafile_data_dir}
ask_question "${question} \n\033[33mNote: \033[m${note}" "${default}"
read seafile_data_dir
if [[ "${seafile_data_dir}" == "" ]]; then
seafile_data_dir=${default}
fi
if [[ -d ${seafile_data_dir} && -f ${seafile_data_dir}/seafile.conf ]]; then
echo
echo "It seems that you have already existing seafile data in ${seafile_data_dir}."
echo "Would you like to use the existing seafile data?"
if ! read_yes_no; then
echo "You have chosen not to use existing seafile data in ${seafile_data_dir}"
echo "You need to specify a different seafile data directory or remove ${seafile_data_dir} before continuing."
get_seafile_data_dir
else
use_existing_seafile="true"
fi
elif [[ -d ${seafile_data_dir} && $(ls -A ${seafile_data_dir}) != "" ]]; then
echo
echo "${seafile_data_dir} is an existing non-empty directory. Please specify a different directory"
echo
get_seafile_data_dir
elif [[ ! ${seafile_data_dir} =~ ^/ ]]; then
echo
echo "\"${seafile_data_dir}\" is not an absolute path. Please specify an absolute path."
echo
get_seafile_data_dir
elif [[ ! -d $(dirname ${seafile_data_dir}) ]]; then
echo
echo "The path $(dirname ${seafile_data_dir}) does not exist."
echo
get_seafile_data_dir
fi
echo
}
# function get_seafile_data_dir () {
# question="Where would you like to store your seafile data?"
# note="Please use a volume with enough free space."
# default=${default_seafile_data_dir}
# ask_question "${question} \n\033[33mNote: \033[m${note}" "${default}"
# read seafile_data_dir
# if [[ "${seafile_data_dir}" == "" ]]; then
# seafile_data_dir=${default}
# fi
#
# if [[ -d ${seafile_data_dir} && -f ${seafile_data_dir}/seafile.conf ]]; then
# echo
# echo "It seems that you have already existing seafile data in ${seafile_data_dir}."
# echo "Would you like to use the existing seafile data?"
# if ! read_yes_no; then
# echo "You have chosen not to use existing seafile data in ${seafile_data_dir}"
# echo "You need to specify a different seafile data directory or remove ${seafile_data_dir} before continuing."
# get_seafile_data_dir
# else
# use_existing_seafile="true"
# fi
# elif [[ -d ${seafile_data_dir} && $(ls -A ${seafile_data_dir}) != "" ]]; then
# echo
# echo "${seafile_data_dir} is an existing non-empty directory. Please specify a different directory"
# echo
# get_seafile_data_dir
# elif [[ ! ${seafile_data_dir} =~ ^/ ]]; then
# echo
# echo "\"${seafile_data_dir}\" is not an absolute path. Please specify an absolute path."
# echo
# get_seafile_data_dir
# elif [[ ! -d $(dirname ${seafile_data_dir}) ]]; then
# echo
# echo "The path $(dirname ${seafile_data_dir}) does not exist."
# echo
# get_seafile_data_dir
# fi
# echo
# }
function gen_gunicorn_conf () {
mkdir -p ${default_conf_dir}
@ -336,13 +331,13 @@ fi
function copy_user_manuals() {
src_docs_dir=${INSTALLPATH}/seafile/docs/
library_template_dir=${seafile_data_dir}/library-template
library_template_dir=${default_seafile_data_dir}/library-template
mkdir -p ${library_template_dir}
cp -f ${src_docs_dir}/*.doc ${library_template_dir}
}
function parse_params() {
while getopts n:i:p:d arg; do
while getopts n:i:p arg; do
case $arg in
n)
server_name=${OPTARG}
@ -353,9 +348,6 @@ function parse_params() {
p)
fileserver_port=${OPTARG}
;;
d)
seafile_data_dir=${OPTARG}
;;
esac
done
}
@ -387,20 +379,6 @@ function validate_params() {
echo "Invalid fileserver port param"
err_and_quit;
fi
if [[ "${seafile_data_dir}" == "" ]]; then
seafile_data_dir=${SEAFILE_DIR:-${default_seafile_data_dir}}
fi
if [[ -d ${seafile_data_dir} && $(ls -A ${seafile_data_dir}) != "" ]]; then
echo "${seafile_data_dir} is an existing non-empty directory. Please specify a different directory"
err_and_quit
elif [[ ! ${seafile_data_dir} =~ ^/ ]]; then
echo "\"${seafile_data_dir}\" is not an absolute path. Please specify an absolute path."
err_and_quit
elif [[ ! -d $(dirname ${seafile_data_dir}) ]]; then
echo "The path $(dirname ${seafile_data_dir}) does not exist."
err_and_quit
fi
}
function usage() {
@ -444,43 +422,32 @@ check_system_dependency;
sleep .5
check_existing_ccnet;
if [[ ${use_existing_ccnet} != "true" ]]; then
if [[ "${server_name}" == "" ]]; then
check_existing_seafile;
if [[ "${server_name}" == "" ]]; then
get_server_name;
fi
if [[ "${ip_or_domain}" == "" ]]; then
get_server_ip_or_domain;
fi
# get_ccnet_server_port;
fi
if [[ "$seafile_data_dir" == "" ]]; then
get_seafile_data_dir;
if [[ "${ip_or_domain}" == "" ]]; then
get_server_ip_or_domain;
fi
if [[ ${use_existing_seafile} != "true" ]]; then
# get_seafile_server_port
if [[ "$fileserver_port" == "" ]]; then
if [[ "$fileserver_port" == "" ]]; then
get_fileserver_port
fi
fi
sleep .5
printf "\nThis is your config information:\n\n"
if [[ ${use_existing_ccnet} != "true" ]]; then
printf "server name: \033[33m${server_name}\033[m\n"
printf "server ip/domain: \033[33m${ip_or_domain}\033[m\n"
else
printf "ccnet config: use existing config in \033[33m${default_ccnet_conf_dir}\033[m\n"
fi
printf "server name: \033[33m${server_name}\033[m\n"
printf "server ip/domain: \033[33m${ip_or_domain}\033[m\n"
printf "seafile data dir: \033[33m${default_seafile_data_dir}\033[m\n"
printf "fileserver port: \033[33m${fileserver_port}\033[m\n"
if [[ ${use_existing_seafile} != "true" ]]; then
printf "seafile data dir: \033[33m${seafile_data_dir}\033[m\n"
printf "fileserver port: \033[33m${fileserver_port}\033[m\n"
else
printf "seafile data dir: use existing data in \033[33m${seafile_data_dir}\033[m\n"
fi
if [[ "${need_pause}" == "1" ]]; then
echo
@ -494,44 +461,45 @@ seaf_server_init=${INSTALLPATH}/seafile/bin/seaf-server-init
# -------------------------------------------
# Create ccnet conf
# -------------------------------------------
if [[ "${use_existing_ccnet}" != "true" ]]; then
echo "Generating ccnet configuration in ${default_ccnet_conf_dir}..."
echo
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH "${ccnet_init}" \
echo "Generating ccnet configuration in ${default_ccnet_conf_dir}..."
echo
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH "${ccnet_init}" \
-F "${default_conf_dir}" \
-c "${default_ccnet_conf_dir}" \
--host "${ip_or_domain}"; then
err_and_quit;
fi
echo
fi
echo
sleep 0.5
# -------------------------------------------
# Create seafile conf
# -------------------------------------------
if [[ "${use_existing_seafile}" != "true" ]]; then
echo "Generating seafile configuration in ${seafile_data_dir} ..."
echo
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_server_init} \
echo "Generating seafile configuration in ${default_seafile_data_dir} ..."
echo
if ! LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_server_init} \
--central-config-dir "${default_conf_dir}" \
--seafile-dir "${seafile_data_dir}" \
--seafile-dir "${default_seafile_data_dir}" \
--fileserver-port ${fileserver_port}; then
echo "Failed to generate seafile configuration"
err_and_quit;
fi
echo
fi
echo
# -------------------------------------------
# Write seafile.ini
# -------------------------------------------
echo "${seafile_data_dir}" > "${default_ccnet_conf_dir}/seafile.ini"
## use default seafile-data path: seafile_data_dir=${TOPDIR}/seafile-data
# echo "${seafile_data_dir}" > "${default_ccnet_conf_dir}/seafile.ini"
# -------------------------------------------
# Generate gunicorn.conf
@ -729,7 +697,7 @@ echo
chmod 0600 "$dest_settings_py"
chmod 0700 "$default_ccnet_conf_dir"
chmod 0700 "$seafile_data_dir"
chmod 0700 "$default_seafile_data_dir"
chmod 0700 "$default_conf_dir"
# -------------------------------------------