From 8d83cf1c31683a7e7d011d80c04b5a6b6fb61b46 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 17 Oct 2013 17:53:48 +0200 Subject: [PATCH] Handle the migration of the MySQL database from ajaxplorer to pydio --- root/etc/e-smith/db/configuration/defaults/pydio/DbName | 2 +- root/etc/e-smith/db/configuration/defaults/pydio/DbUser | 2 +- root/etc/e-smith/templates/etc/e-smith/sql/init/pydio | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/root/etc/e-smith/db/configuration/defaults/pydio/DbName b/root/etc/e-smith/db/configuration/defaults/pydio/DbName index 705e971..a923bd6 100644 --- a/root/etc/e-smith/db/configuration/defaults/pydio/DbName +++ b/root/etc/e-smith/db/configuration/defaults/pydio/DbName @@ -1 +1 @@ -ajaxplorer +pydio diff --git a/root/etc/e-smith/db/configuration/defaults/pydio/DbUser b/root/etc/e-smith/db/configuration/defaults/pydio/DbUser index 705e971..a923bd6 100644 --- a/root/etc/e-smith/db/configuration/defaults/pydio/DbUser +++ b/root/etc/e-smith/db/configuration/defaults/pydio/DbUser @@ -1 +1 @@ -ajaxplorer +pydio diff --git a/root/etc/e-smith/templates/etc/e-smith/sql/init/pydio b/root/etc/e-smith/templates/etc/e-smith/sql/init/pydio index cadcd02..e32d4f3 100644 --- a/root/etc/e-smith/templates/etc/e-smith/sql/init/pydio +++ b/root/etc/e-smith/templates/etc/e-smith/sql/init/pydio @@ -8,10 +8,15 @@ my $feed = "/usr/share/pydio/plugins/feed.sql/create.sql"; $OUT .= <<"END"; #! /bin/sh if [ ! -d /var/lib/mysql/$db ]; then - /usr/bin/mysql -e 'create database $db' - /usr/bin/mysql $db < $feed + /usr/bin/mysql -e 'create database $db' + /usr/bin/mysql $db < $feed + if [ -e /var/lib/mysql/ajaxplorer ]; then + /usr/bin/mysqldump --add-drop-table ajaxplorer | /usr/bin/mysql $db + /usr/bin/mysqladmin -f drop ajaxplorer + fi fi + /usr/bin/mysql <