Projects
Kolab:Winterfell
pykolab
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 73
View file
pykolab.spec
Changed
@@ -42,6 +42,8 @@ Source0: pykolab-%{version}.tar.gz Source1: pykolab.logrotate +Patch0001: 0001-Add-mysqlhost.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildArch: noarch @@ -230,6 +232,8 @@ %prep %setup -q +%patch0001 -p1 + %build autoreconf -v || automake --add-missing && autoreconf -v %configure
View file
0001-Add-mysqlhost.patch
Added
@@ -0,0 +1,203 @@ +From 894df668e96af15b172eff9b0e4ffcb42aa76084 Mon Sep 17 00:00:00 2001 +From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com> +Date: Wed, 25 Sep 2019 08:10:49 +0200 +Subject: [PATCH] Add --mysqlhost + +--- + pykolab/setup/setup_mysql.py | 105 +++++++++++++++++-------------- + pykolab/setup/setup_roundcube.py | 3 +- + pykolab/setup/setup_syncroton.py | 13 +++- + 3 files changed, 72 insertions(+), 49 deletions(-) + +diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py +index 807bc7f..d5e62a0 100644 +--- a/pykolab/setup/setup_mysql.py ++++ b/pykolab/setup/setup_mysql.py +@@ -48,6 +48,14 @@ def cli_options(): + help=_("Specify whether to use an (existing) or (new) MySQL server.") + ) + ++ mysql_group.add_option( ++ "--mysqlhost", ++ dest="mysqlhost", ++ action="store", ++ default='127.0.0.1', ++ help=_("The MySQL host address.") ++ ) ++ + mysql_group.add_option( + "--mysqlrootpw", + dest="mysqlrootpw", +@@ -70,45 +78,46 @@ def execute(*args, **kw): # noqa: C901 + ] + + # on CentOS7, there is MariaDB instead of MySQL +- mysqlservice = 'mysqld.service' +- if os.path.isfile('/usr/lib/systemd/system/mariadb.service'): +- mysqlservice = 'mariadb.service' +- elif os.path.isfile('/usr/lib/systemd/system/mysql.service'): +- mysqlservice = 'mysql.service' +- if not os.path.isfile('/usr/lib/systemd/system/' + mysqlservice): +- # on Debian Jessie, systemctl restart mysql +- mysqlservice = 'mysql' +- +- if os.path.isfile('/bin/systemctl'): +- subprocess.call(['/bin/systemctl', 'restart', mysqlservice]) +- elif os.path.isfile('/sbin/service'): +- subprocess.call(['/sbin/service', 'mysqld', 'restart']) +- elif os.path.isfile('/usr/sbin/service'): +- subprocess.call(['/usr/sbin/service', 'mysql', 'restart']) +- else: +- log.error(_("Could not start the MySQL database service.")) +- +- if os.path.isfile('/bin/systemctl'): +- subprocess.call(['/bin/systemctl', 'enable', mysqlservice]) +- elif os.path.isfile('/sbin/chkconfig'): +- subprocess.call(['/sbin/chkconfig', 'mysqld', 'on']) +- elif os.path.isfile('/usr/sbin/update-rc.d'): +- subprocess.call(['/usr/sbin/update-rc.d', 'mysql', 'defaults']) +- else: +- log.error( +- _("Could not configure to start on boot, the MySQL database service.") +- ) ++ if conf.mysqlserver != 'existing': ++ mysqlservice = 'mysqld.service' ++ if os.path.isfile('/usr/lib/systemd/system/mariadb.service'): ++ mysqlservice = 'mariadb.service' ++ elif os.path.isfile('/usr/lib/systemd/system/mysql.service'): ++ mysqlservice = 'mysql.service' ++ if not os.path.isfile('/usr/lib/systemd/system/' + mysqlservice): ++ # on Debian Jessie, systemctl restart mysql ++ mysqlservice = 'mysql' ++ ++ if os.path.isfile('/bin/systemctl'): ++ subprocess.call(['/bin/systemctl', 'restart', mysqlservice]) ++ elif os.path.isfile('/sbin/service'): ++ subprocess.call(['/sbin/service', 'mysqld', 'restart']) ++ elif os.path.isfile('/usr/sbin/service'): ++ subprocess.call(['/usr/sbin/service', 'mysql', 'restart']) ++ else: ++ log.error(_("Could not start the MySQL database service.")) ++ ++ if os.path.isfile('/bin/systemctl'): ++ subprocess.call(['/bin/systemctl', 'enable', mysqlservice]) ++ elif os.path.isfile('/sbin/chkconfig'): ++ subprocess.call(['/sbin/chkconfig', 'mysqld', 'on']) ++ elif os.path.isfile('/usr/sbin/update-rc.d'): ++ subprocess.call(['/usr/sbin/update-rc.d', 'mysql', 'defaults']) ++ else: ++ log.error( ++ _("Could not configure to start on boot, the MySQL database service.") ++ ) + +- log.info(_("Waiting for at most 30 seconds for MySQL/MariaDB to settle...")) +- max_wait = 30 +- while max_wait > 0: +- for socket_path in socket_paths: +- if os.path.exists(socket_path): +- max_wait = 0 ++ log.info(_("Waiting for at most 30 seconds for MySQL/MariaDB to settle...")) ++ max_wait = 30 ++ while max_wait > 0: ++ for socket_path in socket_paths: ++ if os.path.exists(socket_path): ++ max_wait = 0 + +- if max_wait > 0: +- max_wait = max_wait - 1 +- time.sleep(1) ++ if max_wait > 0: ++ max_wait = max_wait - 1 ++ time.sleep(1) + + options = { + 1: "Existing MySQL server (with root password already set).", +@@ -116,14 +125,17 @@ def execute(*args, **kw): # noqa: C901 + } + + answer = 0 +- if len([x for x in socket_paths if os.path.exists(x)]) > 0: +- if conf.mysqlserver: +- if conf.mysqlserver == 'existing': +- answer = 1 +- elif conf.mysqlserver == 'new': +- answer = 2 +- if answer == 0: +- answer = utils.ask_menu(_("What MySQL server are we setting up?"), options) ++ if conf.mysqlserver != 'existing': ++ if len([x for x in socket_paths if os.path.exists(x)]) > 0: ++ if conf.mysqlserver: ++ if conf.mysqlserver == 'existing': ++ answer = 1 ++ elif conf.mysqlserver == 'new': ++ answer = 2 ++ if answer == 0: ++ answer = utils.ask_menu(_("What MySQL server are we setting up?"), options) ++ else: ++ answer = 1 + + if answer == "1" or answer == 1: + if not conf.mysqlrootpw: +@@ -214,7 +226,8 @@ def execute(*args, **kw): # noqa: C901 + [mysql] + user=root + password='%s' +-""" % (mysql_root_password) ++host=%s ++""" % (mysql_root_password, conf.mysqlhost) + + fp = open('/tmp/kolab-setup-my.cnf', 'w') + os.chmod('/tmp/kolab-setup-my.cnf', 600) +diff --git a/pykolab/setup/setup_roundcube.py b/pykolab/setup/setup_roundcube.py +index 1be5cb6..36c7aa7 100644 +--- a/pykolab/setup/setup_roundcube.py ++++ b/pykolab/setup/setup_roundcube.py +@@ -232,7 +232,8 @@ def execute(*args, **kw): + [mysql] + user=root + password='%s' +-""" % (mysql_root_password) ++host=%s ++""" % (mysql_root_password, conf.mysqlhost) + + fp = open('/tmp/kolab-setup-my.cnf', 'w') + os.chmod('/tmp/kolab-setup-my.cnf', 600) +diff --git a/pykolab/setup/setup_syncroton.py b/pykolab/setup/setup_syncroton.py +index 5b9f915..446577f 100644 +--- a/pykolab/setup/setup_syncroton.py ++++ b/pykolab/setup/setup_syncroton.py +@@ -33,12 +33,20 @@ from pykolab.translate import _ + log = pykolab.getLogger('pykolab.setup') + conf = pykolab.getConf() + ++ + def __init__(): +- components.register('syncroton', execute, description=description(), after=['mysql','ldap','roundcube']) ++ 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/'): +@@ -71,7 +79,8 @@ def execute(*args, **kw): + [mysql] + user=root + password='%s' +-""" % (mysql_root_password) ++host=%s ++""" % (mysql_root_password, conf.mysqlhost) + + fp = open('/tmp/kolab-setup-my.cnf', 'w')
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.