You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.8 KiB

seafile-server: Update to 7.1.2, revamp package * Package scripts that are shipped by upstream in their binary download * Includes setup scripts (setup-seafile.sh to use SQLite, setup-seafile-mysql.{sh,py} to use MySQL) and control scripts (seafile.sh, seahub.sh) * Does not include seafile-admin, which is not shipped in upstream's binary download. Combined with the fact that it hasn't been updated to Python 3 suggests the script has been abandoned. * Replace previous init scripts with a simplified script * Previous init scripts (seafile.init, seahub.init) were modified from older versions of seafile.sh and seahub.sh, but they haven't kept up with changes to upstream's scripts * New init script (seafile-server.init) start/stops both Seafile and Seahub (there is no need to control them separately) by calling upstream's control scripts * Replace previous package config file with new config file * Options in previous config file (seafile.conf) were mainly for using Seahub in FastCGI mode. FastCGI was deprecated in Django 1.7 and removed in 1.9; upstream's control script will only start Seahub using Gunicorn. (Options for Gunicorn including port number can be changed by editing /etc/seafile/conf/gunicorn.conf.py.) * New config file (seafile-server.config) has one option that controls where the Seafile/Seahub data directories are stored * Patch scripts/binaries to use standard, system-wide directory locations * Script files (wrappers for binaries) in /usr/bin * Binaries (not meant to be run directly by the user) in /usr/libexec * Config files in /etc/seafile * Pid/socket files in /var/run/seafile * Logs in /var/log/seafile * Include a new script to create the first admin account * With upstream's original scripts, the user is required to interactively create the first admin account when Seahub is started for the first time * The user will now use the new script (create-seafile-admin.sh) to create the first admin account after setup (using setup-seafile.sh or setup-seafile-mysql.sh) and before starting Seafile/Seahub * seahub.sh is patched to only check if there is at least one admin account and exit with an error if there is no admin account * Remove build config options and add seafile-server-fuse package * The console option controls whether the console window is shown when Seafile server is run on Windows. It has no use on Linux. * The fuse option controls whether seaf-fuse is built. (seaf-fuse is a FUSE implementation that allows the Seafile database/file system to be mounted to a local directory.) seaf-fuse is now always built and is available in a separate package (seafile-server-fuse). * Add myself as a maintainer Signed-off-by: Jeffery To <jeffery.to@gmail.com>
5 years ago
  1. #!/bin/sh /etc/rc.common
  2. START=99
  3. STOP=01
  4. EXTRA_COMMANDS="generate_uci_conf"
  5. TOPDIR=/usr/share/seafile
  6. INSTALLPATH=$TOPDIR/seafile-server
  7. uci_conf=/var/run/seafile/uci.conf
  8. default_data_dir=$TOPDIR
  9. seafile_server_latest_symlink=$TOPDIR/seafile-server-latest
  10. seafile_data_dir_symlink=$TOPDIR/seafile-data
  11. seahub_avatars_symlink=$INSTALLPATH/seahub/media/avatars
  12. seahub_custom_media_symlink=$INSTALLPATH/seahub/media/custom
  13. read_uci_section() {
  14. local cfg="$1"
  15. local data_dir
  16. config_get data_dir "$cfg" data_dir "$default_data_dir"
  17. uci_data_dir="$data_dir"
  18. }
  19. generate_uci_conf() {
  20. local uci_data_dir="$default_data_dir"
  21. config_load seafile-server
  22. config_foreach read_uci_section seafile-server
  23. mkdir -p "$uci_data_dir"
  24. mkdir -p "${uci_conf%/*}"
  25. cat <<- EOF > "$uci_conf"
  26. export SEAFILE_UCI_CONF_DIR=/etc/seafile
  27. export SEAFILE_UCI_DATA_DIR="$uci_data_dir"
  28. export SEAFILE_UCI_LOG_DIR=/var/log/seafile
  29. export SEAFILE_UCI_PID_DIR=/var/run/seafile
  30. export SEAFILE_UCI_SOCKET_DIR=/var/run/seafile
  31. EOF
  32. [ ! -L "$seafile_server_latest_symlink" ] || rm -f "$seafile_server_latest_symlink"
  33. [ ! -L "$seafile_data_dir_symlink" ] || rm -f "$seafile_data_dir_symlink"
  34. [ ! -L "$seahub_avatars_symlink" ] || \
  35. [ "$(readlink -f "$seahub_avatars_symlink")" = "$uci_data_dir/seahub-data/avatars" ] || \
  36. ln -snf "$uci_data_dir/seahub-data/avatars" "$seahub_avatars_symlink"
  37. [ ! -L "$seahub_custom_media_symlink" ] || \
  38. [ "$(readlink -f "$seahub_custom_media_symlink")" = "$uci_data_dir/seahub-data/custom" ] || \
  39. ln -snf "$uci_data_dir/seahub-data/custom" "$seahub_custom_media_symlink"
  40. }
  41. start() {
  42. seafile start || return
  43. if ! seahub start; then
  44. seafile stop
  45. return 1
  46. fi
  47. }
  48. stop() {
  49. seahub stop
  50. seahub_ret=$?
  51. seafile stop
  52. seafile_ret=$?
  53. [ "$seahub_ret" -eq 0 ] && [ "$seafile_ret" -eq 0 ]
  54. }
  55. restart() {
  56. stop
  57. sleep 2
  58. start
  59. }