% page_header("columns", "Upgrade", "install");
/* frontend to Samba3 upgrade.
Based on provision.esp
(C) Jelmer Vernooij 2005
Published under the GNU GPL
*/
include("/scripting/forms.js");
libinclude("base.js");
libinclude("provision.js");
libinclude("upgrade.js");
%>
Import from Samba3
<%
if ((session.authinfo.user_class == "ADMINISTRATOR")
|| (session.authinfo.user_class == "SYSTEM")) {
if (form['submit'] == "Cancel") {
redirect("/");
}
function confirm_form()
{
var samba3 = samba3_read(form['LIBDIR'], form['SMBCONF']);
var subobj = upgrade_provision(samba3);
var f = FormObj("Import from Samba3", 0, 2);
subobj.ADMINPASS = "";
f.add("REALM", "Realm");
f.add("DOMAIN", "Domain Name");
f.add("HOSTNAME", "Hostname");
f.add("ADMINPASS", "Administrator Password", "password");
f.add("CONFIRM", "Confirm Password", "password");
f.add("DOMAINSID", "Domain SID");
f.add("HOSTGUID", "Host GUID");
f.add("HOSTIP", "Host IP");
f.add("DEFAULTSITE", "Default Site");
for (i=0;iPasswords don't match. Please try again.");
confirm_form();
} else if (subobj.ADMINPASS == "") {
write("You must choose an administrator password. Please try again.
");
confirm_form();
} else {
var paths = provision_default_paths(subobj);
if (!provision(subobj, writefln, true, paths,
session.authinfo.session_info, session.authinfo.credentials)) {
writefln("Provision failed!");
} else {
var ret = upgrade(subobj,samba3,message,paths,
session.authinfo.session_info, session.authinfo.credentials);
if (ret > 0) {
writefln("Failed to import %d entries\n", ret);
} else {
if (!provision_dns(subobj, writefln, paths,
session.authinfo.session_info, session.authinfo.credentials)) {
writefln("DNS Provision failed!");
} else {
writefln("Reloading smb.conf\n");
var lp = loadparm_init();
lp.reload();
writefln("Upgrade Complete!");
}
}
}
}
} else {
var f = FormObj("Import from Samba3", 0, 2);
f.add("SMBCONF", "smb.conf file", "text", "/etc/samba/smb.conf");
f.add("LIBDIR", "Lib directory", "text", "/var/lib/samba");
f.submit[0] = "Import";
f.submit[1] = "Cancel";
write('Warning: This will erase your current configuration!
');
f.display();
}
} else {
redirect("/");
}
%>
<% page_footer(); %>