2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

Added support for PostgreSQL DB on FreeBSD systems

This commit is contained in:
manu
2019-08-10 21:47:38 +02:00
parent 1462dd12cd
commit e14e1868c3

View File

@@ -877,6 +877,7 @@ def _configure_mysql(system, revision, features):
def _configure_pgsql(system, features):
""" Configure PostgreSQL DB """
if system in ['fedora', 'centos']:
# https://fedoraproject.org/wiki/PostgreSQL
exitcode = execute('sudo ls /var/lib/pgsql/data/postgresql.conf', raise_error=False)
@@ -885,8 +886,18 @@ def _configure_pgsql(system, features):
execute('sudo postgresql-setup initdb')
else:
execute('sudo postgresql-setup --initdb --unit postgresql')
execute('sudo systemctl start postgresql.service')
execute('sudo systemctl enable postgresql.service')
elif system == 'freebsd':
# pgsql must be enabled before runnig initdb
execute('sudo sysrc postgresql_enable="yes"')
execute('sudo /usr/local/etc/rc.d/postgresql initdb')
if system == 'freebsd':
# echo or redirection to stdout is needed otherwise the script will hang at "line = p.stdout.readline()"
execute('sudo service postgresql start && echo "PostgreSQL started"')
else:
execute('sudo systemctl enable postgresql.service')
execute('sudo systemctl start postgresql.service')
cmd = "bash -c \"cat <<EOF | sudo -u postgres psql postgres\n"
cmd += "DROP DATABASE IF EXISTS keatest;\n"
cmd += "DROP USER IF EXISTS keatest;\n"
@@ -1263,6 +1274,9 @@ def prepare_system_local(features, check_times):
if 'mysql' in features:
packages.extend(['mysql57-server', 'mysql57-client'])
if 'pgsql' in features:
packages.extend(['postgresql11-server', 'postgresql11-client'])
if 'radius' in features:
packages.extend(['git'])