2 exec smbscript
"$0" ${1+"$@"}
4 provision a Samba4 server
5 Copyright Andrew Tridgell
2005
6 Released under the GNU GPL v2 or later
9 options
= GetOptions
(ARGV
,
12 "POPT_COMMON_VERSION",
13 "POPT_COMMON_CREDENTIALS",
35 if (options
== undefined
) {
36 println
("Failed to parse options");
40 libinclude
("base.js");
41 libinclude
("provision.js");
44 print a message
if quiet is not
set
48 if (options
["quiet"] == undefined
) {
49 print
(vsprintf
(arguments
));
62 --realm REALM set realm
63 --domain DOMAIN set domain
64 --domain-guid GUID set domainguid (otherwise random)
65 --domain-sid SID set domainsid (otherwise random)
66 --host-name HOSTNAME set hostname
67 --host-ip IPADDRESS set ipaddress
68 --host-guid GUID set hostguid (otherwise random)
69 --invocationid GUID set invocationid (otherwise random)
70 --adminpass PASSWORD choose admin password (otherwise random)
71 --krbtgtpass PASSWORD choose krbtgt password (otherwise random)
72 --machinepass PASSWORD choose machine password (otherwise random)
73 --root USERNAME choose 'root' unix username
74 --nobody USERNAME choose 'nobody' user
75 --nogroup GROUPNAME choose 'nogroup' group
76 --wheel GROUPNAME choose 'wheel' privileged group
77 --users GROUPNAME choose 'users' group
79 --blank do not add users or groups, just the structure
80 --ldap-base output only an LDIF file, suitable for creating an LDAP baseDN
81 --ldap-backend LDAPSERVER LDAP server to use for this provision
83 You must provide at least a realm and domain
89 if (options
['host-name'] == undefined
) {
90 options
['host-name'] = hostname
();
96 if (options
["realm"] == undefined ||
97 options
["domain"] == undefined ||
98 options
["host-name"] == undefined
) {
102 /* cope with an initially blank smb.conf
*/
103 var
lp = loadparm_init
();
104 lp.
set("realm", options.realm
);
105 lp.
set("workgroup", options.domain
);
108 var subobj
= provision_guess
();
110 var key
= strupper
(join("", split("-", r
)));
111 subobj
[key
] = options
[r
];
114 if (options
["ldap-backend"] != undefined
) {
115 subobj
["LDAPMODULES"] = "entryUUID,paged_searches";
118 var blank
= (options
["blank"] != undefined
);
119 var ldapbase
= (options
["ldap-base"] != undefined
);
120 var ldapbackend
= (options
["ldap-backend"] != undefined
);
122 if (!provision_validate
(subobj
, message
)) {
126 var system_session
= system_session
();
127 var creds
= options.get_credentials
();
128 var paths
= provision_default_paths
(subobj
);
129 message
("Provisioning for %s in realm %s\n", subobj.DOMAIN
, subobj.REALM
);
130 message
("Using administrator password: %s\n", subobj.ADMINPASS
);
132 provision_ldapbase
(subobj
, message
, paths
);
134 provision
(subobj
, message
, blank
, paths
, system_session
, creds
, ldapbackend
);
135 provision_dns
(subobj
, message
, paths
, system_session
, creds
);