blob: f593f2f627d6de64d215dcb60087d41b95bd87d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/usr/bin/env python3
# this is useful for running samba tools with a different prefix
# for example:
# samba-tool $(scripting/devel/config_base /tmp/testprefix) join .....
import sys, os
vars = {
"ncalrpc dir" : "${PREFIX}/var/ncalrpc",
"private dir" : "${PREFIX}/private",
"lock dir" : "${PREFIX}/var/locks",
"pid directory" : "${PREFIX}/var/run",
"winbindd socket directory" : "${PREFIX}/var/run/winbindd",
"ntp signd socket directory" : "${PREFIX}/var/run/ntp_signd"
}
if len(sys.argv) != 2:
print("Usage: config_base BASEDIRECTORY")
sys.exit(1)
prefix = sys.argv[1]
config_dir = prefix + "/etc"
config_file = config_dir + "/smb.conf"
if not os.path.isdir(config_dir):
os.makedirs(config_dir, mode=0o755)
if not os.path.isfile(config_file):
open(config_file, mode='w').close()
options = (
" --configfile=${PREFIX}/etc/smb.conf"
"".join(" --option=%s=%s" % (v.replace(" ",""), vars[v]) for v in vars)
).replace("${PREFIX}", prefix)
print(options)
|