diff options
author | Derrell Lipman <derrell@samba.org> | 2007-01-03 19:57:40 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:36:06 -0500 |
commit | 2e7c59c24470766e37309c7a8bfa4c7b81c57614 (patch) | |
tree | c44c89911868c52f25ca66bdefa68e13248db8e6 /webapps/install/samba3.esp | |
parent | 57f5bf78fa9fc9d190c3cb25251e686a1488f790 (diff) | |
download | samba-2e7c59c24470766e37309c7a8bfa4c7b81c57614.tar.gz samba-2e7c59c24470766e37309c7a8bfa4c7b81c57614.tar.bz2 samba-2e7c59c24470766e37309c7a8bfa4c7b81c57614.zip |
r20515: Continued work on the Web Application Framework. Until we get all of the
functionality of the old scripts incorporated into the new framework, the old
scripts need to still be available. I've reverted to having the old scripts
be the default pages, and added an option to access the preview of the new
SWAT.
(This used to be commit b43620d4b8eff815f4a6dc02522a8dfc9fdcaef4)
Diffstat (limited to 'webapps/install/samba3.esp')
-rw-r--r-- | webapps/install/samba3.esp | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/webapps/install/samba3.esp b/webapps/install/samba3.esp new file mode 100644 index 0000000000..31857c01e9 --- /dev/null +++ b/webapps/install/samba3.esp @@ -0,0 +1,106 @@ +<% 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"); +%> + +<h1>Import from Samba3</h1> + +<% +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;i<f.element.length;i++) { + f.element[i].value = subobj[f.element[i].name]; + } + + f.add("SMBCONF", "", "hidden", form['SMBCONF']); + f.add("LIBDIR", "", "hidden", form['LIBDIR']); + + f.submit[0] = "Continue"; + f.submit[1] = "Cancel"; + f.display(); +} + +if (form['submit'] == "Import") { + confirm_form(); +} else if (form['submit'] == "Continue") { + var samba3 = samba3_read(form['LIBDIR'], form['SMBCONF']); + assert(samba3 != undefined); + var subobj = upgrade_provision(samba3); + for (r in form) { + subobj[r] = form[r]; + } + + var goodpass = (subobj.CONFIRM == subobj.ADMINPASS); + + if (!goodpass) { + write("<h3>Passwords don't match. Please try again.</h3>"); + confirm_form(); + } else if (subobj.ADMINPASS == "") { + write("<h3>You must choose an administrator password. Please try again.</h3>"); + 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('<p>Warning: This will erase your current configuration!</p>'); + f.display(); +} +%> + +<% page_footer(); %> |