2016-11-11 04:54:47 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#coding: UTF-8
|
|
|
|
|
|
|
|
"""
|
|
|
|
This script calls the appropriate seafile init scripts (e.g.
|
|
|
|
setup-seafile.sh or setup-seafile-mysql.sh. It's supposed to run inside the
|
|
|
|
container.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
|
|
|
from os.path import abspath, basename, exists, dirname, join, isdir
|
|
|
|
import shutil
|
|
|
|
import sys
|
|
|
|
|
2016-11-12 03:28:49 +00:00
|
|
|
from utils import call, get_conf, get_install_dir, get_script
|
2016-11-11 04:54:47 +00:00
|
|
|
|
|
|
|
installdir = get_install_dir()
|
|
|
|
topdir = dirname(installdir)
|
2016-11-12 06:03:52 +00:00
|
|
|
shared_seafiledir = '/shared/seafile'
|
2016-11-11 04:54:47 +00:00
|
|
|
|
|
|
|
def main():
|
2016-11-12 06:03:52 +00:00
|
|
|
if not exists(shared_seafiledir):
|
|
|
|
os.mkdir(shared_seafiledir)
|
2016-11-11 04:54:47 +00:00
|
|
|
env = {
|
|
|
|
'SERVER_NAME': 'seafile',
|
|
|
|
'SERVER_IP': get_conf("server.hostname"),
|
|
|
|
}
|
|
|
|
call('{} auto'.format(get_script('setup-seafile.sh')), env=env)
|
|
|
|
for fn in ('conf', 'ccnet', 'seafile-data', 'seahub-data', 'seahub.db'):
|
|
|
|
src = join(topdir, fn)
|
2016-11-12 06:03:52 +00:00
|
|
|
dst = join(shared_seafiledir, fn)
|
|
|
|
if not exists(dst) and exists(src):
|
|
|
|
shutil.move(src, shared_seafiledir)
|
2016-11-11 04:54:47 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|