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

61 lines
3.8 KiB

--- a/scripts/sqlite2mysql.sh
+++ b/scripts/sqlite2mysql.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# This shell script and corresponding sqlite2mysql.py are used to
# migrate Seafile data from SQLite to MySQL.
@@ -38,10 +38,10 @@ fi
rm -rf ${CCNET_DB}
-echo "sqlite3 ${USER_MGR_DB} .dump | python sqlite2mysql.py > ${CCNET_DB}"
-sqlite3 ${USER_MGR_DB} .dump | python sqlite2mysql.py > ${CCNET_DB}
-echo "sqlite3 ${GRP_MGR_DB} .dump | python sqlite2mysql.py >> ${CCNET_DB}"
-sqlite3 ${GRP_MGR_DB} .dump | python sqlite2mysql.py >> ${CCNET_DB}
+echo "sqlite3 ${USER_MGR_DB} .dump | python3 sqlite2mysql.py > ${CCNET_DB}"
+sqlite3 ${USER_MGR_DB} .dump | python3 sqlite2mysql.py > ${CCNET_DB}
+echo "sqlite3 ${GRP_MGR_DB} .dump | python3 sqlite2mysql.py >> ${CCNET_DB}"
+sqlite3 ${GRP_MGR_DB} .dump | python3 sqlite2mysql.py >> ${CCNET_DB}
# change ctime from INTEGER to BIGINT in EmailUser table
sed 's/ctime INTEGER/ctime BIGINT/g' ${CCNET_DB} > ${CCNET_DB}.tmp && mv ${CCNET_DB}.tmp ${CCNET_DB}
@@ -53,14 +53,14 @@ sed 's/email TEXT, role TEXT/email VARCH
rm -rf ${SEAFILE_DB}
if [ -f "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db" ]; then
- echo "sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db .dump | python sqlite2mysql.py > ${SEAFILE_DB}"
- sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db .dump | python sqlite2mysql.py > ${SEAFILE_DB}
+ echo "sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db .dump | python3 sqlite2mysql.py > ${SEAFILE_DB}"
+ sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db .dump | python3 sqlite2mysql.py > ${SEAFILE_DB}
else
echo "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seafile-data/seafile.db does not exists."
read -p "Please provide your seafile.db path(e.g. /data/haiwen/seafile-data/seafile.db): " seafile_db_path
if [ -f ${seafile_db_path} ];then
- echo "sqlite3 ${seafile_db_path} .dump | python sqlite2mysql.py > ${SEAFILE_DB}"
- sqlite3 ${seafile_db_path} .dump | python sqlite2mysql.py > ${SEAFILE_DB}
+ echo "sqlite3 ${seafile_db_path} .dump | python3 sqlite2mysql.py > ${SEAFILE_DB}"
+ sqlite3 ${seafile_db_path} .dump | python3 sqlite2mysql.py > ${SEAFILE_DB}
else
echo "${seafile_db_path} does not exists, quit."
exit 1
@@ -77,14 +77,14 @@ sed 's/user_name TEXT/user_name VARCHAR(
rm -rf ${SEAHUB_DB}
if [ -f "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db" ]; then
- echo "sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB}"
- sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB}
+ echo "sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python3 sqlite2mysql.py > ${SEAHUB_DB}"
+ sqlite3 ${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db .dump | tr -d '\n' | sed 's/;/;\n/g' | python3 sqlite2mysql.py > ${SEAHUB_DB}
else
echo "${SEAFILE_UCI_DATA_DIR-$seafile_path}/seahub.db does not exists."
read -p "Please prove your seahub.db path(e.g. /data/haiwen/seahub.db): " seahub_db_path
if [ -f ${seahub_db_path} ]; then
- echo "sqlite3 ${seahub_db_path} .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB}"
- sqlite3 ${seahub_db_path} .dump | tr -d '\n' | sed 's/;/;\n/g' | python sqlite2mysql.py > ${SEAHUB_DB}
+ echo "sqlite3 ${seahub_db_path} .dump | tr -d '\n' | sed 's/;/;\n/g' | python3 sqlite2mysql.py > ${SEAHUB_DB}"
+ sqlite3 ${seahub_db_path} .dump | tr -d '\n' | sed 's/;/;\n/g' | python3 sqlite2mysql.py > ${SEAHUB_DB}
else
echo "${seahub_db_path} does not exists, quit."
exit 1