summaryrefslogtreecommitdiff
path: root/source4/scripting/libjs
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-31 02:39:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:35:04 -0500
commitf58a74aabab3d5c0d1185ac2f77a5f54feb781e9 (patch)
tree79d531450d96f07da379fdd72fb40d1221570627 /source4/scripting/libjs
parent40f85ace04abad7460d0f0afe9211c4280482c6c (diff)
downloadsamba-f58a74aabab3d5c0d1185ac2f77a5f54feb781e9.tar.gz
samba-f58a74aabab3d5c0d1185ac2f77a5f54feb781e9.tar.bz2
samba-f58a74aabab3d5c0d1185ac2f77a5f54feb781e9.zip
r9816: Work on testsuite for upgrade
Add 'paths' object to provision code. (This used to be commit 488d737fb0ebbc2535d0ec17c14f0dc1eaf2a578)
Diffstat (limited to 'source4/scripting/libjs')
-rw-r--r--source4/scripting/libjs/provision.js44
-rw-r--r--source4/scripting/libjs/upgrade.js18
2 files changed, 39 insertions, 23 deletions
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js
index 9607d6f274..ef99dc43c5 100644
--- a/source4/scripting/libjs/provision.js
+++ b/source4/scripting/libjs/provision.js
@@ -199,16 +199,34 @@ function setup_file(template, fname, subobj)
assert(ok);
}
+function provision_default_paths(subobj)
+{
+ var lp = loadparm_init();
+ var paths = new Object();
+ paths.smbconf = lp.get("config file");
+ paths.hklm = "hklm.ldb";
+ paths.hkcu = "hkcu.ldb";
+ paths.hkcr = "hkcr.ldb";
+ paths.hku = "hku.ldb";
+ paths.hkpd = "hkpd.ldb";
+ paths.hkpt = "hkpt.ldb";
+ paths.samdb = "sam.ldb";
+ paths.rootdse = "rootdse.ldb";
+ paths.secrets = "secrets.ldb";
+ paths.dns = lp.get("private dir") + "/" + subobj.DNSDOMAIN + ".zone";
+ paths.winsdb = "wins.ldb";
+ return paths;
+}
+
/*
provision samba4 - caution, this wipes all existing data!
*/
-function provision(subobj, message, blank)
+function provision(subobj, message, blank, paths)
{
var data = "";
var lp = loadparm_init();
var sys = sys_init();
- var smbconf = lp.get("config file");
-
+
/*
some options need to be upper/lower case
*/
@@ -228,31 +246,31 @@ function provision(subobj, message, blank)
provision_next_usn = 1;
/* only install a new smb.conf if there isn't one there already */
- var st = sys.stat(smbconf);
+ var st = sys.stat(paths.smbconf);
if (st == undefined) {
message("Setting up smb.conf\n");
- setup_file("provision.smb.conf", smbconf, subobj);
+ setup_file("provision.smb.conf", paths.smbconf, subobj);
lp.reload();
}
message("Setting up hklm.ldb\n");
- setup_ldb("hklm.ldif", "hklm.ldb", subobj);
+ setup_ldb("hklm.ldif", paths.hklm, subobj);
message("Setting up sam.ldb attributes\n");
- setup_ldb("provision_init.ldif", "sam.ldb", subobj);
+ setup_ldb("provision_init.ldif", paths.samdb, subobj);
message("Setting up sam.ldb templates\n");
- setup_ldb("provision_templates.ldif", "sam.ldb", subobj, NULL, false);
+ setup_ldb("provision_templates.ldif", paths.samdb, subobj, NULL, false);
message("Setting up sam.ldb data\n");
- setup_ldb("provision.ldif", "sam.ldb", subobj, NULL, false);
+ setup_ldb("provision.ldif", paths.samdb, subobj, NULL, false);
if (blank == false) {
message("Setting up sam.ldb users and groups\n");
- setup_ldb("provision_users.ldif", "sam.ldb", subobj, data, false);
+ setup_ldb("provision_users.ldif", paths.samdb, subobj, data, false);
}
message("Setting up rootdse.ldb\n");
- setup_ldb("rootdse.ldif", "rootdse.ldb", subobj);
+ setup_ldb("rootdse.ldif", paths.rootdse, subobj);
message("Setting up secrets.ldb\n");
- setup_ldb("secrets.ldif", "secrets.ldb", subobj);
+ setup_ldb("secrets.ldif", paths.secrets, subobj);
message("Setting up DNS zone file\n");
setup_file("provision.zone",
- lp.get("private dir") + "/" + subobj.DNSDOMAIN + ".zone",
+ paths.dns,
subobj);
}
diff --git a/source4/scripting/libjs/upgrade.js b/source4/scripting/libjs/upgrade.js
index 0e12d7c345..4fe6b8cc1e 100644
--- a/source4/scripting/libjs/upgrade.js
+++ b/source4/scripting/libjs/upgrade.js
@@ -403,17 +403,17 @@ function upgrade_smbconf(oldconf,mark)
return newconf;
}
-function upgrade(subobj, samba3, message)
+function upgrade(subobj, samba3, message, paths)
{
var ret = 0;
var lp = loadparm_init();
var samdb = ldb_init();
- var ok = samdb.connect("sam.ldb");
+ var ok = samdb.connect(paths.samdb);
assert(ok);
message("Writing configuration\n");
var newconf = upgrade_smbconf(samba3.configuration,true);
- newconf.save(lp.get("config file"));
+ newconf.save(paths.smbconf);
message("Importing account policies\n");
var ldif = upgrade_sam_policy(samba3,subobj.BASEDN);
@@ -474,11 +474,12 @@ dn: @MAP=samba3sam
message("Importing registry data\n");
var hives = new Array("hkcr","hkcu","hklm","hkpd","hku","hkpt");
for (var i in hives) {
- message("... " + hives[i] + "\n");
+ var hn = hives[i];
+ message("... " + hn + "\n");
var regdb = ldb_init();
- ok = regdb.connect(hives[i] + ".ldb");
+ ok = regdb.connect(paths[hn]);
assert(ok);
- var ldif = upgrade_registry(samba3.registry, hives[i]);
+ var ldif = upgrade_registry(samba3.registry, hn);
for (var j in ldif) {
message("... ... " + j);
ok = regdb.add(ldif[j]);
@@ -492,7 +493,7 @@ dn: @MAP=samba3sam
message("Importing WINS data\n");
var winsdb = ldb_init();
- ok = winsdb.connect("wins.ldb");
+ ok = winsdb.connect(paths.winsdb);
assert(ok);
ldb_erase(winsdb);
@@ -500,8 +501,5 @@ dn: @MAP=samba3sam
ok = winsdb.add(ldif);
assert(ok);
- message("Reloading smb.conf\n");
- lp.reload();
-
return ret;
}