vfs:gpfs: fix a debug message
[Samba.git] / source4 / scripting / devel / config_base
blob9d5a12bea50ba96795456bf95ce3f2b915ff4b62
1 #!/usr/bin/env python
3 # this is useful for running samba tools with a different prefix
5 # for example:
6 # samba-tool $(scripting/devel/config_base /tmp/testprefix) join .....
8 import sys, os
10 vars = {
11 "ncalrpc dir" : "${PREFIX}/var/ncalrpc",
12 "private dir" : "${PREFIX}/private",
13 "lock dir" : "${PREFIX}/var/locks",
14 "pid directory" : "${PREFIX}/var/run",
15 "winbindd socket directory" : "${PREFIX}/var/run/winbindd",
16 "winbindd privileged socket directory" : "${PREFIX}/var/lib/winbindd_privileged",
17 "ntp signd socket directory" : "${PREFIX}/var/run/ntp_signd"
20 if len(sys.argv) != 2:
21 print("Usage: config_base BASEDIRECTORY")
22 sys.exit(1)
24 prefix = sys.argv[1]
26 config_dir = prefix + "/etc"
27 config_file = config_dir + "/smb.conf"
29 if not os.path.isdir(config_dir):
30 os.makedirs(config_dir, mode=0755)
31 if not os.path.isfile(config_file):
32 open(config_file, mode='w').close()
34 options = " --configfile=${PREFIX}/etc/smb.conf"
36 for v in vars:
37 options += " --option=%s=%s" % (v.replace(" ",""), vars[v])
39 options = options.replace("${PREFIX}", prefix)
41 print options