summaryrefslogtreecommitdiff
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-04-24 13:46:42 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-04-24 13:46:42 (GMT)
commit4054fb9435ec9e95f89d90e3794caed251071ab7 (patch)
tree2233ed8770701636abac09b6eaa818fbdf94a797 /pykolab
parent06ceb84a63d38cc2ab238c8a24efeb8c66f2a57b (diff)
downloadpykolab-4054fb9435ec9e95f89d90e3794caed251071ab7.tar.gz
Add kolabd and mysql setup
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_kolabd.py42
-rw-r--r--pykolab/setup/setup_mysql.py60
2 files changed, 102 insertions, 0 deletions
diff --git a/pykolab/setup/setup_kolabd.py b/pykolab/setup/setup_kolabd.py
new file mode 100644
index 0000000..09a48ad
--- /dev/null
+++ b/pykolab/setup/setup_kolabd.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
+#
+# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 3 or, at your option, any later version
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+import os
+import subprocess
+
+import components
+
+import pykolab
+
+from pykolab import utils
+from pykolab.constants import *
+from pykolab.translate import _
+
+log = pykolab.getLogger('pykolab.setup')
+conf = pykolab.getConf()
+
+def __init__():
+ components.register('kolabd', execute, description=description(), after=['ldap','imap'])
+
+def description():
+ return _("Setup the Kolab daemon.")
+
+def execute(*args, **kw):
+ subprocess.call(['service', 'kolabd', 'start'])
+ subprocess.call(['service', 'kolab-saslauthd', 'start'])
diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
new file mode 100644
index 0000000..4ef3c22
--- /dev/null
+++ b/pykolab/setup/setup_mysql.py
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
+#
+# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 3 or, at your option, any later version
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+import os
+import subprocess
+
+import components
+
+import pykolab
+
+from pykolab import utils
+from pykolab.constants import *
+from pykolab.translate import _
+
+log = pykolab.getLogger('pykolab.setup')
+conf = pykolab.getConf()
+
+def __init__():
+ components.register('mysql', execute, description=description())
+
+def description():
+ return _("Setup MySQL.")
+
+def execute(*args, **kw):
+ schema_file = None
+ for root, directories, filenames in os.walk('/usr/share/doc/'):
+ for filename in filenames:
+ if filename.startswith('kolab_wap') and filename.endswith('.sql'):
+ schema_file = os.path.join(root,filename)
+
+ if not schema_file == None:
+ subprocess.call(['service', 'mysqld', 'start'])
+ p1 = subprocess.Popen(['echo', 'create database kolab;'], stdout=subprocess.PIPE)
+ p2 = subprocess.Popen(['mysql'], stdin=p1.stdout)
+ p1.stdout.close()
+ p2.communicate()
+
+ p1 = subprocess.Popen(['cat', schema_file], stdout=subprocess.PIPE)
+ p2 = subprocess.Popen(['mysql', 'kolab'], stdin=p1.stdout)
+ p1.stdout.close()
+ p2.communicate()
+ else:
+ log.warning(_("Could not find the Kolab schema file"))
+