Created
May 30, 2014 16:59
-
-
Save westonruter/04e59241d366f6b7fd95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Vagrantfile b/Vagrantfile | |
index ec02352..235e0b1 100644 | |
--- a/Vagrantfile | |
+++ b/Vagrantfile | |
@@ -107,9 +107,9 @@ Vagrant.configure("2") do |config| | |
# plugin is installed. | |
if File.exists?(File.join(vagrant_dir,'database/data/mysql_upgrade_info')) then | |
if vagrant_version >= "1.3.0" | |
- config.vm.synced_folder "database/data/", "/var/lib/mysql", :mount_options => [ "dmode=777", "fmode=777" ] | |
+ config.vm.synced_folder "database/data/", "/var/lib/mysql-synced", :mount_options => [ "dmode=777", "fmode=777" ] | |
else | |
- config.vm.synced_folder "database/data/", "/var/lib/mysql", :extra => 'dmode=777,fmode=777' | |
+ config.vm.synced_folder "database/data/", "/var/lib/mysql-synced", :extra => 'dmode=777,fmode=777' | |
end | |
end | |
diff --git a/provision/provision.sh b/provision/provision.sh | |
index 53ce3ff..55ff029 100755 | |
--- a/provision/provision.sh | |
+++ b/provision/provision.sh | |
@@ -314,6 +314,17 @@ service php5-fpm restart | |
# If MySQL is installed, go through the various imports and service tasks. | |
exists_mysql="$(service mysql status)" | |
if [[ "mysql: unrecognized service" != "${exists_mysql}" ]]; then | |
+ | |
+ if [[ -e /var/lib/mysql-synced ]] && [[ -e /var/lib/mysql-synced/mysql_upgrade_info ]]; then | |
+ echo -e "\nMigrate MySQL data from synced folder to VM" | |
+ if [[ ! -e /var/lib/mysql ]]; then | |
+ mkdir /var/lib/mysql | |
+ fi | |
+ chown vagrant:vagrant /var/lib/mysql | |
+ rsync -avz /var/lib/mysql-synced/ /var/lib/mysql/ | |
+ mv /var/lib/mysql-synced/mysql_upgrade_info /var/lib/mysql-synced/mysql_upgrade_info.remove-suffix-to-restore-synced-db | |
+ fi | |
+ | |
echo -e "\nSetup MySQL configuration file links..." | |
# Copy mysql configuration from local | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment