summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-27 11:29:20 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-27 11:29:20 +0200
commit9f1258853c71bfd8a7ce6819fb8740f381fb397c (patch)
treea97107339a8785c701d22230f5f47ced79039e84 /pykolab
parenta413bf77e7b78ba93bd369f3439f5856350454b3 (diff)
downloadpykolab-9f1258853c71bfd8a7ce6819fb8740f381fb397c.tar.gz
Add setup procedure for Syncroton
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_syncroton.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/pykolab/setup/setup_syncroton.py b/pykolab/setup/setup_syncroton.py
new file mode 100644
index 0000000..097fee0
--- /dev/null
+++ b/pykolab/setup/setup_syncroton.py
@@ -0,0 +1,66 @@
+# -*- 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 sys
+
+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('syncroton', execute, description=description(), after=['mysql','ldap','roundcube'])
+
+def description():
+ return _("Setup Syncroton.")
+
+def execute(*args, **kw):
+ schema_files = []
+ for root, directories, filenames in os.walk('/usr/share/doc/'):
+ for filename in filenames:
+ if filename.startswith('syncroton') and filename.endswith('.sql'):
+ schema_filepath = os.path.join(root,filename)
+ if not schema_filepath in schema_files:
+ schema_files.append(schema_filepath)
+
+ for schema_file in schema_files:
+ p1 = subprocess.Popen(['cat', schema_file], stdout=subprocess.PIPE)
+ p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf', 'roundcube'], stdin=p1.stdout)
+ p1.stdout.close()
+ p2.communicate()
+
+ time.sleep(2)
+
+ if os.path.isfile('/bin/systemctl'):
+ subprocess.call(['/bin/systemctl', 'restart', 'httpd.service'])
+ subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
+ elif os.path.isfile('/sbin/service'):
+ subprocess.call(['/sbin/service', 'httpd', 'restart'])
+ subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
+ else:
+ log.error(_("Could not start and configure to start on boot, the " + \
+ "webserver service."))
+