Last change
on this file was 745, checked in by Silvan Scherrer, 13 years ago |
Samba Server: updated trunk to 3.6.0
|
File size:
1.1 KB
|
Line | |
---|
1 | #!/usr/bin/env python
|
---|
2 |
|
---|
3 | # this is useful for running samba tools with a different prefix
|
---|
4 |
|
---|
5 | # for example:
|
---|
6 | # samba-tool $(scripting/devel/config_base /tmp/testprefix) join .....
|
---|
7 |
|
---|
8 | import sys, os
|
---|
9 |
|
---|
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"
|
---|
18 | }
|
---|
19 |
|
---|
20 | if len(sys.argv) != 2:
|
---|
21 | print("Usage: config_base BASEDIRECTORY")
|
---|
22 | sys.exit(1)
|
---|
23 |
|
---|
24 | prefix = sys.argv[1]
|
---|
25 |
|
---|
26 | config_dir = prefix + "/etc"
|
---|
27 | config_file = config_dir + "/smb.conf"
|
---|
28 |
|
---|
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()
|
---|
33 |
|
---|
34 | options = " --configfile=${PREFIX}/etc/smb.conf"
|
---|
35 |
|
---|
36 | for v in vars:
|
---|
37 | options += " --option=%s=%s" % (v.replace(" ",""), vars[v])
|
---|
38 |
|
---|
39 | options = options.replace("${PREFIX}", prefix)
|
---|
40 |
|
---|
41 | print options
|
---|
Note:
See
TracBrowser
for help on using the repository browser.