r22756: Make it easier to setup an LDAP replica. Provision with
[jra/samba/.git] / source4 / setup / provision
index dcc92b924fc07efcea0a3d713c541c4794059319..2a3ddecd3ed508dd2fbe9f39ed65d3c149a5bde4 100755 (executable)
@@ -29,6 +29,7 @@ options = GetOptions(ARGV,
                'users=s',
                'quiet',
                'blank',
+               'partitions-only',
                'ldap-base',
                'ldap-backend=s',
                 'ldap-module=s',
@@ -79,6 +80,7 @@ provision [options]
  --users       GROUPNAME       choose 'users' group
  --quiet                       Be quiet
  --blank                       do not add users or groups, just the structure
+ --partitions-only              Configure Samba's partitions, but do not modify them (ie, join a BDC)
  --ldap-base                   output only an LDIF file, suitable for creating an LDAP baseDN
  --ldap-backend LDAPSERVER      LDAP server to use for this provision
  --ldap-module= MODULE          LDB mapping module to use for the LDAP backend
@@ -118,17 +120,23 @@ var blank = (options["blank"] != undefined);
 var ldapbase = (options["ldap-base"] != undefined);
 var ldapbackend = (options["ldap-backend"] != undefined);
 var ldapmodule = (options["ldap-module"] != undefined);
-
+var partitions_only = (options["partitions-only"] != undefined);
 if (options["aci"] != undefined) {
-       println("set ACI: " + subobj["ACI"]);
+       message("set ACI: %s\n", subobj["ACI"]);
 }
 
+message("set DOMAIN SID: %s\n", subobj["DOMAINSID"]);
+
 if (ldapbackend) {
        if (!ldapmodule) {
-               subobj["LDAPMODULE"] = "objectUUID";
+               subobj["LDAPMODULE"] = "entryUUID";
        }
        subobj["DOMAINDN_LDB"] = subobj["LDAPBACKEND"];
        subobj["DOMAINDN_MOD"] = subobj["LDAPMODULE"] + ",paged_searches";
+       subobj["CONFIGDN_LDB"] = subobj["LDAPBACKEND"];
+       subobj["CONFIGDN_MOD"] = subobj["LDAPMODULE"] + ",paged_searches";
+       subobj["SCHEMADN_LDB"] = subobj["LDAPBACKEND"];
+       subobj["SCHEMADN_MOD"] = subobj["LDAPMODULE"] + ",paged_searches";
 }
 
 if (!provision_validate(subobj, message)) {
@@ -142,6 +150,8 @@ message("Provisioning for %s in realm %s\n", subobj.DOMAIN, subobj.REALM);
 message("Using administrator password: %s\n", subobj.ADMINPASS);
 if (ldapbase) {
        provision_ldapbase(subobj, message, paths);
+} else if (partitions_only) {
+       provision_become_dc(subobj, message, false, paths, system_session);
 } else {
        provision(subobj, message, blank, paths, system_session, creds, ldapbackend);
        provision_dns(subobj, message, paths, system_session, creds);