waf: Create kerberos_implementation.py for provisioning
[Samba.git] / python / wscript
blob714d649219d16f9db67bb3d23c8ad31e4b3f0ea9
1 #!/usr/bin/env python
3 import os
5 def configure(conf):
6 kerberos_py = conf.srcdir + "/python/samba/provision/kerberos_implementation.py"
8 f = open(kerberos_py, 'w')
9 try:
10 header = """#
11 # Copyright (c) 2016 Andreas Schneider <asn@samba.org>
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 3 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 """
27 f.write(header)
29 data = """kdb_modules_dir = "{0}"
30 kdc_default_config_dir = "{1}"
31 """
33 if conf.env.HEIMDAL_KRB5_CONFIG:
34 f.write(data.format("", ""))
35 else:
36 modulesdir = "%s/krb5/plugins/kdb" % conf.env.LIBDIR
37 paths = [ "/var/kerberos/krb5kdc", "/var/lib/kerberos/krb5kdc" ]
38 kdc_path = None
39 for p in paths:
40 if os.path.exists(p):
41 kdc_path = p
43 f.write(data.format(modulesdir, kdc_path))
44 finally:
45 f.close()