summaryrefslogtreecommitdiffstats
path: root/pykolab/setup/setup_syncroton.py
diff options
context:
space:
mode:
Diffstat (limited to 'pykolab/setup/setup_syncroton.py')
-rw-r--r--pykolab/setup/setup_syncroton.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/pykolab/setup/setup_syncroton.py b/pykolab/setup/setup_syncroton.py
index 446577f..c7c03ce 100644
--- a/pykolab/setup/setup_syncroton.py
+++ b/pykolab/setup/setup_syncroton.py
@@ -66,8 +66,8 @@ def execute(*args, **kw):
break
if not os.path.isfile('/tmp/kolab-setup-my.cnf'):
- utils.multiline_message(
- """Please supply the MySQL root password"""
+ print >> sys.stderr, utils.multiline_message(
+ """Please supply the MySQL root password (use 'unix_socket' for socket based authentication)"""
)
mysql_root_password = utils.ask_question(
@@ -75,6 +75,32 @@ def execute(*args, **kw):
password=True
)
+ socket_path = None
+ socket_paths = [
+ "/var/lib/mysql/mysql.sock",
+ "/var/run/mysqld/mysqld.sock",
+ "/var/run/mysql/mysql.sock"
+ ]
+ for sp in socket_paths:
+ if os.path.exists(sp):
+ socket_path = sp
+
+ if mysql_root_password == "unix_socket" and socket_path is not None:
+ data = """
+[mysql]
+user=root
+password=
+host=localhost
+socket=%s
+""" % (socket_path)
+ else:
+ data = """
+[mysql]
+user=root
+password='%s'
+host=%s
+""" % (mysql_root_password, conf.mysqlhost)
+
data = """
[mysql]
user=root