summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--webgli/clientconfig.php160
-rw-r--r--webgli/templates/clientconfig.tpl84
-rw-r--r--webgli/webgliUtility.php16
4 files changed, 263 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d02e8de..55916bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
# $Id$
15 Apr 2006; Preston Cody <codeman@gentoo.org> ChangeLog:
+ adding client config screens to webgli
+
+ 15 Apr 2006; Preston Cody <codeman@gentoo.org> ChangeLog:
added temp copy of webgli stuff
12 Apr 2006; Preston Cody <codeman@gentoo.org> ChangeLog:
diff --git a/webgli/clientconfig.php b/webgli/clientconfig.php
new file mode 100644
index 0000000..12c7713
--- /dev/null
+++ b/webgli/clientconfig.php
@@ -0,0 +1,160 @@
+<?php
+include('webgliIP.php');
+include('webgliUtility.php');
+
+include('Smarty.class.php');
+$smarty = new Smarty;
+#phpinfo();
+$smarty->template_dir = './templates';
+$smarty->compile_dir = './templates_c';
+$smarty->cache_dir = './cache';
+$smarty->config_dir = './configs';
+
+
+
+
+
+
+
+$error_msg = "";
+if ($_POST['SaveCC']) {
+ if ($_POST['ArchType']) {
+ $error_msg .= "Found an architecture: you submitted " . $_POST['ArchType']. "<BR>\n";
+ #shared_info.client_profile.set_architecture_template(None, $_POST['ArchType'], None)
+ $error_msg .= "ERROR: Could not set the Architecture Template<br>\n";
+ }
+ if ($_POST['Logfile']) {
+ $error_msg .= "Found a logfile: you submitted " . $_POST['Logfile'] . "<BR>\n";
+ #shared_info.client_profile.set_log_file(None, $_POST['Logfile'], None)
+ $error_msg .= "ERROR: Could not set the Logfile <BR>\n";
+ }
+ if ($_POST['RootMountPoint']) {
+ $error_msg .= "Found a root mount point: you submitted " . $_POST['RootMountPoint'] . "<BR>\n";
+ #shared_info.client_profile.set_root_mount_point(None, $_POST['RootMountPoint'], None)
+ $error_msg .= "ERROR: Could not set the Root Mount Point<BR>\n";
+ }
+ if ($_POST['Network_Iface']) {
+ $error_msg .= "Found a network interface: you submitted " . $_POST['Network_Iface'] . "<BR>\n";
+ #shared_info.client_profile.set_network_interface(None, $_POST['Network_Iface'], None)
+ $error_msg .= "ERROR: Could not set the Network Interface<BR>\n";
+ }
+ if ($_POST['Network_Type']) {
+ $error_msg .= "Found a Network Type: you submitted " . $_POST['Network_Type'] . "<BR>\n";
+ #shared_info.client_profile.set_network_type(None, $_POST['Network_Type'], None)
+ $error_msg .= "ERROR: Could not set the Network Type<BR>\n";
+ }
+ if ($_POST['dhcp_options']) {
+ $error_msg .= "Found DHCP Options. You submitted " . $_POST['dhcp_options'] . "<BR>\n";
+ #shared_info.client_profile.set_network_dhcp_options(None, $_POST['dhcp_options'], None)
+ $error_msg .= "ERROR: Could not set the dhcp options<br>\n";
+ }
+ if ($_POST['ip']) {
+ $error_msg .= "Found an IP: you submitted " . $_POST['ip'] . "<BR>\n";
+ #shared_info.client_profile.set_network_ip(None, $_POST['ip'], None)
+ $error_msg .= "ERROR: Could not set the IP<BR>\n";
+ }
+ if ($_POST['broadcast']) {
+ $error_msg .= "Found an broadcast IP: you submitted " . $_POST['broadcast'] . "<BR>\n";
+ #shared_info.client_profile.set_network_broadcast(None, $_POST['broadcast'], None)
+ $error_msg .= "ERROR: Could not set the broadcast IP<BR>\n";
+ }
+ if ($_POST['netmask']) {
+ $error_msg .= "Found an netmask IP: you submitted " . $_POST['netmask'] . "<BR>\n";
+ #shared_info.client_profile.set_network_netmask(None, $_POST['netmask'], None)
+ $error_msg .= "ERROR: Could not set the netmask IP<BR>\n";
+ }
+ if ($_POST['gateway']) {
+ $error_msg .= "Found an gateway IP: you submitted " . $_POST['gateway'] . "<BR>\n";
+ #shared_info.client_profile.set_network_gateway(None, $_POST['gateway'], None)
+ $error_msg .= "ERROR: Could not set the gateway IP<BR>\n";
+ }
+ if ($_POST['http_proxy']) {
+ $error_msg .= "Found an HTTP Proxy IP: you submitted " . $_POST['http_proxy'] . "<BR>\n";
+ #shared_info.client_profile.set_http_proxy(None, $_POST['http_proxy'], None)
+ $error_msg .= "ERROR: Could not set the HTTP Proxy IP<BR>\n";
+ }
+ if ($_POST['ftp_proxy']) {
+ $error_msg .= "Found an FTP Proxy IP: you submitted " . $_POST['ftp_proxy'] . "<BR>\n";
+ #shared_info.client_profile.set_ftp_proxy(None, $_POST['ftp_proxy'], None)
+ $error_msg .= "ERROR: Could not set the FTP Proxy IP<BR>\n";
+ }
+ if ($_POST['rsync_proxy']) {
+ $error_msg .= "Found an RSYNC Proxy IP: you submitted " . $_POST['rsync_proxy'] . "<BR>\n";
+ #shared_info.client_profile.set_rsync_proxy(None, $_POST['rsync_proxy'], None)
+ $error_msg .= "ERROR: Could not set the RSYNC Proxy IP<BR>\n";
+ }
+ if ($_POST['dnsserver']) {
+ $error_msg .= "Found an DNS server: you submitted " . $_POST['dnsserver'] . "<BR>\n";
+ #shared_info.client_profile.set_dns_servers(None, $_POST['dnsserver'], None)
+ $error_msg .= "ERROR: Could not set the DNS Server<BR>\n";
+ }
+ if ($_POST['EnableSSH']) {
+ $error_msg .= "Found an Enable SSH Flag: you set it to " . $_POST['EnableSSH'] . "<BR>\n";
+ #shared_info.client_profile.set_enable_ssh(None, $_POST['EnableSSH'], None)
+ $error_msg .= "ERROR: Could not set the SSH flag<BR>\n";
+ }
+ if ($_POST['Verbose']) {
+ $error_msg .= "Found an Verbose Mode Flag: you set it to " . $_POST['Verbose'] . "<BR>\n";
+ #shared_info.client_profile.set_verbose(None, $_POST['Verbose'], None)
+ $error_msg .= "ERROR: Could not set the Verbose mode flag<BR>\n";
+ }
+ if ($_POST['RootPass1'] and $_POST['RootPass2']) {
+ $error_msg .= "Found a root password1: you submitted " . $_POST['RootPass1'] . "<BR>\n";
+ $error_msg .= "Found a root password2: you submitted " . $_POST['RootPass2'] . "<BR>\n";
+ if ($_POST['RootPass1'] == $_POST['RootPass2']) {
+ #shared_info.client_profile.set_root_passwd(None, GLIUtility.hash_password($_POST['RootPass1']), None)
+ $error_msg .= "ERROR: Could not set the root password<BR>\n";
+ } else {
+ $error_msg .= "ERROR: Passwords DO NOT MATCH!<BR>\n";
+ }
+ }
+ if ($_POST['Modules']) {
+ $error_msg .= "Found an Additional Module: you submitted " . $_POST['Modules'] . "<BR>\n";
+ #shared_info.client_profile.set_kernel_modules(None, $_POST['Modules'], None)
+ $error_msg .= "ERROR: Could not set the Kernel Modules<BR>\n";
+ }
+ if ($_POST['SaveCCFile']) {
+ $error_msg .= "Found a filename to save the Client Profile:" . $_POST['SaveCCFile'] . "<BR>\n";
+
+ #configuration = open($_POST['SaveCCFile'] ,"w")
+ # configuration.write(shared_info.client_profile.serialize())
+ # configuration.close()
+ # print "Profile saved successfully. Here it is <BR><pre>" . cgi.escape(#shared_info.client_profile.serialize()) . "</pre><br>\n"
+ $error_msg .= "ERROR: Could not save the profile!<BR>\n";
+ }
+ if ($error_msg == "") {
+ $error_msg = "Values saved successfully";
+ }
+}
+$smarty->assign('error_msg',$error_msg);
+#########################################
+$smarty->assign('advanced', True);
+
+$subarches['i386'] = 'x86';
+$subarches['i486'] = 'x86';
+$subarches['i586'] = 'x86';
+$subarches['i686'] = 'x86';
+$subarches['x86_64'] = 'amd64';
+$subarches['parisc'] = 'hppa';
+$smarty->assign('subarches', $subarches);
+
+#Choose the architecture for the Install.
+#import platform
+#arch = platform.machine()
+#if arch in subarches:
+# arch = subarches[arch]
+#Arch selection string here.<br>
+
+$arches["x86"] = "x86 (Pentium and Athlon Series)";
+$arches["amd64"] = "AMD Athlon 64 and Opteron";
+$arches["ppc"] = "PPC (New World) Macs";
+$arches["sparc"] = "Sparc (don't know how to be more specific yet";
+$arches["alpha"] = "Alpha";
+$arches["hppa"] = "HPPA";
+$smarty->assign('arches', $arches);
+
+$modules = list_modules();
+$smarty->assign('modules', $modules);
+
+$smarty->display('clientconfig.tpl');
+?>
diff --git a/webgli/templates/clientconfig.tpl b/webgli/templates/clientconfig.tpl
new file mode 100644
index 0000000..21da4cc
--- /dev/null
+++ b/webgli/templates/clientconfig.tpl
@@ -0,0 +1,84 @@
+{include file="header.tpl" title="WebGLI - Client Configuration"}
+<h2>Client Config</h2>
+{if $error_msg}
+<br>{$error_msg}<br><br>
+{/if}
+<form name="CConfig" action="" method="POST" enctype="multipart/form-data">
+{if $advanced}
+ <table border="2">
+ <tr>
+ <td>
+ Please select the architecture of the computer that gentoo will be installed on. For pentium and AMD 32-bit processors, choose x86.<br>
+ {foreach item=thisarch from=$arches key=key}
+ <input type="radio" name="ArchType" value="{$key}">{$thisarch}<br>
+ {/foreach}
+ </td>
+ <td width="15"></td>
+ <td>The installer logs all important events during the install process to a logfile for debugging purposes.
+ The file gets copied to the new system once the install is complete.
+ Enter the desired filename and path for the install log (the default is recommended):<br><input name="Logfile" type="text" maxlength="80" value="/var/log/installer.log">
+ <hr>Enter the mount point to be used to mount the partition(s) where the new system will be installed. The default is /mnt/gentoo and is greatly recommended, but any mount point will do.<br><input name="RootMountPoint" type="text" maxlength="80" value="/mnt/gentoo">
+ <hr>Debug Mode: <input name="Verbose" type="radio" value="True">Yes <input name="Verbose" type="radio" value="False" checked>No</td>
+ </tr>
+ </table>
+{/if}
+
+<hr>
+<table border="1">
+ <tr>
+ <td width="50%">In order to complete most installs, an active Internet connection is required. Setup one network connection for GLI to use to connect to the Internet if doing a network install. If your desired device does not show up in the list, you can select Other and input the device name manually. <br>
+ <select name="Network_Iface" size="4">
+ <option value="device">NEED WAY OF ADDING DEVICES</option>
+ </select>
+
+ <select name="Network_Type" size="3"><option value="dhcp">DHCP</option><option value="static">Manual Config</option><option value="None">None (Networkless)</option></select>
+ </td>
+ <td width="50%">Networking Info for Manual Configurations:<br>
+ Enter your IP address: <input name="ip" type="text" maxlength="15" value="192.168."><br>
+ Enter your Broadcast address: <input name="broadcast" type="text" maxlength="15" value=".255"><br>
+ Enter your Netmask: <input name="netmask" type="text" maxlength="15" value="255.255.255.0"><br>
+ Enter your default gateway: <input name="gateway" type="text" maxlength="15" value=".1"><br>
+ <hr>Info for DHCP Configurations:<br>DHCP Options: <input type="text" name="dhcp_options" >
+ <hr>Enter a DNS server: <input name="dnsserver" type="text" maxlength="15" value="128.118.25.3"></td>
+ </tr>
+</table>
+{if $advanced}
+ Proxy Information (if necessary):<br>
+ HTTP Proxy URI: <input name="http_proxy" type="text" value=""><br>
+ FTP Proxy URI: <input name="ftp_proxy" type="text" value=""><br>
+ RSYNC Proxy URI: <input name="rsync_proxy" type="text" value="">
+{/if}
+
+<hr>Do you want SSH enabled during the install? This will allow you to login remotely during the installation process. If choosing Yes, be sure you select a new LiveCD root password!<br>
+Enable SSH?: <input name="EnableSSH" type="radio" value="True">Yes
+<input name="EnableSSH" type="radio" value="False" checked="checked">No
+<hr>If you want to be able to login to your machine from another console during the installation,
+you will want to enter a new root password for the LiveCD.
+Note that this can be different from your new system's root password.
+Presss Enter twice to skip this step.<br>
+Enter Password:<input name="RootPass1" type="password" maxlength="80" value=""><br>
+Re-enter Password to verify:<input name="RootPass2" type="password" maxlength="80" value=""><br>
+
+{if $advanced}
+ <hr>List of loaded modules:. <br>
+ {section name=mod loop=$modules}
+ <br>{$modules[mod]}
+ {/section}
+<br>Additional Modules to Load (space-separated list): <input name="Modules" type="text" maxlength="80" value=""><br>
+{/if}
+<!-- #Save Client Configuration File. THIS SHOULD BE A POPUP -->
+<hr><br>Save Client Configuration File:<br>
+<input name="SaveCC" type="submit" value="Save Client Configuration">
+
+<!-- #Print buttons for Next/Previous/Help/Save -->
+<hr>
+<table>
+ <tr>
+ <td><input name="LoadCC" type="button" value="Load"></td>
+ <td><input name="SaveCC" type="button" value="Save"></td>
+ <td><input name="Help" type="button" value="Help"></td>
+ <td><input name="Previous" type="button" value="Previous"></td>
+ <td><input name="Next" type="button" value="Next"></td>
+ </tr>
+</table>
+</form>
diff --git a/webgli/webgliUtility.php b/webgli/webgliUtility.php
new file mode 100644
index 0000000..55c6d43
--- /dev/null
+++ b/webgli/webgliUtility.php
@@ -0,0 +1,16 @@
+<?php
+#Utility functions for WebGLI
+
+function get_eth_devices()
+{
+ $eth_devices = system("/sbin/ifconfig -a | grep -e '^[A-Za-z]'| cut -d ' ' -f 1");
+ return split(' ',$eth_devices);
+}
+
+function list_modules()
+{
+ exec("lsmod | grep -v ^Module | cut -d ' ' -f 1 ", $modules);
+ return $modules;
+}
+
+?>