1#!/usr/local/bin/bash 2 3SCRIPT=$(readlink -f "$0") 4INSTALLPATH=$(dirname "${SCRIPT}") 5TOPDIR=$(dirname "${INSTALLPATH}") 6default_ccnet_conf_dir=${TOPDIR}/ccnet 7default_seafile_data_dir=${TOPDIR}/seafile-data 8default_seahub_db=${TOPDIR}/seahub.db 9default_conf_dir=${TOPDIR}/conf 10default_pids_dir=${TOPDIR}/pids 11default_logs_dir=${TOPDIR}/logs 12 13export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH} 14 15server_manual_http='https://download.seafile.com/published/seafile-manual/home.md' 16 17os_bsd=$(uname | grep -cm1 -e BSD -e DragonFly) 18 19function welcome () { 20 echo "-----------------------------------------------------------------" 21 echo "This script will guide you to config and setup your seafile server." 22 echo -e "\nMake sure you have read seafile server manual at \n\n\t${server_manual_http}\n" 23 echo -e "Note: This script will guide your to setup seafile server using sqlite3," 24 echo "which may have problems if your disk is on a NFS/CIFS/USB." 25 echo "In these cases, we suggest you setup seafile server using MySQL." 26 echo 27 echo "Press [ENTER] to continue" 28 echo "-----------------------------------------------------------------" 29 read dummy 30 echo 31} 32 33function err_and_quit () { 34 printf "\n\n\033[33mError occured during setup. \nPlease fix possible issues and run the script again.\033[m\n\n" 35 exit 1; 36} 37 38function on_ctrl_c_pressed () { 39 printf "\n\n\033[33mYou have pressed Ctrl-C. Setup is interrupted.\033[m\n\n" 40 exit 1; 41} 42 43# clean newly created ccnet/seafile configs when exit on SIGINT 44trap on_ctrl_c_pressed 2 45 46function check_sanity () { 47 if ! [[ -d ${INSTALLPATH}/seahub && -d ${INSTALLPATH}/seafile \ 48 && -d ${INSTALLPATH}/runtime ]]; then 49 echo 50 echo "The seafile-server diretory doesn't contain all needed files." 51 echo "Please make sure you have extracted all files and folders from tarball." 52 err_and_quit; 53 fi 54} 55 56function read_yes_no () { 57 printf "[yes|no] " 58 read yesno; 59 while [[ "${yesno}" != "yes" && "${yesno}" != "no" ]] 60 do 61 printf "please answer [yes|no] " 62 read yesno; 63 done 64 65 if [[ "${yesno}" == "no" ]]; then 66 return 1; 67 else 68 return 0; 69 fi 70} 71 72function check_existing_ccnet () { 73 if [[ -d ${default_ccnet_conf_dir} ]]; then 74 echo "\033[31m Error: \033[0m Ccnet config dir \"${default_ccnet_conf_dir}\" already exists." 75 echo 76 exit 1; 77 fi 78 echo 79} 80 81function check_existing_seafile () { 82 if [[ -d ${default_seafile_data_dir} ]]; then 83 echo "\033[31m Error: \033[0m Seafile server data dir \"${default_seafile_data_dir}\" already exists." 84 echo 85 exit 1; 86 fi 87 echo 88} 89 90function check_python_executable() { 91 if [[ "$PYTHON" != "" && -x $PYTHON ]]; then 92 return 0 93 fi 94 95 if which python3.8 2>/dev/null 1>&2; then 96 PYTHON=python3.8 97 elif !(python --version 2>&1 | grep "3\.[0-9]\.[0-9]") 2>/dev/null 1>&2; then 98 echo 99 echo "The current version of python is not 3.x.x, please use Python 3.x.x ." 100 echo 101 err_and_quit 102 else 103 PYTHON="python"$(python --version | cut -b 8-10) 104 if !which $PYTHON 2>/dev/null 1>&2; then 105 echo 106 echo "Can't find a python executable of $PYTHON in PATH" 107 echo "Install $PYTHON before continue." 108 echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it" 109 echo 110 err_and_quit 111 fi 112 fi 113 114 echo "Find python: $PYTHON" 115 echo 116} 117 118function check_python_module () { 119 module=$1 120 name=$2 121 hint=$3 122 printf " Checking python module: ${name} ... " 123 if ! $PYTHON -c "import ${module}" 2>/dev/null 1>&2; then 124 echo 125 printf "\033[33m ${name} \033[m is not installed, Please install it first.\n" 126 if [[ "${hint}" != "" ]]; then 127 printf "${hint}" 128 echo 129 fi 130 err_and_quit; 131 fi 132 echo -e "Done." 133} 134 135function check_python () { 136 echo "Checking python on this machine ..." 137 check_python_executable 138 check_python_module sqlite3 python-sqlite3 139 echo 140} 141 142function check_sqlite3 () { 143 echo -n "Checking for sqlite3 ..." 144 if ! which sqlite3 2>/dev/null 1>&2; then 145 echo -e "\nSqlite3 is not found. install it first.\n" 146 echo "On Debian/Ubuntu: apt-get install sqlite3" 147 echo "On CentOS/RHEL: yum install sqlite" 148 err_and_quit; 149 fi 150 printf "Done.\n\n" 151} 152 153function check_system_dependency () { 154 printf "Checking packages needed by seafile ...\n\n" 155 check_python; 156 check_sqlite3; 157 printf "Checking Done.\n\n" 158} 159 160function ask_question () { 161 question=$1 162 default=$2 163 key=$3 164 printf "${question}" 165 printf "\n" 166 if [[ "${default}" != "" && "${default}" != "nodefault" ]] ; then 167 printf "[default: ${default} ] " 168 elif [[ "${key}" != "" ]]; then 169 printf "[${key}]: " 170 fi 171} 172 173function get_server_name () { 174 question="What would you like to use as the name of this seafile server?\nYour seafile users will be able to see the name in their seafile client." 175 hint="You can use a-z, A-Z, 0-9, _ and -, and the length should be 3 ~ 15" 176 ask_question "${question}\n${hint}" "nodefault" "server name" 177 read server_name 178 if [[ "${server_name}" == "" ]]; then 179 echo 180 echo "server name cannot be empty" 181 get_server_name 182 elif [[ ! ${server_name} =~ ^[a-zA-Z0-9_-]{3,14}$ ]]; then 183 printf "\n\033[33m${server_name}\033[m is not a valid name.\n" 184 get_server_name; 185 fi 186 echo 187} 188 189function get_server_ip_or_domain () { 190 question="What is the ip or domain of this server?\nFor example, www.mycompany.com, or, 192.168.1.101" 191 ask_question "${question}\n" "nodefault" "This server's ip or domain" 192 read ip_or_domain 193 if [[ "${ip_or_domain}" == "" ]]; then 194 echo 195 echo "ip or domain cannot be empty" 196 get_server_ip_or_domain 197 fi 198 echo 199} 200 201# function get_ccnet_server_port () { 202# question="What tcp port do you want to use for ccnet server?" 203# hint="10001 is the recommended port." 204# default="10001" 205# ask_question "${question}\n${hint}" "${default}" 206# read server_port 207# if [[ "${server_port}" == "" ]]; then 208# server_port="${default}" 209# fi 210# if [[ ! ${server_port} =~ ^[0-9]+$ ]]; then 211# echo "\"${server_port}\" is not a valid port number. " 212# get_ccnet_server_port 213# fi 214# echo 215# } 216 217# function get_seafile_server_port () { 218# question="What tcp port would you like to use for seafile server?" 219# hint="12001 is the recommended port." 220# default="12001" 221# ask_question "${question}\n${hint}" "${default}" 222# read seafile_server_port 223# if [[ "${seafile_server_port}" == "" ]]; then 224# seafile_server_port="${default}" 225# fi 226# if [[ ! ${seafile_server_port} =~ ^[0-9]+$ ]]; then 227# echo "\"${seafile_server_port}\" is not a valid port number. " 228# get_seafile_server_port 229# fi 230# echo 231# } 232 233function get_fileserver_port () { 234 question="What tcp port do you want to use for seafile fileserver?" 235 hint="8082 is the recommended port." 236 default="8082" 237 ask_question "${question}\n${hint}" "${default}" 238 read fileserver_port 239 if [[ "${fileserver_port}" == "" ]]; then 240 fileserver_port="${default}" 241 fi 242 if [[ ! ${fileserver_port} =~ ^[0-9]+$ ]]; then 243 echo "\"${fileserver_port}\" is not a valid port number. " 244 get_fileserver_port 245 fi 246 echo 247} 248 249 250# function get_seafile_data_dir () { 251# question="Where would you like to store your seafile data?" 252# note="Please use a volume with enough free space." 253# default=${default_seafile_data_dir} 254# ask_question "${question} \n\033[33mNote: \033[m${note}" "${default}" 255# read seafile_data_dir 256# if [[ "${seafile_data_dir}" == "" ]]; then 257# seafile_data_dir=${default} 258# fi 259# 260# if [[ -d ${seafile_data_dir} && -f ${seafile_data_dir}/seafile.conf ]]; then 261# echo 262# echo "It seems that you have already existing seafile data in ${seafile_data_dir}." 263# echo "Would you like to use the existing seafile data?" 264# if ! read_yes_no; then 265# echo "You have chosen not to use existing seafile data in ${seafile_data_dir}" 266# echo "You need to specify a different seafile data directory or remove ${seafile_data_dir} before continuing." 267# get_seafile_data_dir 268# else 269# use_existing_seafile="true" 270# fi 271# elif [[ -d ${seafile_data_dir} && $(ls -A ${seafile_data_dir}) != "" ]]; then 272# echo 273# echo "${seafile_data_dir} is an existing non-empty directory. Please specify a different directory" 274# echo 275# get_seafile_data_dir 276# elif [[ ! ${seafile_data_dir} =~ ^/ ]]; then 277# echo 278# echo "\"${seafile_data_dir}\" is not an absolute path. Please specify an absolute path." 279# echo 280# get_seafile_data_dir 281# elif [[ ! -d $(dirname ${seafile_data_dir}) ]]; then 282# echo 283# echo "The path $(dirname ${seafile_data_dir}) does not exist." 284# echo 285# get_seafile_data_dir 286# fi 287# echo 288# } 289 290function gen_ccnet_conf () { 291 mkdir -p ${default_conf_dir} 292 ccnet_conf=${default_conf_dir}/ccnet.conf 293 if ! $(cat > ${ccnet_conf} <<EOF 294[General] 295SERVICE_URL = http://$ip_or_domain 296EOF 297); then 298 echo "failed to generate ccnet.conf"; 299 err_and_quit 300fi 301 302mkdir -p ${default_ccnet_conf_dir} 303} 304 305function gen_seafile_conf () { 306 mkdir -p ${default_conf_dir} 307 seafile_conf=${default_conf_dir}/seafile.conf 308 if ! $(cat > ${seafile_conf} <<EOF 309[fileserver] 310port=$fileserver_port 311EOF 312); then 313 echo "failed to generate seafile.conf"; 314 err_and_quit 315fi 316 317mkdir -p ${default_seafile_data_dir} 318} 319 320function gen_gunicorn_conf () { 321 mkdir -p ${default_conf_dir} 322 gunicorn_conf=${default_conf_dir}/gunicorn.conf.py 323 if ! $(cat > ${gunicorn_conf} <<EOF 324import os 325 326daemon = True 327workers = 5 328 329# default localhost:8000 330bind = "127.0.0.1:8000" 331 332# Pid 333pids_dir = '$default_pids_dir' 334pidfile = os.path.join(pids_dir, 'seahub.pid') 335 336# for file upload, we need a longer timeout value (default is only 30s, too short) 337timeout = 1200 338 339limit_request_line = 8190 340EOF 341); then 342 echo "failed to generate gunicorn.conf.py"; 343 err_and_quit 344fi 345} 346 347function gen_seafdav_conf () { 348 mkdir -p ${default_conf_dir} 349 seafdav_conf=${default_conf_dir}/seafdav.conf 350 if ! $(cat > ${seafdav_conf} <<EOF 351[WEBDAV] 352enabled = false 353port = 8080 354fastcgi = false 355host = 0.0.0.0 356share_name = / 357EOF 358); then 359 echo "failed to generate seafdav.conf"; 360 err_and_quit 361fi 362} 363 364function copy_user_manuals() { 365 if [ $os_bsd == "1" ]; then 366 src_docs_dir=${INSTALLPATH}/seafile/share/doc/seafile/ 367 else 368 src_docs_dir=${INSTALLPATH}/seafile/docs/ 369 fi 370 library_template_dir=${default_seafile_data_dir}/library-template 371 mkdir -p ${library_template_dir} 372 cp -f ${src_docs_dir}/*.doc ${library_template_dir} 373 if [ $os_bsd == "1" ]; then 374 chown -R seafile:seafile "${library_template_dir}" 375 fi 376} 377 378function parse_params() { 379 while getopts n:i:p arg; do 380 case $arg in 381 n) 382 server_name=${OPTARG} 383 ;; 384 i) 385 ip_or_domain=${OPTARG} 386 ;; 387 p) 388 fileserver_port=${OPTARG} 389 ;; 390 esac 391 done 392} 393 394function validate_params() { 395 # server_name default hostname -s 396 if [[ "$server_name" == "" ]]; then 397 server_name=${SERVER_NAME:-`hostname -s`} 398 fi 399 if [[ ! ${server_name} =~ ^[a-zA-Z0-9_-]{3,14}$ ]]; then 400 echo "Invalid server name param" 401 err_and_quit; 402 fi 403 404 # ip_or_domain default hostname -i 405 if [[ "$ip_or_domain" == "" ]]; then 406 ip_or_domain=${SERVER_IP:-`hostname -i`} 407 fi 408 if [[ "$ip_or_domain" != "" && ! ${ip_or_domain} =~ ^[^.].+\..+[^.]$ ]]; then 409 echo "Invalid ip or domain param" 410 err_and_quit; 411 fi 412 413 # fileserver_port default 8082 414 if [[ "${fileserver_port}" == "" ]]; then 415 fileserver_port=${FILESERVER_PORT:-8082} 416 fi 417 if [[ ! ${fileserver_port} =~ ^[0-9]+$ ]]; then 418 echo "Invalid fileserver port param" 419 err_and_quit; 420 fi 421} 422 423function usage() { 424 echo "auto mode:" 425 echo -e "$0 auto\n" \ 426 "-n server name\n" \ 427 "-i ip or domain\n" \ 428 "-p fileserver port\n" \ 429 "-d seafile dir to store seafile data" 430 echo "" 431 echo "interactive mode:" 432 echo "$0" 433} 434 435# ------------------------------------------- 436# Main workflow of this script 437# ------------------------------------------- 438 439for param in $@; do 440 if [[ "$param" == "-h" || "$param" == "--help" ]]; then 441 usage; 442 exit 0 443 fi 444done 445 446need_pause=1 447if [[ $# -ge 1 && "$1" == "auto" ]]; then 448 # auto mode, no pause 449 shift 450 parse_params $@; 451 validate_params; 452 need_pause=0 453fi 454 455check_sanity; 456if [[ "${need_pause}" == "1" ]]; then 457 welcome; 458fi 459sleep .5 460check_system_dependency; 461sleep .5 462 463check_existing_ccnet; 464check_existing_seafile; 465 466if [[ "${server_name}" == "" ]]; then 467 get_server_name; 468fi 469 470if [[ "${ip_or_domain}" == "" ]]; then 471 get_server_ip_or_domain; 472fi 473 474if [[ "$fileserver_port" == "" ]]; then 475 get_fileserver_port 476fi 477 478 479sleep .5 480 481printf "\nThis is your config information:\n\n" 482 483printf "server name: \033[33m${server_name}\033[m\n" 484printf "server ip/domain: \033[33m${ip_or_domain}\033[m\n" 485 486 487printf "seafile data dir: \033[33m${default_seafile_data_dir}\033[m\n" 488printf "fileserver port: \033[33m${fileserver_port}\033[m\n" 489 490 491if [[ "${need_pause}" == "1" ]]; then 492 echo 493 echo "If you are OK with the configuration, press [ENTER] to continue." 494 read dummy 495fi 496 497 498# ------------------------------------------- 499# Create ccnet conf 500# ------------------------------------------- 501 502echo "Generating ccnet configuration in ${default_ccnet_conf_dir}..." 503echo 504gen_ccnet_conf; 505echo 506 507# ------------------------------------------- 508# Create seafile conf 509# ------------------------------------------- 510 511echo "Generating seafile configuration in ${default_seafile_data_dir} ..." 512echo 513gen_seafile_conf; 514echo 515 516 517# ------------------------------------------- 518# Write seafile.ini 519# ------------------------------------------- 520 521## use default seafile-data path: seafile_data_dir=${TOPDIR}/seafile-data 522# echo "${seafile_data_dir}" > "${default_ccnet_conf_dir}/seafile.ini" 523 524# ------------------------------------------- 525# Generate gunicorn.conf.py 526# ------------------------------------------- 527 528gen_gunicorn_conf; 529 530# ------------------------------------------- 531# Generate seafevents.conf 532# ------------------------------------------- 533 534gen_seafdav_conf; 535 536# ------------------------------------------- 537# generate seahub/settings.py 538# ------------------------------------------- 539dest_settings_py=${TOPDIR}/conf/seahub_settings.py 540seahub_secret_keygen=${INSTALLPATH}/seahub/tools/secret_key_generator.py 541 542if [[ ! -f ${dest_settings_py} ]]; then 543 key=$($PYTHON "${seahub_secret_keygen}") 544 cat > ${dest_settings_py} <<EOF 545# -*- coding: utf-8 -*- 546SECRET_KEY = "$key" 547EOF 548fi 549 550# ------------------------------------------- 551# Seahub related config 552# ------------------------------------------- 553if [[ "${need_pause}" == "1" ]]; then 554 echo "-----------------------------------------------------------------" 555 echo "Seahub is the web interface for seafile server." 556 echo "Now let's setup seahub configuration. Press [ENTER] to continue" 557 echo "-----------------------------------------------------------------" 558 echo 559 read dummy 560fi 561 562# echo "Please specify the email address and password for the seahub administrator." 563# echo "You can use them to login as admin on your seahub website." 564# echo 565 566function get_seahub_admin_email () { 567 question="Please specify the email address for the seahub administrator:" 568 ask_question "${question}" "nodefault" "seahub admin email" 569 read seahub_admin_email 570 if [[ "${seahub_admin_email}" == "" ]]; then 571 echo "Seahub admin user name cannot be empty." 572 get_seahub_admin_email; 573 elif [[ ! ${seahub_admin_email} =~ ^.+@.*\..+$ ]]; then 574 echo "${seahub_admin_email} is not a valid email address" 575 get_seahub_admin_email; 576 fi 577} 578 579function get_seahub_admin_passwd () { 580 echo 581 question="Please specify the password you would like to use for seahub administrator:" 582 ask_question "${question}" "nodefault" "seahub admin password" 583 read -s seahub_admin_passwd 584 echo 585 question="Please enter the password again:" 586 ask_question "${question}" "nodefault" "seahub admin password again" 587 read -s seahub_admin_passwd_again 588 echo 589 if [[ "${seahub_admin_passwd}" != "${seahub_admin_passwd_again}" ]]; then 590 printf "\033[33mThe passwords didn't match.\033[m" 591 get_seahub_admin_passwd; 592 elif [[ "${seahub_admin_passwd}" == "" ]]; then 593 echo "Password cannot be empty." 594 get_seahub_admin_passwd; 595 fi 596} 597 598# get_seahub_admin_email; 599# sleep .5; 600# get_seahub_admin_passwd; 601# seahub_admin_passwd_enc=$(echo -n ${seahub_admin_passwd} | sha1sum | grep -o "[0-9a-f]*") 602# sleep .5; 603 604# printf "\n\n" 605# echo "This is your seahub admin username/password" 606# echo 607# printf "admin username: \033[33m${seahub_admin_email}\033[m\n" 608# printf "admin password: \033[33m**************\033[m\n\n" 609 610# echo 611# echo "If you are OK with the configuration, press [ENTER] to continue." 612# read dummy 613 614# usermgr_db_dir=${default_ccnet_conf_dir}/PeerMgr/ 615# usermgr_db=${usermgr_db_dir}/usermgr.db 616 617# if [[ "${use_existing_ccnet}" != "true" ]]; then 618# # create admin user/passwd entry in ccnet db 619# if ! mkdir -p "${usermgr_db_dir}"; then 620# echo "Failed to create seahub admin." 621# err_and_quit; 622# fi 623 624# sql="CREATE TABLE IF NOT EXISTS EmailUser (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, email TEXT, passwd TEXT, is_staff bool NOT NULL, is_active bool NOT NULL, ctime INTEGER)"; 625 626# if ! sqlite3 "${usermgr_db}" "${sql}" ; then 627# rm -f "${usermgr_db}" 628# echo "Failed to create seahub admin." 629# err_and_quit; 630# fi 631 632# sql="INSERT INTO EmailUser(email, passwd, is_staff, is_active, ctime) VALUES (\"${seahub_admin_email}\", \"${seahub_admin_passwd_enc}\", 1, 1, 0);" 633 634# if ! sqlite3 "${usermgr_db}" "${sql}" ; then 635# rm -f "${usermgr_db}" 636# echo "Failed to create seahub admin." 637# err_and_quit; 638# fi 639# fi 640 641echo "Creating database now, it may take one minute, please wait... " 642echo 643 644if [ $os_bsd == "1" ]; then 645 cd ${TOPDIR}/ccnet && install -d -m 0755 -o seafile -g seafile \ 646 GroupMgr misc OrgMgr PeerMgr && cd - 647else 648 cd ${TOPDIR}/ccnet && mkdir -m 0755 GroupMgr misc OrgMgr PeerMgr && cd - 649fi 650 651ccnet_group_db=${TOPDIR}/ccnet/GroupMgr/groupmgr.db 652ccnet_group_sql=${INSTALLPATH}/sql/sqlite/groupmgr.sql 653if ! sqlite3 ${ccnet_group_db} ".read ${ccnet_group_sql}" 2>/dev/null 1>&2; then 654 echo "Failed to sync ccnet groupmgr database." 655 err_and_quit; 656fi 657 658ccnet_config_db=${TOPDIR}/ccnet/misc/config.db 659ccnet_config_sql=${INSTALLPATH}/sql/sqlite/config.sql 660if ! sqlite3 ${ccnet_config_db} ".read ${ccnet_config_sql}" 2>/dev/null 1>&2; then 661 echo "Failed to sync ccnet config database." 662 err_and_quit; 663fi 664 665ccnet_org_db=${TOPDIR}/ccnet/OrgMgr/orgmgr.db 666ccnet_org_sql=${INSTALLPATH}/sql/sqlite/org.sql 667if ! sqlite3 ${ccnet_org_db} ".read ${ccnet_org_sql}" 2>/dev/null 1>&2; then 668 echo "Failed to sync ccnet org database." 669 err_and_quit; 670fi 671 672ccnet_user_db=${TOPDIR}/ccnet/PeerMgr/usermgr.db 673ccnet_user_sql=${INSTALLPATH}/sql/sqlite/user.sql 674if ! sqlite3 ${ccnet_user_db} ".read ${ccnet_user_sql}" 2>/dev/null 1>&2; then 675 echo "Failed to sync ccnet user database." 676 err_and_quit; 677fi 678 679seafile_db=${TOPDIR}/seafile-data/seafile.db 680seafile_sql=${INSTALLPATH}/sql/sqlite/seafile.sql 681if ! sqlite3 ${seafile_db} ".read ${seafile_sql}" 2>/dev/null 1>&2; then 682 echo "Failed to sync seafile database." 683 err_and_quit; 684fi 685 686seahub_db=${TOPDIR}/seahub.db 687seahub_sqls=${INSTALLPATH}/seahub/sql/sqlite3.sql 688if ! sqlite3 ${seahub_db} ".read ${seahub_sqls}" 2>/dev/null 1>&2; then 689 echo "Failed to sync seahub database." 690 err_and_quit; 691fi 692echo 693echo "Done." 694 695# prepare avatar folder 696 697media_dir=${INSTALLPATH}/seahub/media 698orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars 699dest_avatar_dir=${TOPDIR}/seahub-data/avatars 700 701if [[ ! -d ${dest_avatar_dir} ]]; then 702 mkdir -p "${TOPDIR}/seahub-data" 703 mv "${orig_avatar_dir}" "${dest_avatar_dir}" 704 ln -s ../../../seahub-data/avatars ${media_dir} 705fi 706 707# Make a seafile-server symlink, like this: 708# /data/haiwen/ 709# -- seafile-server-2.0.4 710# -- seafile-server-latest # symlink to 2.0.4 711seafile_server_symlink=${TOPDIR}/seafile-server-latest 712echo 713echo -n "creating seafile-server-latest symbolic link ... " 714if ! ln -s $(basename ${INSTALLPATH}) ${seafile_server_symlink}; then 715 echo 716 echo 717 echo "Failed to create symbolic link ${seafile_server_symlink}" 718 err_and_quit; 719fi 720echo "done" 721echo 722 723chmod 0600 "$dest_settings_py" 724chmod 0700 "$default_ccnet_conf_dir" 725chmod 0700 "$default_seafile_data_dir" 726chmod 0700 "$default_conf_dir" 727if [ $os_bsd == "1" ]; then 728 for file in "$dest_settings_py" "$default_ccnet_conf_dir" \ 729 "$default_conf_dir" "$seahub_db" "$ccnet_group_db" "$ccnet_config_db" \ 730 "$ccnet_org_db" "$ccnet_user_db"; do 731 chown seafile:seafile "$file" 732 done 733 chown -R seafile:seafile "$default_seafile_data_dir" 734fi 735 736# ------------------------------------------- 737# copy user manuals to library template 738# ------------------------------------------- 739copy_user_manuals; 740 741# ------------------------------------------- 742# final message 743# ------------------------------------------- 744 745sleep 1 746 747echo 748echo "-----------------------------------------------------------------" 749echo "Your seafile server configuration has been completed successfully." 750echo "-----------------------------------------------------------------" 751echo 752if [ $os_bsd == "1" ]; then 753 echo "run seafile server: sysrc seafile_enable=YES" 754 echo " service seafile { start | stop | restart }" 755 echo "run seahub server: sysrc seahub_enable=YES" 756 echo " service seahub { start | stop | restart }" 757 echo "run reset-admin: ./reset-admin.sh" 758else 759 echo "run seafile server: ./seafile.sh { start | stop | restart }" 760 echo "run seahub server: ./seahub.sh { start <port> | stop | restart <port> }" 761fi 762echo 763echo "-----------------------------------------------------------------" 764echo "If the server is behind a firewall, remember to open these tcp ports:" 765echo "-----------------------------------------------------------------" 766echo 767echo "port of seafile fileserver: ${fileserver_port}" 768echo "port of seahub: 8000" 769echo 770echo -e "When problems occur, refer to\n" 771echo -e " ${server_manual_http}\n" 772echo "for more information." 773echo 774