mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 06:11:16 +00:00
delete upgrade scripts before version 6 (#7039)
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This shell script is used to add COLLATE NOCASE to email field to avoid case
|
||||
# issue in sqlite.
|
||||
#
|
||||
# 1. ./add-collate.sh <ccnet_dir> <seafile_dir> <seahub_db>
|
||||
#
|
||||
|
||||
USER_DB='/tmp/user-db.sql'
|
||||
GROUP_DB='/tmp/group-db.sql'
|
||||
SEAFILE_DB='/tmp/seafile-db.sql'
|
||||
SEAHUB_DB='/tmp/seahub-db.sql'
|
||||
|
||||
ccnet_dir=$1
|
||||
|
||||
########## ccnet
|
||||
USER_MGR_DB=${ccnet_dir}/PeerMgr/usermgr.db
|
||||
GRP_MGR_DB=${ccnet_dir}/GroupMgr/groupmgr.db
|
||||
|
||||
rm -rf ${USER_DB}
|
||||
rm -rf ${GROUP_DB}
|
||||
|
||||
echo "sqlite3 ${USER_MGR_DB} .dump > ${USER_DB}"
|
||||
sqlite3 ${USER_MGR_DB} .dump > ${USER_DB}
|
||||
echo "sqlite3 ${GRP_MGR_DB} .dump > ${GROUP_DB}"
|
||||
sqlite3 ${GRP_MGR_DB} .dump > ${GROUP_DB}
|
||||
|
||||
sed -r 's/(CREATE TABLE EmailUser.*)email TEXT,(.*)/\1email TEXT COLLATE NOCASE,\2/I' ${USER_DB} > ${USER_DB}.tmp && mv ${USER_DB}.tmp ${USER_DB}
|
||||
sed -r 's/(CREATE TABLE Binding.*)email TEXT,(.*)/\1email TEXT COLLATE NOCASE,\2/I' ${USER_DB} > ${USER_DB}.tmp && mv ${USER_DB}.tmp ${USER_DB}
|
||||
sed -r 's/(CREATE TABLE `Group`.*)`creator_name` VARCHAR\(255\),(.*)/\1`creator_name` VARCHAR\(255\) COLLATE NOCASE,\2/I' ${GROUP_DB} > ${GROUP_DB}.tmp && mv ${GROUP_DB}.tmp ${GROUP_DB}
|
||||
sed -r 's/(CREATE TABLE `GroupUser`.*)`user_name` VARCHAR\(255\),(.*)/\1`user_name` VARCHAR\(255\) COLLATE NOCASE,\2/I' ${GROUP_DB} > ${GROUP_DB}.tmp && mv ${GROUP_DB}.tmp ${GROUP_DB}
|
||||
|
||||
# backup & restore
|
||||
mv ${USER_MGR_DB} ${USER_MGR_DB}.`date +"%Y%m%d%H%M%S"`
|
||||
mv ${GRP_MGR_DB} ${GRP_MGR_DB}.`date +"%Y%m%d%H%M%S"`
|
||||
sqlite3 ${USER_MGR_DB} < ${USER_DB}
|
||||
sqlite3 ${GRP_MGR_DB} < ${GROUP_DB}
|
||||
|
||||
########## seafile
|
||||
rm -rf ${SEAFILE_DB}
|
||||
|
||||
SEAFILE_DB_FILE=$2/seafile.db
|
||||
echo "sqlite3 ${SEAFILE_DB_FILE} .dump > ${SEAFILE_DB}"
|
||||
sqlite3 ${SEAFILE_DB_FILE} .dump > ${SEAFILE_DB}
|
||||
|
||||
sed -r 's/(CREATE TABLE RepoOwner.*)owner_id TEXT(.*)/\1owner_id TEXT COLLATE NOCASE\2/I' ${SEAFILE_DB} > ${SEAFILE_DB}.tmp && mv ${SEAFILE_DB}.tmp ${SEAFILE_DB}
|
||||
sed -r 's/(CREATE TABLE RepoGroup.*)user_name TEXT,(.*)/\1user_name TEXT COLLATE NOCASE,\2/I' ${SEAFILE_DB} > ${SEAFILE_DB}.tmp && mv ${SEAFILE_DB}.tmp ${SEAFILE_DB}
|
||||
sed -r 's/(CREATE TABLE RepoUserToken.*)email VARCHAR\(255\),(.*)/\1email VARCHAR\(255\) COLLATE NOCASE,\2/I' ${SEAFILE_DB} > ${SEAFILE_DB}.tmp && mv ${SEAFILE_DB}.tmp ${SEAFILE_DB}
|
||||
sed -r 's/(CREATE TABLE UserQuota.*)user VARCHAR\(255\),(.*)/\1user VARCHAR\(255\) COLLATE NOCASE,\2/I' ${SEAFILE_DB} > ${SEAFILE_DB}.tmp && mv ${SEAFILE_DB}.tmp ${SEAFILE_DB}
|
||||
sed -r 's/(CREATE TABLE SharedRepo.*)from_email VARCHAR\(512\), to_email VARCHAR\(512\),(.*)/\1from_email VARCHAR\(512\), to_email VARCHAR\(512\) COLLATE NOCASE,\2/I' ${SEAFILE_DB} > ${SEAFILE_DB}.tmp && mv ${SEAFILE_DB}.tmp ${SEAFILE_DB}
|
||||
|
||||
# backup & restore
|
||||
mv ${SEAFILE_DB_FILE} ${SEAFILE_DB_FILE}.`date +"%Y%m%d%H%M%S"`
|
||||
sqlite3 ${SEAFILE_DB_FILE} < ${SEAFILE_DB}
|
||||
|
||||
########## seahub
|
||||
rm -rf ${SEAHUB_DB}
|
||||
|
||||
SEAHUB_DB_FILE=$3
|
||||
echo "sqlite3 ${SEAHUB_DB_FILE} .Dump | tr -d '\n' | sed 's/;/;\n/g' > ${SEAHUB_DB}"
|
||||
sqlite3 ${SEAHUB_DB_FILE} .dump | tr -d '\n' | sed 's/;/;\n/g' > ${SEAHUB_DB}
|
||||
|
||||
sed -r 's/(CREATE TABLE "notifications_usernotification".*)"to_user" varchar\(255\) NOT NULL,(.*)/\1"to_user" varchar\(255\) NOT NULL COLLATE NOCASE,\2/I' ${SEAHUB_DB} > ${SEAHUB_DB}.tmp && mv ${SEAHUB_DB}.tmp ${SEAHUB_DB}
|
||||
sed -r 's/(CREATE TABLE "profile_profile".*)"user" varchar\(75\) NOT NULL UNIQUE,(.*)/\1"user" varchar\(75\) NOT NULL UNIQUE COLLATE NOCASE,\2/I' ${SEAHUB_DB} > ${SEAHUB_DB}.tmp && mv ${SEAHUB_DB}.tmp ${SEAHUB_DB}
|
||||
sed -r 's/(CREATE TABLE "share_fileshare".*)"username" varchar\(255\) NOT NULL,(.*)/\1"username" varchar\(255\) NOT NULL COLLATE NOCASE,\2/I' ${SEAHUB_DB} > ${SEAHUB_DB}.tmp && mv ${SEAHUB_DB}.tmp ${SEAHUB_DB}
|
||||
sed -r 's/(CREATE TABLE "api2_token".*)"user" varchar\(255\) NOT NULL UNIQUE,(.*)/\1"user" varchar\(255\) NOT NULL UNIQUE COLLATE NOCASE,\2/I' ${SEAHUB_DB} > ${SEAHUB_DB}.tmp && mv ${SEAHUB_DB}.tmp ${SEAHUB_DB}
|
||||
sed -r 's/(CREATE TABLE "wiki_personalwiki".*)"username" varchar\(256\) NOT NULL UNIQUE,(.*)/\1"username" varchar\(256\) NOT NULL UNIQUE COLLATE NOCASE,\2/I' ${SEAHUB_DB} > ${SEAHUB_DB}.tmp && mv ${SEAHUB_DB}.tmp ${SEAHUB_DB}
|
||||
sed -r 's/(CREATE TABLE "message_usermessage".*)"from_email" varchar\(75\) NOT NULL,\s*"to_email" varchar\(75\) NOT NULL,(.*)/\1"from_email" varchar\(75\) NOT NULL COLLATE NOCASE, "to_email" varchar\(75\) NOT NULL COLLATE NOCASE,\2/I' ${SEAHUB_DB} > ${SEAHUB_DB}.tmp && mv ${SEAHUB_DB}.tmp ${SEAHUB_DB}
|
||||
sed -r 's/(CREATE TABLE "avatar_avatar".*)"emailuser" varchar\(255\) NOT NULL,(.*)/\1"emailuser" varchar\(255\) NOT NULL COLLATE NOCASE,\2/I' ${SEAHUB_DB} > ${SEAHUB_DB}.tmp && mv ${SEAHUB_DB}.tmp ${SEAHUB_DB}
|
||||
|
||||
# backup & restore
|
||||
mv ${SEAHUB_DB_FILE} ${SEAHUB_DB_FILE}.`date +"%Y%m%d%H%M%S"`
|
||||
sqlite3 ${SEAHUB_DB_FILE} < ${SEAHUB_DB}
|
||||
|
||||
rm -rf ${USER_DB} ${GROUP_DB} ${SEAFILE_DB} ${SEAHUB_DB}
|
@@ -1,41 +0,0 @@
|
||||
#coding: UTF-8
|
||||
|
||||
import os
|
||||
import sys
|
||||
import configparser
|
||||
|
||||
|
||||
def main():
|
||||
cfg = configparser.ConfigParser()
|
||||
seafile_conf_dir = os.environ['SEAFILE_CONF_DIR']
|
||||
seafile_conf = os.path.join(seafile_conf_dir, 'seafile.conf')
|
||||
cfg.read(seafile_conf)
|
||||
|
||||
sections_map = {
|
||||
'blocks': 'block_backend',
|
||||
'fs': 'fs_object_backend',
|
||||
'commits': 'commit_object_backend',
|
||||
}
|
||||
|
||||
backends = {}
|
||||
for name, section in sections_map.items():
|
||||
if cfg.has_option(section, 'name'):
|
||||
backend_name = cfg.get(section, 'name')
|
||||
else:
|
||||
backend_name = 'fs'
|
||||
backends[name] = backend_name
|
||||
|
||||
if any([ bend == 's3' for bend in list(backends.values()) ]):
|
||||
print('s3')
|
||||
return
|
||||
|
||||
if any([ bend == 'ceph' for bend in list(backends.values()) ]):
|
||||
print('ceph')
|
||||
return
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
except Exception as e:
|
||||
sys.stderr.write(str(e))
|
||||
sys.stderr.flush()
|
@@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sqlite3
|
||||
import os
|
||||
import sys
|
||||
|
||||
def usage():
|
||||
msg = 'usage: %s <seahub db>' % os.path.basename(sys.argv[0])
|
||||
print(msg)
|
||||
|
||||
def main():
|
||||
seahub_db = sys.argv[1]
|
||||
|
||||
conn = sqlite3.connect(seahub_db)
|
||||
c = conn.cursor()
|
||||
|
||||
try:
|
||||
c.execute('SELECT s_type from share_fileshare')
|
||||
except sqlite3.OperationalError:
|
||||
# only add this column if not exist yet, so this script is idempotent
|
||||
c.execute('ALTER table share_fileshare add column "s_type" varchar(2) NOT NULL DEFAULT "f"')
|
||||
|
||||
c.execute('CREATE INDEX IF NOT EXISTS "share_fileshare_f775835c" ON "share_fileshare" ("s_type")')
|
||||
|
||||
sql = '''CREATE TABLE IF NOT EXISTS "base_dirfileslastmodifiedinfo" (
|
||||
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"repo_id" varchar(36) NOT NULL,
|
||||
"parent_dir" text NOT NULL,
|
||||
"parent_dir_hash" varchar(12) NOT NULL,
|
||||
"dir_id" varchar(40) NOT NULL,
|
||||
"last_modified_info" text NOT NULL,
|
||||
UNIQUE ("repo_id", "parent_dir_hash"))'''
|
||||
|
||||
c.execute(sql)
|
||||
|
||||
sql = '''CREATE TABLE IF NOT EXISTS "api2_token" (
|
||||
"key" varchar(40) NOT NULL PRIMARY KEY,
|
||||
"user" varchar(255) NOT NULL UNIQUE,
|
||||
"created" datetime NOT NULL)'''
|
||||
|
||||
c.execute(sql)
|
||||
|
||||
conn.commit()
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 2:
|
||||
usage()
|
||||
sys.exit(1)
|
||||
|
||||
main()
|
||||
|
||||
|
@@ -1,234 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import configparser
|
||||
import getpass
|
||||
from collections import namedtuple
|
||||
|
||||
try:
|
||||
import pymysql
|
||||
HAS_PYMYSQL = True
|
||||
except ImportError:
|
||||
HAS_PYMYSQL = False
|
||||
|
||||
MySQLDBInfo = namedtuple('MySQLDBInfo', 'host port username password db')
|
||||
|
||||
class EnvManager(object):
|
||||
def __init__(self):
|
||||
self.upgrade_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
self.install_path = os.path.dirname(self.upgrade_dir)
|
||||
self.top_dir = os.path.dirname(self.install_path)
|
||||
self.ccnet_dir = os.environ['CCNET_CONF_DIR']
|
||||
self.seafile_dir = os.environ['SEAFILE_CONF_DIR']
|
||||
|
||||
env_mgr = EnvManager()
|
||||
|
||||
class Utils(object):
|
||||
@staticmethod
|
||||
def highlight(content, is_error=False):
|
||||
'''Add ANSI color to content to get it highlighted on terminal'''
|
||||
if is_error:
|
||||
return '\x1b[1;31m%s\x1b[m' % content
|
||||
else:
|
||||
return '\x1b[1;32m%s\x1b[m' % content
|
||||
|
||||
@staticmethod
|
||||
def info(msg):
|
||||
print(Utils.highlight('[INFO] ') + msg)
|
||||
|
||||
@staticmethod
|
||||
def error(msg):
|
||||
print(Utils.highlight('[ERROR] ') + msg)
|
||||
sys.exit(1)
|
||||
|
||||
@staticmethod
|
||||
def read_config(config_path, defaults):
|
||||
cp = configparser.ConfigParser(defaults)
|
||||
cp.read(config_path)
|
||||
return cp
|
||||
|
||||
def get_ccnet_mysql_info():
|
||||
seafile_conf = os.path.join(env_mgr.ccnet_dir, 'seafile.conf')
|
||||
defaults = {
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '3306',
|
||||
}
|
||||
|
||||
config = Utils.read_config(seafile_conf, defaults)
|
||||
db_section = 'database'
|
||||
|
||||
if not config.has_section(db_section):
|
||||
return None
|
||||
|
||||
type = config.get(db_section, 'type')
|
||||
if type != 'mysql':
|
||||
return None
|
||||
|
||||
try:
|
||||
host = config.get(db_section, 'host')
|
||||
port = config.getint(db_section, 'port')
|
||||
username = config.get(db_section, 'user')
|
||||
password = config.get(db_section, 'password')
|
||||
db = os.environ.get('SEAFILE_MYSQL_DB_CCNET_DB_NAME', '') or 'ccnet_db'
|
||||
except configparser.NoOptionError as e:
|
||||
Utils.error('Database config in seafile.conf is invalid: %s' % e)
|
||||
|
||||
info = MySQLDBInfo(host, port, username, password, db)
|
||||
return info
|
||||
|
||||
def get_seafile_mysql_info():
|
||||
seafile_conf = os.path.join(env_mgr.seafile_dir, 'seafile.conf')
|
||||
defaults = {
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '3306',
|
||||
}
|
||||
config = Utils.read_config(seafile_conf, defaults)
|
||||
db_section = 'database'
|
||||
|
||||
if not config.has_section(db_section):
|
||||
return None
|
||||
|
||||
type = config.get(db_section, 'type')
|
||||
if type != 'mysql':
|
||||
return None
|
||||
|
||||
try:
|
||||
host = config.get(db_section, 'host')
|
||||
port = config.getint(db_section, 'port')
|
||||
username = config.get(db_section, 'user')
|
||||
password = config.get(db_section, 'password')
|
||||
db = config.get(db_section, 'db_name')
|
||||
except configparser.NoOptionError as e:
|
||||
Utils.error('Database config in seafile.conf is invalid: %s' % e)
|
||||
|
||||
info = MySQLDBInfo(host, port, username, password, db)
|
||||
return info
|
||||
|
||||
def get_seahub_mysql_info():
|
||||
sys.path.insert(0, env_mgr.top_dir)
|
||||
try:
|
||||
import seahub_settings# pylint: disable=F0401
|
||||
except ImportError as e:
|
||||
Utils.error('Failed to import seahub_settings.py: %s' % e)
|
||||
|
||||
if not hasattr(seahub_settings, 'DATABASES'):
|
||||
return None
|
||||
|
||||
try:
|
||||
d = seahub_settings.DATABASES['default']
|
||||
if d['ENGINE'] != 'django.db.backends.mysql':
|
||||
return None
|
||||
|
||||
host = d.get('HOST', '127.0.0.1')
|
||||
port = int(d.get('PORT', 3306))
|
||||
username = d['USER']
|
||||
password = d['PASSWORD']
|
||||
db = d['NAME']
|
||||
except KeyError:
|
||||
Utils.error('Database config in seahub_settings.py is invalid: %s' % e)
|
||||
|
||||
info = MySQLDBInfo(host, port, username, password, db)
|
||||
return info
|
||||
|
||||
def get_seafile_db_infos():
|
||||
ccnet_db_info = get_ccnet_mysql_info()
|
||||
seafile_db_info = get_seafile_mysql_info()
|
||||
seahub_db_info = get_seahub_mysql_info()
|
||||
|
||||
infos = [ccnet_db_info, seafile_db_info, seahub_db_info]
|
||||
|
||||
for info in infos:
|
||||
if info is None:
|
||||
return None
|
||||
if info.host not in ('localhost', '127.0.0.1'):
|
||||
return None
|
||||
return infos
|
||||
|
||||
def ask_root_password(port):
|
||||
while True:
|
||||
desc = 'What is the root password for mysql? '
|
||||
password = getpass.getpass(desc).strip()
|
||||
if password:
|
||||
try:
|
||||
return check_mysql_user('root', password, port)
|
||||
except InvalidAnswer as e:
|
||||
print('\n%s\n' % e)
|
||||
continue
|
||||
|
||||
class InvalidAnswer(Exception):
|
||||
def __init__(self, msg):
|
||||
Exception.__init__(self)
|
||||
self.msg = msg
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
def check_mysql_user(user, password, port):
|
||||
print('\nverifying password of root user %s ... ' % user, end=' ')
|
||||
kwargs = dict(host='localhost',
|
||||
port=port,
|
||||
user=user,
|
||||
passwd=password)
|
||||
|
||||
try:
|
||||
conn = pymysql.connect(**kwargs)
|
||||
except Exception as e:
|
||||
if isinstance(e, pymysql.err.OperationalError):
|
||||
raise InvalidAnswer('Failed to connect to mysql server using user "%s" and password "***": %s'
|
||||
% (user, e.args[1]))
|
||||
else:
|
||||
raise InvalidAnswer('Failed to connect to mysql server using user "%s" and password "***": %s'
|
||||
% (user, e))
|
||||
|
||||
print('done')
|
||||
return conn
|
||||
|
||||
def apply_fix(root_conn, user, dbs):
|
||||
for db in dbs:
|
||||
grant_db_permission(root_conn, user, db)
|
||||
|
||||
cursor = root_conn.cursor()
|
||||
sql = """
|
||||
SELECT *
|
||||
FROM mysql.user
|
||||
WHERE Host = '%%'
|
||||
AND password = ''
|
||||
AND User = '%s'
|
||||
""" % user
|
||||
cursor.execute(sql)
|
||||
if cursor.rowcount > 0:
|
||||
sql = 'DROP USER `%s`@`%%`' % user
|
||||
cursor.execute(sql)
|
||||
|
||||
def grant_db_permission(conn, user, db):
|
||||
cursor = conn.cursor()
|
||||
sql = '''GRANT ALL PRIVILEGES ON `%s`.* to `%s`@localhost ''' \
|
||||
% (db, user)
|
||||
|
||||
try:
|
||||
cursor.execute(sql)
|
||||
except Exception as e:
|
||||
if isinstance(e, pymysql.err.OperationalError):
|
||||
Utils.error('Failed to grant permission of database %s: %s' % (db, e.args[1]))
|
||||
else:
|
||||
Utils.error('Failed to grant permission of database %s: %s' % (db, e))
|
||||
|
||||
finally:
|
||||
cursor.close()
|
||||
|
||||
def main():
|
||||
dbinfos = get_seafile_db_infos()
|
||||
if not dbinfos:
|
||||
return
|
||||
if dbinfos[0].username == 'root':
|
||||
return
|
||||
|
||||
if not HAS_PYMYSQL:
|
||||
Utils.error('Python pymysql module is not found')
|
||||
root_conn = ask_root_password(dbinfos[0].port)
|
||||
apply_fix(root_conn, dbinfos[0].username, [info.db for info in dbinfos])
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
UPGRADEDIR=$(dirname "${SCRIPT}")
|
||||
INSTALLPATH=$(dirname "${UPGRADEDIR}")
|
||||
TOPDIR=$(dirname "${INSTALLPATH}")
|
||||
|
||||
seahub_secret_keygen=${INSTALLPATH}/seahub/tools/secret_key_generator.py
|
||||
seahub_settings_py=${TOPDIR}/seahub_settings.py
|
||||
|
||||
line="SECRET_KEY = \"$(python $seahub_secret_keygen)\""
|
||||
|
||||
sed -i -e "/SECRET_KEY/c\\$line" $seahub_settings_py
|
@@ -1,47 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS `wiki_groupwiki` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`group_id` int(11) NOT NULL,
|
||||
`repo_id` varchar(36) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `group_id` (`group_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `wiki_personalwiki` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`repo_id` varchar(36) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `username` (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `group_publicgroup` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`group_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `group_publicgroup_425ae3c4` (`group_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `base_filediscuss` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`group_message_id` int(11) NOT NULL,
|
||||
`repo_id` varchar(36) NOT NULL,
|
||||
`path` longtext NOT NULL,
|
||||
`path_hash` varchar(12) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `base_filediscuss_3c1a2584` (`group_message_id`),
|
||||
KEY `base_filediscuss_6844bd5a` (`path_hash`),
|
||||
CONSTRAINT `group_message_id_refs_id_2ade200f` FOREIGN KEY (`group_message_id`) REFERENCES `group_groupmessage` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `base_filelastmodifiedinfo` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`repo_id` varchar(36) NOT NULL,
|
||||
`file_id` varchar(40) NOT NULL,
|
||||
`file_path` longtext NOT NULL,
|
||||
`file_path_hash` varchar(12) NOT NULL,
|
||||
`last_modified` bigint(20) NOT NULL,
|
||||
`email` varchar(75) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `repo_id` (`repo_id`,`file_path_hash`),
|
||||
KEY `base_filelastmodifiedinfo_359081cc` (`repo_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
|
@@ -1,39 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "wiki_groupwiki" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"group_id" integer NOT NULL UNIQUE,
|
||||
"repo_id" varchar(36) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "wiki_personalwiki" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"username" varchar(256) NOT NULL UNIQUE,
|
||||
"repo_id" varchar(36) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "group_publicgroup" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"group_id" integer NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "group_publicgroup_bda51c3c" ON "group_publicgroup" ("group_id");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "base_filediscuss" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"group_message_id" integer NOT NULL REFERENCES "group_groupmessage" ("id"),
|
||||
"repo_id" varchar(40) NOT NULL,
|
||||
"path" text NOT NULL,
|
||||
"path_hash" varchar(12) NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "base_filediscuss_6844bd5a" ON "base_filediscuss" ("path_hash");
|
||||
CREATE INDEX IF NOT EXISTS "base_filediscuss_c3e5da7c" ON "base_filediscuss" ("group_message_id");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "base_filelastmodifiedinfo" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"repo_id" varchar(36) NOT NULL,
|
||||
"file_id" varchar(40) NOT NULL,
|
||||
"file_path" text NOT NULL,
|
||||
"file_path_hash" varchar(12) NOT NULL,
|
||||
"last_modified" bigint NOT NULL,
|
||||
"email" varchar(75) NOT NULL,
|
||||
UNIQUE ("repo_id", "file_path_hash")
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "base_filelastmodifiedinfo_ca6f7e34" ON "base_filelastmodifiedinfo" ("repo_id");
|
@@ -1 +0,0 @@
|
||||
CREATE INDEX repousertoken_email on RepoUserToken(email);
|
@@ -1,17 +0,0 @@
|
||||
CREATE TABLE `message_usermessage` (
|
||||
`message_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`message` varchar(512) NOT NULL,
|
||||
`from_email` varchar(75) NOT NULL,
|
||||
`to_email` varchar(75) NOT NULL,
|
||||
`timestamp` datetime NOT NULL,
|
||||
`ifread` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`message_id`),
|
||||
KEY `message_usermessage_8b1dd4eb` (`from_email`),
|
||||
KEY `message_usermessage_590d1560` (`to_email`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `message_usermsglastcheck` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`check_time` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
@@ -1 +0,0 @@
|
||||
CREATE INDEX IF NOT EXISTS repousertoken_email on RepoUserToken(email);
|
@@ -1,16 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "message_usermessage" (
|
||||
"message_id" integer NOT NULL PRIMARY KEY,
|
||||
"message" varchar(512) NOT NULL,
|
||||
"from_email" varchar(75) NOT NULL,
|
||||
"to_email" varchar(75) NOT NULL,
|
||||
"timestamp" datetime NOT NULL,
|
||||
"ifread" bool NOT NULL
|
||||
)
|
||||
;
|
||||
CREATE TABLE IF NOT EXISTS "message_usermsglastcheck" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"check_time" datetime NOT NULL
|
||||
)
|
||||
;
|
||||
CREATE INDEX IF NOT EXISTS "message_usermessage_8b1dd4eb" ON "message_usermessage" ("from_email");
|
||||
CREATE INDEX IF NOT EXISTS "message_usermessage_590d1560" ON "message_usermessage" ("to_email");
|
@@ -1,2 +0,0 @@
|
||||
-- ccnet
|
||||
ALTER TABLE EmailUser MODIFY passwd varchar(64);
|
@@ -1,30 +0,0 @@
|
||||
-- seahub
|
||||
ALTER TABLE group_groupmessage MODIFY message varchar(2048);
|
||||
ALTER TABLE group_messagereply MODIFY message varchar(2048);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `share_privatefiledirshare` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`from_user` varchar(255) NOT NULL,
|
||||
`to_user` varchar(255) NOT NULL,
|
||||
`repo_id` varchar(36) NOT NULL,
|
||||
`path` longtext NOT NULL,
|
||||
`token` varchar(10) NOT NULL,
|
||||
`permission` varchar(5) NOT NULL,
|
||||
`s_type` varchar(5) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `token` (`token`),
|
||||
KEY `share_privatefiledirshare_0e7efed3` (`from_user`),
|
||||
KEY `share_privatefiledirshare_bc172800` (`to_user`),
|
||||
KEY `share_privatefiledirshare_2059abe4` (`repo_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `message_usermsgattachment` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user_msg_id` int(11) NOT NULL,
|
||||
`priv_file_dir_share_id` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `message_usermsgattachment_72f290f5` (`user_msg_id`),
|
||||
KEY `message_usermsgattachment_cee41a9a` (`priv_file_dir_share_id`),
|
||||
CONSTRAINT `priv_file_dir_share_id_refs_id_163f8f83` FOREIGN KEY (`priv_file_dir_share_id`) REFERENCES `share_privatefiledirshare` (`id`),
|
||||
CONSTRAINT `user_msg_id_refs_message_id_debb82ad` FOREIGN KEY (`user_msg_id`) REFERENCES `message_usermessage` (`message_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
@@ -1,20 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "share_privatefiledirshare" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"from_user" varchar(255) NOT NULL,
|
||||
"to_user" varchar(255) NOT NULL,
|
||||
"repo_id" varchar(36) NOT NULL,
|
||||
"path" text NOT NULL,
|
||||
"token" varchar(10) NOT NULL UNIQUE,
|
||||
"permission" varchar(5) NOT NULL,
|
||||
"s_type" varchar(5) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "message_usermsgattachment" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"user_msg_id" integer NOT NULL REFERENCES "message_usermessage" ("message_id"),
|
||||
"priv_file_dir_share_id" integer REFERENCES "share_privatefiledirshare" ("id")
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "share_privatefiledirshare_0e7efed3" ON "share_privatefiledirshare" ("from_user");
|
||||
CREATE INDEX IF NOT EXISTS "share_privatefiledirshare_2059abe4" ON "share_privatefiledirshare" ("repo_id");
|
||||
CREATE INDEX IF NOT EXISTS "share_privatefiledirshare_bc172800" ON "share_privatefiledirshare" ("to_user");
|
@@ -1,24 +0,0 @@
|
||||
-- seahub
|
||||
CREATE TABLE IF NOT EXISTS `base_groupenabledmodule` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`group_id` varchar(10) NOT NULL,
|
||||
`module_name` varchar(20) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `base_groupenabledmodule_dc00373b` (`group_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `base_userenabledmodule` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`module_name` varchar(20) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `base_userenabledmodule_ee0cafa2` (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `base_userlastlogin` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`last_login` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `base_userlastlogin_ee0cafa2` (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
@@ -1,20 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "base_groupenabledmodule" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"group_id" varchar(10) NOT NULL,
|
||||
"module_name" varchar(20) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "base_userenabledmodule" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"username" varchar(255) NOT NULL,
|
||||
"module_name" varchar(20) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "base_userlastlogin" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"username" varchar(255) NOT NULL,
|
||||
"last_login" datetime NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "base_groupenabledmodule_dc00373b" ON "base_groupenabledmodule" ("group_id");
|
||||
CREATE INDEX IF NOT EXISTS "base_userenabledmodule_ee0cafa2" ON "base_userenabledmodule" ("username");
|
@@ -1,53 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS `captcha_captchastore` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`challenge` varchar(32) NOT NULL,
|
||||
`response` varchar(32) NOT NULL,
|
||||
`hashkey` varchar(40) NOT NULL,
|
||||
`expiration` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `hashkey` (`hashkey`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `notifications_usernotification`;
|
||||
CREATE TABLE IF NOT EXISTS `notifications_usernotification` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`to_user` varchar(255) NOT NULL,
|
||||
`msg_type` varchar(30) NOT NULL,
|
||||
`detail` longtext NOT NULL,
|
||||
`timestamp` datetime NOT NULL,
|
||||
`seen` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `notifications_usernotification_bc172800` (`to_user`),
|
||||
KEY `notifications_usernotification_265e5521` (`msg_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `options_useroptions` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`email` varchar(255) NOT NULL,
|
||||
`option_key` varchar(50) NOT NULL,
|
||||
`option_val` varchar(50) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `options_useroptions_830a6ccb` (`email`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `profile_detailedprofile` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user` varchar(255) NOT NULL,
|
||||
`department` varchar(512) NOT NULL,
|
||||
`telephone` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `share_uploadlinkshare` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`repo_id` varchar(36) NOT NULL,
|
||||
`path` longtext NOT NULL,
|
||||
`token` varchar(10) NOT NULL,
|
||||
`ctime` datetime NOT NULL,
|
||||
`view_cnt` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `token` (`token`),
|
||||
KEY `share_uploadlinkshare_ee0cafa2` (`username`),
|
||||
KEY `share_uploadlinkshare_2059abe4` (`repo_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
@@ -1,48 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "captcha_captchastore" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"challenge" varchar(32) NOT NULL,
|
||||
"response" varchar(32) NOT NULL,
|
||||
"hashkey" varchar(40) NOT NULL UNIQUE,
|
||||
"expiration" datetime NOT NULL
|
||||
);
|
||||
|
||||
DROP TABLE IF EXISTS "notifications_usernotification";
|
||||
CREATE TABLE IF NOT EXISTS "notifications_usernotification" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"to_user" varchar(255) NOT NULL,
|
||||
"msg_type" varchar(30) NOT NULL,
|
||||
"detail" text NOT NULL,
|
||||
"timestamp" datetime NOT NULL,
|
||||
"seen" bool NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "notifications_usernotification_265e5521" ON "notifications_usernotification" ("msg_type");
|
||||
CREATE INDEX IF NOT EXISTS "notifications_usernotification_bc172800" ON "notifications_usernotification" ("to_user");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "options_useroptions" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"email" varchar(255) NOT NULL,
|
||||
"option_key" varchar(50) NOT NULL,
|
||||
"option_val" varchar(50) NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "options_useroptions_830a6ccb" ON "options_useroptions" ("email");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "profile_detailedprofile" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"user" varchar(255) NOT NULL,
|
||||
"department" varchar(512) NOT NULL,
|
||||
"telephone" varchar(100) NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "profile_detailedprofile_6340c63c" ON "profile_detailedprofile" ("user");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "share_uploadlinkshare" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"username" varchar(255) NOT NULL,
|
||||
"repo_id" varchar(36) NOT NULL,
|
||||
"path" text NOT NULL,
|
||||
"token" varchar(10) NOT NULL UNIQUE,
|
||||
"ctime" datetime NOT NULL,
|
||||
"view_cnt" integer NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "share_uploadlinkshare_2059abe4" ON "share_uploadlinkshare" ("repo_id");
|
||||
CREATE INDEX IF NOT EXISTS "share_uploadlinkshare_ee0cafa2" ON "share_uploadlinkshare" ("username");
|
@@ -1,2 +0,0 @@
|
||||
ALTER TABLE EmailUser MODIFY passwd varchar(256);
|
||||
|
@@ -1,23 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS `api2_tokenv2` (
|
||||
`key` varchar(40) NOT NULL,
|
||||
`user` varchar(255) NOT NULL,
|
||||
`platform` varchar(32) NOT NULL,
|
||||
`device_id` varchar(40) NOT NULL,
|
||||
`device_name` varchar(40) NOT NULL,
|
||||
`platform_version` varchar(16) NOT NULL,
|
||||
`client_version` varchar(16) NOT NULL,
|
||||
`last_accessed` datetime NOT NULL,
|
||||
`last_login_ip` char(39) DEFAULT NULL,
|
||||
PRIMARY KEY (`key`),
|
||||
UNIQUE KEY `user` (`user`,`platform`,`device_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `sysadmin_extra_userloginlog` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`login_date` datetime NOT NULL,
|
||||
`login_ip` varchar(20) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `sysadmin_extra_userloginlog_ee0cafa2` (`username`),
|
||||
KEY `sysadmin_extra_userloginlog_c8db99ec` (`login_date`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
@@ -1,21 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "api2_tokenv2" (
|
||||
"key" varchar(40) NOT NULL PRIMARY KEY,
|
||||
"user" varchar(255) NOT NULL,
|
||||
"platform" varchar(32) NOT NULL,
|
||||
"device_id" varchar(40) NOT NULL,
|
||||
"device_name" varchar(40) NOT NULL,
|
||||
"platform_version" varchar(16) NOT NULL,
|
||||
"client_version" varchar(16) NOT NULL,
|
||||
"last_accessed" datetime NOT NULL,
|
||||
"last_login_ip" char(39),
|
||||
UNIQUE ("user", "platform", "device_id")
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "sysadmin_extra_userloginlog" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"username" varchar(255) NOT NULL,
|
||||
"login_date" datetime NOT NULL,
|
||||
"login_ip" varchar(20) NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "sysadmin_extra_userloginlog_c8db99ec" ON "sysadmin_extra_userloginlog" ("login_date");
|
||||
CREATE INDEX IF NOT EXISTS "sysadmin_extra_userloginlog_ee0cafa2" ON "sysadmin_extra_userloginlog" ("username");
|
@@ -1,20 +0,0 @@
|
||||
alter table message_usermessage add column sender_deleted_at datetime DEFAULT NULL;
|
||||
alter table message_usermessage add column recipient_deleted_at datetime DEFAULT NULL;
|
||||
|
||||
alter table share_fileshare add column password varchar(128);
|
||||
alter table share_fileshare add column expire_date datetime;
|
||||
alter table share_uploadlinkshare add column password varchar(128);
|
||||
alter table share_uploadlinkshare add column expire_date datetime;
|
||||
alter table profile_profile add column lang_code varchar(50) DEFAULT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `share_orgfileshare` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`org_id` int(11) NOT NULL,
|
||||
`file_share_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `file_share_id` (`file_share_id`),
|
||||
KEY `share_orgfileshare_944dadb6` (`org_id`),
|
||||
CONSTRAINT `file_share_id_refs_id_bd2fd9f8` FOREIGN KEY (`file_share_id`) REFERENCES `share_fileshare` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `base_userstarredfiles` ADD INDEX `base_userstarredfiles_email` (email);
|
@@ -1,16 +0,0 @@
|
||||
alter table "message_usermessage" add column "sender_deleted_at" datetime;
|
||||
alter table "message_usermessage" add column "recipient_deleted_at" datetime;
|
||||
alter table "share_fileshare" add column "password" varchar(128);
|
||||
alter table "share_fileshare" add column "expire_date" datetime;
|
||||
alter table "share_uploadlinkshare" add column "password" varchar(128);
|
||||
alter table "share_uploadlinkshare" add column "expire_date" datetime;
|
||||
alter table "profile_profile" add column "lang_code" varchar(50);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "share_orgfileshare" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"org_id" integer NOT NULL,
|
||||
"file_share_id" integer NOT NULL UNIQUE REFERENCES "share_fileshare" ("id")
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "share_orgfileshare_944dadb6" ON "share_orgfileshare" ("org_id");
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "base_userstarredfiles_email" on "base_userstarredfiles" ("email");
|
@@ -1 +0,0 @@
|
||||
ALTER TABLE `Group` ADD type VARCHAR(32);
|
@@ -1,30 +0,0 @@
|
||||
ALTER TABLE SharedRepo MODIFY from_email VARCHAR(255);
|
||||
ALTER TABLE SharedRepo MODIFY to_email VARCHAR(255);
|
||||
ALTER TABLE SharedRepo ADD INDEX (from_email);
|
||||
ALTER TABLE SharedRepo ADD INDEX (to_email);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS OrgSharedRepo (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
org_id INT,
|
||||
repo_id CHAR(37) ,
|
||||
from_email VARCHAR(255),
|
||||
to_email VARCHAR(255),
|
||||
permission CHAR(15),
|
||||
INDEX (org_id, repo_id),
|
||||
INDEX(from_email),
|
||||
INDEX(to_email)
|
||||
) ENGINE=INNODB;
|
||||
|
||||
ALTER TABLE OrgSharedRepo MODIFY from_email VARCHAR(255);
|
||||
ALTER TABLE OrgSharedRepo MODIFY to_email VARCHAR(255);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS RepoTrash (
|
||||
repo_id CHAR(36) PRIMARY KEY,
|
||||
repo_name VARCHAR(255),
|
||||
head_id CHAR(40),
|
||||
owner_id VARCHAR(255),
|
||||
size BIGINT(20),
|
||||
org_id INTEGER,
|
||||
INDEX(owner_id),
|
||||
INDEX(org_id)
|
||||
) ENGINE=INNODB;
|
@@ -1 +0,0 @@
|
||||
ALTER TABLE `Group` ADD type VARCHAR(32);
|
@@ -1,14 +0,0 @@
|
||||
CREATE INDEX IF NOT EXISTS FromEmailIndex on SharedRepo (from_email);
|
||||
CREATE INDEX IF NOT EXISTS ToEmailIndex on SharedRepo (to_email);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS RepoTrash (
|
||||
repo_id CHAR(36) PRIMARY KEY,
|
||||
repo_name VARCHAR(255),
|
||||
head_id CHAR(40),
|
||||
owner_id VARCHAR(255),
|
||||
size BIGINT UNSIGNED,
|
||||
org_id INTEGER
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS repotrash_owner_id_idx ON RepoTrash(owner_id);
|
||||
CREATE INDEX IF NOT EXISTS repotrash_org_id_idx ON RepoTrash(org_id);
|
@@ -1 +0,0 @@
|
||||
alter table RepoTrash add del_time BIGINT;
|
@@ -1,18 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS `base_clientlogintoken` (
|
||||
`token` varchar(32) NOT NULL,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`timestamp` datetime NOT NULL,
|
||||
PRIMARY KEY (`token`),
|
||||
KEY `base_clientlogintoken_ee0cafa2` (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `organizations_orgmemberquota` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`org_id` int(11) NOT NULL,
|
||||
`quota` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `organizations_orgmemberquota_944dadb6` (`org_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
REPLACE INTO django_content_type VALUES(44,'client login token','base','clientlogintoken');
|
||||
REPLACE INTO django_content_type VALUES(45,'org member quota','organizations','orgmemberquota');
|
@@ -1 +0,0 @@
|
||||
alter table RepoTrash add del_time BIGINT;
|
@@ -1,18 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "base_clientlogintoken" (
|
||||
"token" varchar(32) NOT NULL PRIMARY KEY,
|
||||
"username" varchar(255) NOT NULL,
|
||||
"timestamp" datetime NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "base_clientlogintoken_ee0cafa2" ON "base_clientlogintoken" ("username");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "organizations_orgmemberquota" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"org_id" integer NOT NULL,
|
||||
"quota" integer NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "organizations_orgmemberquota_944dadb6" ON "organizations_orgmemberquota" ("org_id");
|
||||
|
||||
REPLACE INTO "django_content_type" VALUES(44,'client login token','base','clientlogintoken');
|
||||
REPLACE INTO "django_content_type" VALUES(45,'org member quota','organizations','orgmemberquota');
|
@@ -1,17 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS `constance_config` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`key` varchar(255) NOT NULL,
|
||||
`value` longtext NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `key` (`key`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `profile_profile` ADD `login_id` varchar(225) DEFAULT NULL;
|
||||
ALTER TABLE `profile_profile` ADD `contact_email` varchar(225) DEFAULT NULL;
|
||||
ALTER TABLE `profile_profile` ADD `institution` varchar(225) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE `profile_profile` ADD UNIQUE INDEX (`login_id`);
|
||||
ALTER TABLE `profile_profile` ADD INDEX (`contact_email`);
|
||||
ALTER TABLE `profile_profile` ADD INDEX (`institution`);
|
||||
|
||||
|
@@ -1,13 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "constance_config" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"key" varchar(255) NOT NULL UNIQUE,
|
||||
"value" text NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE "profile_profile" ADD COLUMN "login_id" varchar(225);
|
||||
ALTER TABLE "profile_profile" ADD COLUMN "contact_email" varchar(225);
|
||||
ALTER TABLE "profile_profile" ADD COLUMN "institution" varchar(225);
|
||||
|
||||
CREATE UNIQUE INDEX "profile_profile_1b43c217" ON "profile_profile" ("login_id");
|
||||
CREATE INDEX "profile_profile_3b46cb17" ON "profile_profile" ("contact_email");
|
||||
CREATE INDEX "profile_profile_71bbc151" ON "profile_profile" ("institution");
|
@@ -1 +0,0 @@
|
||||
alter table RepoTokenPeerInfo add client_ver varchar(20);
|
@@ -1,124 +0,0 @@
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `post_office_attachment` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`file` varchar(100) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `post_office_attachment_emails` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`attachment_id` int(11) NOT NULL,
|
||||
`email_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `attachment_id` (`attachment_id`,`email_id`),
|
||||
KEY `post_office_attachment_emails_4be595e7` (`attachment_id`),
|
||||
KEY `post_office_attachment_emails_830a6ccb` (`email_id`),
|
||||
CONSTRAINT `attachment_id_refs_id_2d59d8fc` FOREIGN KEY (`attachment_id`) REFERENCES `post_office_attachment` (`id`),
|
||||
CONSTRAINT `email_id_refs_id_061d81d8` FOREIGN KEY (`email_id`) REFERENCES `post_office_email` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `post_office_emailtemplate` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`description` longtext NOT NULL,
|
||||
`created` datetime NOT NULL,
|
||||
`last_updated` datetime NOT NULL,
|
||||
`subject` varchar(255) NOT NULL,
|
||||
`content` longtext NOT NULL,
|
||||
`html_content` longtext NOT NULL,
|
||||
`language` varchar(12) NOT NULL,
|
||||
`default_template_id` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `language` (`language`,`default_template_id`),
|
||||
KEY `post_office_emailtemplate_84c7951d` (`default_template_id`),
|
||||
CONSTRAINT `default_template_id_refs_id_a2bc649e` FOREIGN KEY (`default_template_id`) REFERENCES `post_office_emailtemplate` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `post_office_email` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`from_email` varchar(254) NOT NULL,
|
||||
`to` longtext NOT NULL,
|
||||
`cc` longtext NOT NULL,
|
||||
`bcc` longtext NOT NULL,
|
||||
`subject` varchar(255) NOT NULL,
|
||||
`message` longtext NOT NULL,
|
||||
`html_message` longtext NOT NULL,
|
||||
`status` smallint(5) unsigned DEFAULT NULL,
|
||||
`priority` smallint(5) unsigned DEFAULT NULL,
|
||||
`created` datetime NOT NULL,
|
||||
`last_updated` datetime NOT NULL,
|
||||
`scheduled_time` datetime DEFAULT NULL,
|
||||
`headers` longtext,
|
||||
`template_id` int(11) DEFAULT NULL,
|
||||
`context` longtext,
|
||||
`backend_alias` varchar(64) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `post_office_email_48fb58bb` (`status`),
|
||||
KEY `post_office_email_63b5ea41` (`created`),
|
||||
KEY `post_office_email_470d4868` (`last_updated`),
|
||||
KEY `post_office_email_c83ff05e` (`scheduled_time`),
|
||||
KEY `post_office_email_43d23afc` (`template_id`),
|
||||
CONSTRAINT `template_id_refs_id_a5d97662` FOREIGN KEY (`template_id`) REFERENCES `post_office_emailtemplate` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `post_office_log` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`email_id` int(11) NOT NULL,
|
||||
`date` datetime NOT NULL,
|
||||
`status` smallint(5) unsigned NOT NULL,
|
||||
`exception_type` varchar(255) NOT NULL,
|
||||
`message` longtext NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `post_office_log_830a6ccb` (`email_id`),
|
||||
CONSTRAINT `email_id_refs_id_3d87f587` FOREIGN KEY (`email_id`) REFERENCES `post_office_email` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `institutions_institution` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(200) NOT NULL,
|
||||
`create_time` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `institutions_institutionadmin` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user` varchar(254) NOT NULL,
|
||||
`institution_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `i_institution_id_5f792d6fe9a87ac9_fk_institutions_institution_id` (`institution_id`),
|
||||
CONSTRAINT `i_institution_id_5f792d6fe9a87ac9_fk_institutions_institution_id` FOREIGN KEY (`institution_id`) REFERENCES `institutions_institution` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `sysadmin_extra_userloginlog` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`login_date` datetime NOT NULL,
|
||||
`login_ip` varchar(128) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `sysadmin_extra_userloginlog_14c4b06b` (`username`),
|
||||
KEY `sysadmin_extra_userloginlog_28ed1ef0` (`login_date`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
ALTER TABLE `sysadmin_extra_userloginlog` MODIFY `login_ip` VARCHAR(128);
|
||||
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
@@ -1 +0,0 @@
|
||||
alter table RepoTokenPeerInfo add client_ver varchar(20);
|
@@ -1,72 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "post_office_attachment" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"file" varchar(100) NOT NULL,
|
||||
"name" varchar(255) NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "post_office_attachment_emails" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"attachment_id" integer NOT NULL,
|
||||
"email_id" integer NOT NULL REFERENCES "post_office_email" ("id"),
|
||||
UNIQUE ("attachment_id", "email_id")
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "post_office_email" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"from_email" varchar(254) NOT NULL,
|
||||
"to" text NOT NULL,
|
||||
"cc" text NOT NULL,
|
||||
"bcc" text NOT NULL,
|
||||
"subject" varchar(255) NOT NULL,
|
||||
"message" text NOT NULL,
|
||||
"html_message" text NOT NULL,
|
||||
"status" smallint unsigned,
|
||||
"priority" smallint unsigned,
|
||||
"created" datetime NOT NULL,
|
||||
"last_updated" datetime NOT NULL,
|
||||
"scheduled_time" datetime,
|
||||
"headers" text,
|
||||
"template_id" integer,
|
||||
"context" text,
|
||||
"backend_alias" varchar(64) NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "post_office_emailtemplate" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"name" varchar(255) NOT NULL,
|
||||
"description" text NOT NULL,
|
||||
"created" datetime NOT NULL,
|
||||
"last_updated" datetime NOT NULL,
|
||||
"subject" varchar(255) NOT NULL,
|
||||
"content" text NOT NULL,
|
||||
"html_content" text NOT NULL,
|
||||
"language" varchar(12) NOT NULL,
|
||||
"default_template_id" integer,
|
||||
UNIQUE ("language", "default_template_id")
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "post_office_log" (
|
||||
"id" integer NOT NULL PRIMARY KEY,
|
||||
"email_id" integer NOT NULL REFERENCES "post_office_email" ("id"),
|
||||
"date" datetime NOT NULL,
|
||||
"status" smallint unsigned NOT NULL,
|
||||
"exception_type" varchar(255) NOT NULL,
|
||||
"message" text NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "institutions_institution" (
|
||||
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"name" varchar(200) NOT NULL,
|
||||
"create_time" datetime NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "institutions_institutionadmin" (
|
||||
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"user" varchar(254) NOT NULL,
|
||||
"institution_id" integer NOT NULL REFERENCES "institutions_institution" ("id")
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "post_office_attachment_emails_4be595e7" ON "post_office_attachment_emails" ("attachment_id");
|
||||
CREATE INDEX IF NOT EXISTS "post_office_attachment_emails_830a6ccb" ON "post_office_attachment_emails" ("email_id");
|
||||
CREATE INDEX IF NOT EXISTS "post_office_email_43d23afc" ON "post_office_email" ("template_id");
|
||||
CREATE INDEX IF NOT EXISTS "post_office_email_470d4868" ON "post_office_email" ("last_updated");
|
||||
CREATE INDEX IF NOT EXISTS "post_office_email_48fb58bb" ON "post_office_email" ("status");
|
||||
CREATE INDEX IF NOT EXISTS "post_office_email_63b5ea41" ON "post_office_email" ("created");
|
||||
CREATE INDEX IF NOT EXISTS "post_office_email_c83ff05e" ON "post_office_email" ("scheduled_time");
|
||||
CREATE INDEX IF NOT EXISTS "post_office_emailtemplate_84c7951d" ON "post_office_emailtemplate" ("default_template_id");
|
||||
CREATE INDEX IF NOT EXISTS "post_office_log_830a6ccb" ON "post_office_log" ("email_id");
|
||||
CREATE INDEX "institutions_institutionadmin_a964baeb" ON "institutions_institutionadmin" ("institution_id");
|
@@ -1,104 +0,0 @@
|
||||
ALTER TABLE api2_tokenv2 ADD COLUMN wiped_at DATETIME DEFAULT NULL;
|
||||
ALTER TABLE api2_tokenv2 ADD COLUMN created_at DATETIME NOT NULL DEFAULT "1970-01-01 00:00:00";
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `base_filecomment` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`repo_id` varchar(36) NOT NULL,
|
||||
`parent_path` longtext NOT NULL,
|
||||
`repo_id_parent_path_md5` varchar(100) NOT NULL,
|
||||
`item_name` longtext NOT NULL,
|
||||
`author` varchar(255) NOT NULL,
|
||||
`comment` longtext NOT NULL,
|
||||
`created_at` datetime NOT NULL,
|
||||
`updated_at` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `base_filecomment_9a8c79bf` (`repo_id`),
|
||||
KEY `base_filecomment_c5bf47d4` (`repo_id_parent_path_md5`),
|
||||
KEY `base_filecomment_02bd92fa` (`author`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `termsandconditions_termsandconditions` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`slug` varchar(50) NOT NULL,
|
||||
`name` longtext NOT NULL,
|
||||
`version_number` decimal(6,2) NOT NULL,
|
||||
`text` longtext,
|
||||
`info` longtext,
|
||||
`date_active` datetime DEFAULT NULL,
|
||||
`date_created` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `termsandconditions_termsandconditions_2dbcba41` (`slug`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `termsandconditions_usertermsandconditions` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) NOT NULL,
|
||||
`ip_address` char(39) DEFAULT NULL,
|
||||
`date_accepted` datetime NOT NULL,
|
||||
`terms_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `termsandconditions_usertermsandcon_username_f4ab54cafa29322_uniq` (`username`,`terms_id`),
|
||||
KEY `e4da106203f3f13ff96409b55de6f515` (`terms_id`),
|
||||
CONSTRAINT `e4da106203f3f13ff96409b55de6f515` FOREIGN KEY (`terms_id`) REFERENCES `termsandconditions_termsandconditions` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `two_factor_totpdevice` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user` varchar(255) NOT NULL,
|
||||
`name` varchar(64) NOT NULL,
|
||||
`confirmed` tinyint(1) NOT NULL,
|
||||
`key` varchar(80) NOT NULL,
|
||||
`step` smallint(5) unsigned NOT NULL,
|
||||
`t0` bigint(20) NOT NULL,
|
||||
`digits` smallint(5) unsigned NOT NULL,
|
||||
`tolerance` smallint(5) unsigned NOT NULL,
|
||||
`drift` smallint(6) NOT NULL,
|
||||
`last_t` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `user` (`user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `two_factor_phonedevice` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user` varchar(255) NOT NULL,
|
||||
`name` varchar(64) NOT NULL,
|
||||
`confirmed` tinyint(1) NOT NULL,
|
||||
`number` varchar(40) NOT NULL,
|
||||
`key` varchar(40) NOT NULL,
|
||||
`method` varchar(4) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `user` (`user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `two_factor_staticdevice` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user` varchar(255) NOT NULL,
|
||||
`name` varchar(64) NOT NULL,
|
||||
`confirmed` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `user` (`user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `two_factor_statictoken` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`token` varchar(16) NOT NULL,
|
||||
`device_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `two_fac_device_id_55a7b345293a7c6c_fk_two_factor_staticdevice_id` (`device_id`),
|
||||
KEY `two_factor_statictoken_94a08da1` (`token`),
|
||||
CONSTRAINT `two_fac_device_id_55a7b345293a7c6c_fk_two_factor_staticdevice_id` FOREIGN KEY (`device_id`) REFERENCES `two_factor_staticdevice` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `invitations_invitation` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`token` varchar(40) NOT NULL,
|
||||
`inviter` varchar(255) NOT NULL,
|
||||
`accepter` varchar(255) NOT NULL,
|
||||
`invite_time` datetime NOT NULL,
|
||||
`accept_time` datetime DEFAULT NULL,
|
||||
`invite_type` varchar(20) NOT NULL,
|
||||
`expire_time` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `invitations_invitation_d5dd16f8` (`inviter`),
|
||||
KEY `invitations_invitation_token_1961fbb98c05e5fd_uniq` (`token`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
@@ -1,24 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "base_filecomment" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "repo_id" varchar(36) NOT NULL, "parent_path" text NOT NULL, "repo_id_parent_path_md5" varchar(100) NOT NULL, "item_name" text NOT NULL, "author" varchar(255) NOT NULL, "comment" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
|
||||
CREATE INDEX IF NOT EXISTS "base_filecomment_02bd92fa" ON "base_filecomment" ("author");
|
||||
CREATE INDEX IF NOT EXISTS "base_filecomment_9a8c79bf" ON "base_filecomment" ("repo_id");
|
||||
CREATE INDEX IF NOT EXISTS "base_filecomment_c5bf47d4" ON "base_filecomment" ("repo_id_parent_path_md5");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "termsandconditions_termsandconditions" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "slug" varchar(50) NOT NULL, "name" text NOT NULL, "version_number" decimal NOT NULL, "text" text NULL, "info" text NULL, "date_active" datetime NULL, "date_created" datetime NOT NULL);
|
||||
CREATE INDEX IF NOT EXISTS "termsandconditions_termsandconditions_2dbcba41" ON "termsandconditions_termsandconditions" ("slug");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "termsandconditions_usertermsandconditions" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "username" varchar(255) NOT NULL, "ip_address" char(39) NULL, "date_accepted" datetime NOT NULL, "terms_id" integer NOT NULL REFERENCES "termsandconditions_termsandconditions" ("id"), UNIQUE ("username", "terms_id"));
|
||||
CREATE INDEX IF NOT EXISTS "termsandconditions_usertermsandconditions_2ab34720" ON "termsandconditions_usertermsandconditions" ("terms_id");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "two_factor_phonedevice" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "user" varchar(255) NOT NULL UNIQUE, "name" varchar(64) NOT NULL, "confirmed" bool NOT NULL, "number" varchar(40) NOT NULL, "key" varchar(40) NOT NULL, "method" varchar(4) NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "two_factor_staticdevice" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "user" varchar(255) NOT NULL UNIQUE, "name" varchar(64) NOT NULL, "confirmed" bool NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "two_factor_statictoken" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "token" varchar(16) NOT NULL, "device_id" integer NOT NULL REFERENCES "two_factor_staticdevice" ("id"));
|
||||
CREATE TABLE IF NOT EXISTS "two_factor_totpdevice" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "user" varchar(255) NOT NULL UNIQUE, "name" varchar(64) NOT NULL, "confirmed" bool NOT NULL, "key" varchar(80) NOT NULL, "step" smallint unsigned NOT NULL, "t0" bigint NOT NULL, "digits" smallint unsigned NOT NULL, "tolerance" smallint unsigned NOT NULL, "drift" smallint NOT NULL, "last_t" bigint NOT NULL);
|
||||
CREATE INDEX IF NOT EXISTS "two_factor_statictoken_94a08da1" ON "two_factor_statictoken" ("token");
|
||||
CREATE INDEX IF NOT EXISTS "two_factor_statictoken_9379346c" ON "two_factor_statictoken" ("device_id");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "invitations_invitation" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "token" varchar(40) NOT NULL, "inviter" varchar(255) NOT NULL, "accepter" varchar(255) NOT NULL, "invite_time" datetime NOT NULL, "accept_time" datetime NULL, "invite_type" varchar(20) NOT NULL, "expire_time" datetime NOT NULL);
|
||||
CREATE INDEX IF NOT EXISTS "invitations_invitation_94a08da1" ON "invitations_invitation" ("token");
|
||||
CREATE INDEX IF NOT EXISTS "invitations_invitation_d5dd16f8" ON "invitations_invitation" ("inviter");
|
||||
|
||||
ALTER TABLE api2_tokenv2 ADD COLUMN wiped_at datetime DEFAULT NULL;
|
||||
ALTER TABLE api2_tokenv2 ADD COLUMN created_at datetime NOT NULL DEFAULT '1970-01-01 00:00:00';
|
@@ -1,121 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
|
||||
prev_version=1.2.0
|
||||
current_version=1.3.0
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
check_python_executable
|
||||
read_seafile_data_dir
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "manage.py run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# run django syncdb command
|
||||
echo "------------------------------"
|
||||
echo "updating seahub database ... "
|
||||
echo
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
pushd "${INSTALLPATH}/seahub" 2>/dev/null 1>&2
|
||||
if ! $PYTHON manage.py syncdb 2>/dev/null 1>&2; then
|
||||
echo "failed"
|
||||
exit -1
|
||||
fi
|
||||
popd 2>/dev/null 1>&2
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
||||
|
||||
echo "------------------------------"
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars ${media_dir}
|
||||
|
||||
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}
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
@@ -1,119 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
|
||||
prev_version=1.3
|
||||
current_version=1.4.0
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
check_python_executable
|
||||
read_seafile_data_dir
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "manage.py run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "------------------------------"
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars ${media_dir}
|
||||
|
||||
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}
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
||||
|
||||
# update database
|
||||
echo "------------------------------"
|
||||
echo "updating seahub database ... "
|
||||
echo
|
||||
|
||||
db_update_py=$UPGRADE_DIR/db_update_1.3_1.4.py
|
||||
if ! $PYTHON $db_update_py $default_seahub_db 1>/dev/null; then
|
||||
echo "failed"
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
@@ -1,106 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
|
||||
prev_version=1.4
|
||||
current_version=1.5
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
check_python_executable
|
||||
read_seafile_data_dir
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "manage.py run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "------------------------------"
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars ${media_dir}
|
||||
|
||||
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}
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
@@ -1,122 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
|
||||
prev_version=1.5
|
||||
current_version=1.6
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
check_python_executable
|
||||
read_seafile_data_dir
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "manage.py run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "------------------------------"
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars ${media_dir}
|
||||
|
||||
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}
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
||||
|
||||
echo
|
||||
echo "------------------------------"
|
||||
echo "Updating seahub database ..."
|
||||
echo
|
||||
|
||||
seahub_db=${TOPDIR}/seahub.db
|
||||
seahub_sql=${UPGRADE_DIR}/sql/1.6.0/sqlite3/seahub.sql
|
||||
if ! sqlite3 "${seahub_db}" < "${seahub_sql}"; then
|
||||
echo "Failed to update seahub database"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
@@ -1,137 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
|
||||
prev_version=1.6
|
||||
current_version=1.7
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
check_python_executable
|
||||
read_seafile_data_dir
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_fcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "------------------------------"
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars ${media_dir}
|
||||
|
||||
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}
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
||||
|
||||
echo
|
||||
echo "------------------------------"
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
seahub_db=${TOPDIR}/seahub.db
|
||||
seahub_sql=${UPGRADE_DIR}/sql/1.7.0/sqlite3/seahub.sql
|
||||
if ! sqlite3 "${seahub_db}" < "${seahub_sql}"; then
|
||||
echo "Failed to update seahub database"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
seafile_db=${seafile_data_dir}/seafile.db
|
||||
seafile_sql=${UPGRADE_DIR}/sql/1.7.0/sqlite3/seafile.sql
|
||||
if ! sqlite3 "${seafile_db}" < "${seafile_sql}"; then
|
||||
echo "Failed to update seafile database"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
@@ -1,130 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
|
||||
prev_version=1.7
|
||||
current_version=1.8
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
check_python_executable
|
||||
read_seafile_data_dir
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_fcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "------------------------------"
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars ${media_dir}
|
||||
|
||||
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}
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
||||
|
||||
echo
|
||||
echo "------------------------------"
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
seahub_db=${TOPDIR}/seahub.db
|
||||
seahub_sql=${UPGRADE_DIR}/sql/1.8.0/sqlite3/seahub.sql
|
||||
if ! sqlite3 "${seahub_db}" < "${seahub_sql}"; then
|
||||
echo "Failed to update seahub database"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
@@ -1,137 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
|
||||
prev_version=1.8
|
||||
current_version=2.0
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
check_python_executable
|
||||
read_seafile_data_dir
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_fcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "------------------------------"
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars ${media_dir}
|
||||
|
||||
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}
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
||||
|
||||
echo
|
||||
echo "------------------------------"
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
seahub_db=${TOPDIR}/seahub.db
|
||||
seahub_sql=${UPGRADE_DIR}/sql/2.0.0/sqlite3/seahub.sql
|
||||
if ! sqlite3 "${seahub_db}" < "${seahub_sql}"; then
|
||||
echo "Failed to update seahub database"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
add_collate_script=${UPGRADE_DIR}/add_collate.sh
|
||||
echo "fix seafile database case issues..."
|
||||
if ! ${add_collate_script} ${default_ccnet_conf_dir} ${seafile_data_dir} ${seahub_db}; then
|
||||
echo "Failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
echo "------------------------------"
|
||||
echo
|
@@ -1,206 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
|
||||
prev_version=2.0
|
||||
current_version=2.1
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_fcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 2.1.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
if [[ -L "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function gen_seafdav_conf() {
|
||||
echo
|
||||
echo "generating seafdav.conf ..."
|
||||
echo
|
||||
seafdav_conf=${default_conf_dir}/seafdav.conf
|
||||
mkdir -p "${default_conf_dir}"
|
||||
if ! $(cat > "${seafdav_conf}" <<EOF
|
||||
[WEBDAV]
|
||||
enabled = false
|
||||
port = 8080
|
||||
fastcgi = false
|
||||
share_name = /
|
||||
EOF
|
||||
); then
|
||||
echo "failed to generate seafdav.conf";
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function copy_user_manuals() {
|
||||
echo
|
||||
echo "copying user manuals ..."
|
||||
echo
|
||||
src_docs_dir=${INSTALLPATH}/seafile/docs/
|
||||
library_template_dir=${seafile_data_dir}/library-template
|
||||
mkdir -p "${library_template_dir}"
|
||||
cp -f "${src_docs_dir}"/*.doc "${library_template_dir}"
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
|
||||
migrate_avatars;
|
||||
|
||||
update_database;
|
||||
|
||||
gen_seafdav_conf;
|
||||
|
||||
copy_user_manuals;
|
||||
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
@@ -1,171 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
|
||||
prev_version=2.1
|
||||
current_version=2.2
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_fcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 2.2.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
if [[ -L "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
|
||||
migrate_avatars;
|
||||
|
||||
update_database;
|
||||
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
@@ -1,211 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||
|
||||
prev_version=2.2
|
||||
current_version=3.0
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_fcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 3.0.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
if [[ -L "${seafile_server_symlink}" || ! -e "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[32m${seafile_server_symlink}\033[m symbolic link to \033[32m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function show_notice_for_s3_ceph_user() {
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Important: You are using ${backend} storage, please follow the following "
|
||||
echo "upgrade notice to migrate your data to 3.0 format"
|
||||
echo
|
||||
echo " http://seacloud.cc/group/180/wiki/seafile-pro-3.0-upgrade-notice/"
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
||||
echo
|
||||
}
|
||||
|
||||
check_backend_py=${UPGRADE_DIR}/check_backend.py
|
||||
backend=
|
||||
function migrate_seafile_data_format() {
|
||||
backend=$($PYTHON ${check_backend_py})
|
||||
if [[ "${backend}" == "s3" || "${backend}" == "ceph" ]]; then
|
||||
return
|
||||
fi
|
||||
seaf_migrate=${INSTALLPATH}/seafile/bin/seaf-migrate
|
||||
echo
|
||||
echo "Now migrating your seafile data to 3.0 format. It may take a while."
|
||||
echo
|
||||
if ! LD_LIBRARY_PATH=${SEAFILE_LD_LIBRARY_PATH} ${seaf_migrate} \
|
||||
-c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}"; then
|
||||
echo
|
||||
echo "Failed to migrate seafile data to 3.0 format"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
echo
|
||||
echo "Successfully migrated seafile data to 3.0 format"
|
||||
echo
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
|
||||
migrate_seafile_data_format;
|
||||
|
||||
migrate_avatars;
|
||||
|
||||
update_database;
|
||||
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
if [[ "${backend}" == "s3" || "${backend}" == "ceph" ]]; then
|
||||
show_notice_for_s3_ceph_user;
|
||||
else
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
||||
fi
|
@@ -1,215 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
seahub_data_dir=${TOPDIR}/seahub-data
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||
|
||||
prev_version=3.0
|
||||
current_version=3.1
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} runfcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 3.1.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
if [[ -L "${seafile_server_symlink}" || ! -e "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function make_media_custom_symlink() {
|
||||
media_symlink=${INSTALLPATH}/seahub/media/custom
|
||||
if [[ -L "${media_symlink}" ]]; then
|
||||
return
|
||||
|
||||
elif [[ ! -e "${media_symlink}" ]]; then
|
||||
ln -s ../../../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}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function move_old_customdir_outside() {
|
||||
# find the path of the latest seafile server folder
|
||||
if [[ -L ${seafile_server_symlink} ]]; then
|
||||
latest_server=$(readlink -f "${seafile_server_symlink}")
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
old_customdir=${latest_server}/seahub/media/custom
|
||||
|
||||
# old customdir is already a symlink, do nothing
|
||||
if [[ -L "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# old customdir does not exist, do nothing
|
||||
if [[ ! -e "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# media/custom exist and is not a symlink
|
||||
cp -rf "${old_customdir}" "${seahub_data_dir}/"
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
migrate_avatars;
|
||||
|
||||
update_database;
|
||||
|
||||
move_old_customdir_outside;
|
||||
make_media_custom_symlink;
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
@@ -1,215 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
seahub_data_dir=${TOPDIR}/seahub-data
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||
|
||||
prev_version=3.1
|
||||
current_version=4.0
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} runfcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 4.0.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
if [[ -L "${seafile_server_symlink}" || ! -e "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function make_media_custom_symlink() {
|
||||
media_symlink=${INSTALLPATH}/seahub/media/custom
|
||||
if [[ -L "${media_symlink}" ]]; then
|
||||
return
|
||||
|
||||
elif [[ ! -e "${media_symlink}" ]]; then
|
||||
ln -s ../../../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}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function move_old_customdir_outside() {
|
||||
# find the path of the latest seafile server folder
|
||||
if [[ -L ${seafile_server_symlink} ]]; then
|
||||
latest_server=$(readlink -f "${seafile_server_symlink}")
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
old_customdir=${latest_server}/seahub/media/custom
|
||||
|
||||
# old customdir is already a symlink, do nothing
|
||||
if [[ -L "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# old customdir does not exist, do nothing
|
||||
if [[ ! -e "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# media/custom exist and is not a symlink
|
||||
cp -rf "${old_customdir}" "${seahub_data_dir}/"
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
migrate_avatars;
|
||||
|
||||
update_database;
|
||||
|
||||
move_old_customdir_outside;
|
||||
make_media_custom_symlink;
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
@@ -1,235 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
seahub_data_dir=${TOPDIR}/seahub-data
|
||||
seahub_settings_py=${TOPDIR}/seahub_settings.py
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||
|
||||
prev_version=4.0
|
||||
current_version=4.1
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} runfcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 4.1.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function fix_mysql_user() {
|
||||
|
||||
fix_script=${UPGRADE_DIR}/fix_mysql_user.py
|
||||
if ! $PYTHON "${fix_script}"; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
if [[ -L "${seafile_server_symlink}" || ! -e "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function make_media_custom_symlink() {
|
||||
media_symlink=${INSTALLPATH}/seahub/media/custom
|
||||
if [[ -L "${media_symlink}" ]]; then
|
||||
return
|
||||
|
||||
elif [[ ! -e "${media_symlink}" ]]; then
|
||||
ln -s ../../../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}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function move_old_customdir_outside() {
|
||||
# find the path of the latest seafile server folder
|
||||
if [[ -L ${seafile_server_symlink} ]]; then
|
||||
latest_server=$(readlink -f "${seafile_server_symlink}")
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
old_customdir=${latest_server}/seahub/media/custom
|
||||
|
||||
# old customdir is already a symlink, do nothing
|
||||
if [[ -L "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# old customdir does not exist, do nothing
|
||||
if [[ ! -e "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# media/custom exist and is not a symlink
|
||||
cp -rf "${old_customdir}" "${seahub_data_dir}/"
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
fix_mysql_user;
|
||||
update_database;
|
||||
|
||||
migrate_avatars;
|
||||
|
||||
|
||||
move_old_customdir_outside;
|
||||
make_media_custom_symlink;
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
chmod 0600 "$seahub_settings_py"
|
||||
chmod 0700 "$seafile_data_dir"
|
||||
chmod 0700 "$default_ccnet_conf_dir"
|
||||
chmod 0700 "$default_conf_dir"
|
||||
chmod 0700 "$TOPDIR"/pro-data
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
@@ -1,226 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
seahub_data_dir=${TOPDIR}/seahub-data
|
||||
seahub_settings_py=${TOPDIR}/seahub_settings.py
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||
|
||||
prev_version=4.1
|
||||
current_version=4.2
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} runfcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 4.2.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
if [[ -L "${seafile_server_symlink}" || ! -e "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function make_media_custom_symlink() {
|
||||
media_symlink=${INSTALLPATH}/seahub/media/custom
|
||||
if [[ -L "${media_symlink}" ]]; then
|
||||
return
|
||||
|
||||
elif [[ ! -e "${media_symlink}" ]]; then
|
||||
ln -s ../../../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}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function move_old_customdir_outside() {
|
||||
# find the path of the latest seafile server folder
|
||||
if [[ -L ${seafile_server_symlink} ]]; then
|
||||
latest_server=$(readlink -f "${seafile_server_symlink}")
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
old_customdir=${latest_server}/seahub/media/custom
|
||||
|
||||
# old customdir is already a symlink, do nothing
|
||||
if [[ -L "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# old customdir does not exist, do nothing
|
||||
if [[ ! -e "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# media/custom exist and is not a symlink
|
||||
cp -rf "${old_customdir}" "${seahub_data_dir}/"
|
||||
}
|
||||
|
||||
function remove_es_index() {
|
||||
local es_data_dir=$TOPDIR/pro-data/search/data
|
||||
echo -n "Removing old search index ... "
|
||||
rm -rf $es_data_dir && mkdir -p $es_data_dir
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
update_database;
|
||||
|
||||
# We changed elasticsearch index settings in 4.2.0, need to recreate the index.
|
||||
remove_es_index;
|
||||
|
||||
migrate_avatars;
|
||||
|
||||
|
||||
move_old_customdir_outside;
|
||||
make_media_custom_symlink;
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
@@ -1,241 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
seahub_data_dir=${TOPDIR}/seahub-data
|
||||
seahub_settings_py=${TOPDIR}/seahub_settings.py
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||
|
||||
prev_version=4.2
|
||||
current_version=4.3
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} runfcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 4.3.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
if [[ -L "${seafile_server_symlink}" || ! -e "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function make_media_custom_symlink() {
|
||||
media_symlink=${INSTALLPATH}/seahub/media/custom
|
||||
if [[ -L "${media_symlink}" ]]; then
|
||||
return
|
||||
|
||||
elif [[ ! -e "${media_symlink}" ]]; then
|
||||
ln -s ../../../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}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function move_old_customdir_outside() {
|
||||
# find the path of the latest seafile server folder
|
||||
if [[ -L ${seafile_server_symlink} ]]; then
|
||||
latest_server=$(readlink -f "${seafile_server_symlink}")
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
old_customdir=${latest_server}/seahub/media/custom
|
||||
|
||||
# old customdir is already a symlink, do nothing
|
||||
if [[ -L "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# old customdir does not exist, do nothing
|
||||
if [[ ! -e "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# media/custom exist and is not a symlink
|
||||
cp -rf "${old_customdir}" "${seahub_data_dir}/"
|
||||
}
|
||||
|
||||
function regenerate_secret_key() {
|
||||
regenerate_secret_key_script=$UPGRADE_DIR/regenerate_secret_key.sh
|
||||
if ! $regenerate_secret_key_script ; then
|
||||
echo "Failed to regenerate the seahub secret key"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function remove_es_index() {
|
||||
local es_data_dir=$TOPDIR/pro-data/search/data
|
||||
echo -n "Removing old search index ... "
|
||||
rm -rf $es_data_dir && mkdir -p $es_data_dir
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function remove_office_files() {
|
||||
rm -rf /tmp/seafile-office-output/html/*
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
regenerate_secret_key;
|
||||
|
||||
update_database;
|
||||
|
||||
# We changed elasticsearch index settings in 4.3.0, need to recreate the index.
|
||||
remove_es_index;
|
||||
remove_office_files;
|
||||
|
||||
migrate_avatars;
|
||||
|
||||
|
||||
move_old_customdir_outside;
|
||||
make_media_custom_symlink;
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
@@ -1,216 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||
default_seahub_db=${TOPDIR}/seahub.db
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
seahub_data_dir=${TOPDIR}/seahub-data
|
||||
seahub_settings_py=${TOPDIR}/seahub_settings.py
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||
|
||||
prev_version=4.3
|
||||
current_version=4.4
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} runfcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 4.4.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
if [[ -L "${seafile_server_symlink}" || ! -e "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function make_media_custom_symlink() {
|
||||
media_symlink=${INSTALLPATH}/seahub/media/custom
|
||||
if [[ -L "${media_symlink}" ]]; then
|
||||
return
|
||||
|
||||
elif [[ ! -e "${media_symlink}" ]]; then
|
||||
ln -s ../../../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}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function move_old_customdir_outside() {
|
||||
# find the path of the latest seafile server folder
|
||||
if [[ -L ${seafile_server_symlink} ]]; then
|
||||
latest_server=$(readlink -f "${seafile_server_symlink}")
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
old_customdir=${latest_server}/seahub/media/custom
|
||||
|
||||
# old customdir is already a symlink, do nothing
|
||||
if [[ -L "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# old customdir does not exist, do nothing
|
||||
if [[ ! -e "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# media/custom exist and is not a symlink
|
||||
cp -rf "${old_customdir}" "${seahub_data_dir}/"
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
update_database;
|
||||
|
||||
migrate_avatars;
|
||||
|
||||
|
||||
move_old_customdir_outside;
|
||||
make_media_custom_symlink;
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
@@ -1,245 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
seahub_data_dir=${TOPDIR}/seahub-data
|
||||
seahub_settings_py=${TOPDIR}/seahub_settings.py
|
||||
pro_data_dir=${TOPDIR}/pro-data
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export SEAFILE_CENTRAL_CONF_DIR=${default_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||
|
||||
prev_version=4.4
|
||||
current_version=5.0
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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
|
||||
elif which python2.6 2>/dev/null 1>&2; then
|
||||
PYTHON=python2.6
|
||||
elif which python26 2>/dev/null 1>&2; then
|
||||
PYTHON=python26
|
||||
else
|
||||
echo
|
||||
echo "Can't find a python executable of version 2.6 or above in PATH"
|
||||
echo "Install python 2.6+ before continue."
|
||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} runfcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 5.0.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
if [[ -L "${seafile_server_symlink}" || ! -e "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function make_media_custom_symlink() {
|
||||
media_symlink=${INSTALLPATH}/seahub/media/custom
|
||||
if [[ -L "${media_symlink}" ]]; then
|
||||
return
|
||||
|
||||
elif [[ ! -e "${media_symlink}" ]]; then
|
||||
ln -s ../../../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}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function move_old_customdir_outside() {
|
||||
# find the path of the latest seafile server folder
|
||||
if [[ -L ${seafile_server_symlink} ]]; then
|
||||
latest_server=$(readlink -f "${seafile_server_symlink}")
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
old_customdir=${latest_server}/seahub/media/custom
|
||||
|
||||
# old customdir is already a symlink, do nothing
|
||||
if [[ -L "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# old customdir does not exist, do nothing
|
||||
if [[ ! -e "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# media/custom exist and is not a symlink
|
||||
cp -rf "${old_customdir}" "${seahub_data_dir}/"
|
||||
}
|
||||
|
||||
function regenerate_secret_key() {
|
||||
regenerate_secret_key_script=$UPGRADE_DIR/regenerate_secret_key.sh
|
||||
if ! $regenerate_secret_key_script ; then
|
||||
echo "Failed to regenerate the seahub secret key"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# copy ccnet.conf/seafile.conf etc. to conf/ dir, and make the original files read-only
|
||||
function copy_confs_to_central_conf_dir() {
|
||||
local confs=(
|
||||
$default_ccnet_conf_dir/ccnet.conf
|
||||
$seafile_data_dir/seafile.conf
|
||||
$seahub_settings_py
|
||||
$pro_data_dir/seafevents.conf
|
||||
)
|
||||
for conffile in ${confs[*]}; do
|
||||
if grep -q "This file has been moved" $conffile; then
|
||||
continue
|
||||
fi
|
||||
cp $conffile $conffile.seafile-5.0.0-bak
|
||||
cp -av $conffile $default_conf_dir/
|
||||
cat >$conffile<<EOF
|
||||
# This file has been moved to $default_conf_dir/$(basename $conffile) in seafile 5.0.0
|
||||
EOF
|
||||
chmod a-w $conffile
|
||||
done
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
update_database;
|
||||
migrate_avatars;
|
||||
|
||||
copy_confs_to_central_conf_dir;
|
||||
|
||||
move_old_customdir_outside;
|
||||
make_media_custom_symlink;
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
@@ -1,238 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
seahub_data_dir=${TOPDIR}/seahub-data
|
||||
seahub_settings_py=${TOPDIR}/seahub_settings.py
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export SEAFILE_CENTRAL_CONF_DIR=${default_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||
|
||||
prev_version=5.0
|
||||
current_version=5.1
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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 variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 \
|
||||
|| pgrep -f "seahub.wsgi:application" 2>/dev/null 1>&2; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} runfcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 5.1.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
if [[ -L "${seafile_server_symlink}" || ! -e "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function make_media_custom_symlink() {
|
||||
media_symlink=${INSTALLPATH}/seahub/media/custom
|
||||
if [[ -L "${media_symlink}" ]]; then
|
||||
return
|
||||
|
||||
elif [[ ! -e "${media_symlink}" ]]; then
|
||||
ln -s ../../../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}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function move_old_customdir_outside() {
|
||||
# find the path of the latest seafile server folder
|
||||
if [[ -L ${seafile_server_symlink} ]]; then
|
||||
latest_server=$(readlink -f "${seafile_server_symlink}")
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
old_customdir=${latest_server}/seahub/media/custom
|
||||
|
||||
# old customdir is already a symlink, do nothing
|
||||
if [[ -L "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# old customdir does not exist, do nothing
|
||||
if [[ ! -e "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# media/custom exist and is not a symlink
|
||||
cp -rf "${old_customdir}" "${seahub_data_dir}/"
|
||||
}
|
||||
|
||||
function regenerate_secret_key() {
|
||||
regenerate_secret_key_script=$UPGRADE_DIR/regenerate_secret_key.sh
|
||||
if ! $regenerate_secret_key_script ; then
|
||||
echo "Failed to regenerate the seahub secret key"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# copy ccnet.conf/seafile.conf etc. to conf/ dir, and make the original files read-only
|
||||
function copy_confs_to_central_conf_dir() {
|
||||
local confs=(
|
||||
$default_ccnet_conf_dir/ccnet.conf
|
||||
$seafile_data_dir/seafile.conf
|
||||
$seahub_settings_py
|
||||
)
|
||||
for conffile in ${confs[*]}; do
|
||||
if grep -q "This file has been moved" $conffile; then
|
||||
continue
|
||||
fi
|
||||
cp $conffile $conffile.seafile-5.0.0-bak
|
||||
cp -av $conffile $default_conf_dir/
|
||||
cat >$conffile<<EOF
|
||||
# This file has been moved to $default_conf_dir/$(basename $conffile) in seafile 5.0.0
|
||||
EOF
|
||||
chmod a-w $conffile
|
||||
done
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
update_database;
|
||||
migrate_avatars;
|
||||
|
||||
move_old_customdir_outside;
|
||||
make_media_custom_symlink;
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
@@ -1,210 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
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/
|
||||
TOPDIR=$(dirname "${INSTALLPATH}") # haiwen/
|
||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||
default_conf_dir=${TOPDIR}/conf
|
||||
seafile_server_symlink=${TOPDIR}/seafile-server-latest
|
||||
seahub_data_dir=${TOPDIR}/seahub-data
|
||||
seahub_settings_py=${TOPDIR}/seahub_settings.py
|
||||
|
||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||
|
||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||
export SEAFILE_CENTRAL_CONF_DIR=${default_conf_dir}
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.6/site-packages:${INSTALLPATH}/seafile/lib64/python2.6/site-packages:${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python2.7/site-packages:${INSTALLPATH}/seafile/lib64/python2.7/site-packages:$PYTHONPATH
|
||||
export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
|
||||
|
||||
prev_version=5.1
|
||||
current_version=6.0
|
||||
|
||||
echo
|
||||
echo "-------------------------------------------------------------"
|
||||
echo "This script would upgrade your seafile server from ${prev_version} to ${current_version}"
|
||||
echo "Press [ENTER] to contiune"
|
||||
echo "-------------------------------------------------------------"
|
||||
echo
|
||||
read dummy
|
||||
|
||||
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 variable to it"
|
||||
echo
|
||||
exit 1
|
||||
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."
|
||||
echo ""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export SEAFILE_CONF_DIR=$seafile_data_dir
|
||||
}
|
||||
|
||||
function ensure_server_not_running() {
|
||||
# test whether seafile server has been stopped.
|
||||
if pgrep seaf-server 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seafile server is still running !"
|
||||
echo "stop it using scripts before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} run_gunicorn" 2>/dev/null 1>&2 \
|
||||
|| pgrep -f "seahub.wsgi:application" 2>/dev/null 1>&2; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
elif pgrep -f "${manage_py} runfcgi" 2>/dev/null 1>&2 ; then
|
||||
echo
|
||||
echo "seahub server is still running !"
|
||||
echo "stop it before upgrade."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function migrate_avatars() {
|
||||
echo
|
||||
echo "migrating avatars ..."
|
||||
echo
|
||||
media_dir=${INSTALLPATH}/seahub/media
|
||||
orig_avatar_dir=${INSTALLPATH}/seahub/media/avatars
|
||||
dest_avatar_dir=${TOPDIR}/seahub-data/avatars
|
||||
|
||||
# move "media/avatars" directory outside
|
||||
if [[ ! -d ${dest_avatar_dir} ]]; then
|
||||
mkdir -p "${TOPDIR}/seahub-data"
|
||||
mv "${orig_avatar_dir}" "${dest_avatar_dir}" 2>/dev/null 1>&2
|
||||
ln -s ../../../seahub-data/avatars "${media_dir}"
|
||||
|
||||
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}"
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function update_database() {
|
||||
echo
|
||||
echo "Updating seafile/seahub database ..."
|
||||
echo
|
||||
|
||||
db_update_helper=${UPGRADE_DIR}/db_update_helper.py
|
||||
if ! $PYTHON "${db_update_helper}" 6.0.0; then
|
||||
echo
|
||||
echo "Failed to upgrade your database"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
function upgrade_seafile_server_latest_symlink() {
|
||||
# update the symlink seafile-server to the new server version
|
||||
if [[ -L "${seafile_server_symlink}" || ! -e "${seafile_server_symlink}" ]]; then
|
||||
echo
|
||||
printf "updating \033[33m${seafile_server_symlink}\033[m symbolic link to \033[33m${INSTALLPATH}\033[m ...\n\n"
|
||||
echo
|
||||
if ! rm -f "${seafile_server_symlink}"; then
|
||||
echo "Failed to remove ${seafile_server_symlink}"
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if ! ln -s "$(basename ${INSTALLPATH})" "${seafile_server_symlink}"; then
|
||||
echo "Failed to update ${seafile_server_symlink} symbolic link."
|
||||
echo
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function make_media_custom_symlink() {
|
||||
media_symlink=${INSTALLPATH}/seahub/media/custom
|
||||
if [[ -L "${media_symlink}" ]]; then
|
||||
return
|
||||
|
||||
elif [[ ! -e "${media_symlink}" ]]; then
|
||||
ln -s ../../../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}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function move_old_customdir_outside() {
|
||||
# find the path of the latest seafile server folder
|
||||
if [[ -L ${seafile_server_symlink} ]]; then
|
||||
latest_server=$(readlink -f "${seafile_server_symlink}")
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
old_customdir=${latest_server}/seahub/media/custom
|
||||
|
||||
# old customdir is already a symlink, do nothing
|
||||
if [[ -L "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# old customdir does not exist, do nothing
|
||||
if [[ ! -e "${old_customdir}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# media/custom exist and is not a symlink
|
||||
cp -rf "${old_customdir}" "${seahub_data_dir}/"
|
||||
}
|
||||
|
||||
#################
|
||||
# The main execution flow of the script
|
||||
################
|
||||
|
||||
check_python_executable;
|
||||
read_seafile_data_dir;
|
||||
ensure_server_not_running;
|
||||
|
||||
update_database;
|
||||
migrate_avatars;
|
||||
|
||||
move_old_customdir_outside;
|
||||
make_media_custom_symlink;
|
||||
upgrade_seafile_server_latest_symlink;
|
||||
|
||||
echo
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo "Upgraded your seafile server successfully."
|
||||
echo "-----------------------------------------------------------------"
|
||||
echo
|
Reference in New Issue
Block a user