From d317983c002e361769388f21de9c22886bc08869 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Fri, 1 Apr 2011 14:24:29 -0700 Subject: [PATCH] mysql - remove 'data' from prefix Remove the 'data' folder from the prefix, so the setup script will not try to create databases there. Putting databases in the prefix instead of directly in /usr/local means they get deleted on a MySQL update, which is not what you want. --- Formula/mysql.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Formula/mysql.rb b/Formula/mysql.rb index 0d9157b317c..1dad913b97b 100644 --- a/Formula/mysql.rb +++ b/Formula/mysql.rb @@ -18,20 +18,17 @@ class Mysql < Formula ] end - def patches - DATA - end + def patches; DATA; end def install - args = [ - ".", - "-DCMAKE_INSTALL_PREFIX='#{prefix}'", - "-DMYSQL_DATADIR='#{var}/mysql'", - "-DINSTALL_MANDIR='#{man}'", - "-DWITH_SSL=yes", - "-DDEFAULT_CHARSET='utf8'", - "-DDEFAULT_COLLATION='utf8_general_ci'", - "-DSYSCONFDIR='#{HOMEBREW_PREFIX}/etc'"] + args = [".", + "-DCMAKE_INSTALL_PREFIX=#{prefix}", + "-DMYSQL_DATADIR=#{var}/mysql", + "-DINSTALL_MANDIR=#{man}", + "-DWITH_SSL=yes", + "-DDEFAULT_CHARSET=utf8", + "-DDEFAULT_COLLATION=utf8_general_ci", + "-DSYSCONFDIR=#{etc}"] # To enable unit testing at build, we need to download the unit testing suite args << "-DWITH_UNIT_TESTS=OFF" if not ARGV.include? '--with-tests' @@ -48,6 +45,10 @@ class Mysql < Formula system "make install" (prefix+'com.mysql.mysqld.plist').write startup_plist + + # Don't create databases inside of the prefix! + # See: https://github.com/mxcl/homebrew/issues/4975 + rm_rf prefix+'data' end def caveats; <<-EOS.undent