summaryrefslogtreecommitdiff
path: root/webgli
diff options
context:
space:
mode:
authorPreston Cody <codeman@gentoo.org>2006-04-15 02:10:14 +0000
committerPreston Cody <codeman@gentoo.org>2006-04-15 02:10:14 +0000
commit746294fa4bf422f9231aa84fde55a10bc129e092 (patch)
tree0644564727bc05ac6d774b203e4909d444c8050e /webgli
parentChanging project name to Scire in various files. (diff)
downloadscire-746294fa4bf422f9231aa84fde55a10bc129e092.tar.gz
scire-746294fa4bf422f9231aa84fde55a10bc129e092.tar.bz2
scire-746294fa4bf422f9231aa84fde55a10bc129e092.zip
added temp copy of webgli stuff
svn path=/; revision=8
Diffstat (limited to 'webgli')
-rwxr-xr-xwebgli/banner-800x64.pngbin0 -> 18229 bytes
-rw-r--r--webgli/bootloader.php100
-rw-r--r--webgli/images/CVS/Entries16
-rw-r--r--webgli/images/CVS/Repository1
-rw-r--r--webgli/images/CVS/Root1
-rw-r--r--webgli/images/arrow_l.gifbin0 -> 60 bytes
-rw-r--r--webgli/images/arrow_r.gifbin0 -> 61 bytes
-rw-r--r--webgli/images/header.pngbin0 -> 14606 bytes
-rw-r--r--webgli/images/header_bg.pngbin0 -> 351 bytes
-rw-r--r--webgli/images/icon-harddisk-noia_48x48.pngbin0 -> 5140 bytes
-rw-r--r--webgli/images/partition_bg.pngbin0 -> 260 bytes
-rw-r--r--webgli/images/partition_drag.pngbin0 -> 172 bytes
-rw-r--r--webgli/images/spacer.pngbin0 -> 109 bytes
-rw-r--r--webgli/images/tab_n_l.pngbin0 -> 221 bytes
-rw-r--r--webgli/images/tab_n_m.pngbin0 -> 338 bytes
-rw-r--r--webgli/images/tab_n_r.pngbin0 -> 322 bytes
-rw-r--r--webgli/images/tab_s_l.pngbin0 -> 188 bytes
-rw-r--r--webgli/images/tab_s_ml.pngbin0 -> 360 bytes
-rw-r--r--webgli/images/tab_s_mr.pngbin0 -> 461 bytes
-rw-r--r--webgli/images/tab_s_r.pngbin0 -> 300 bytes
-rw-r--r--webgli/index.php31
-rw-r--r--webgli/templates/.bootloader.tpl.swpbin0 -> 12288 bytes
-rw-r--r--webgli/templates/bootloader.tpl43
-rw-r--r--webgli/templates/bottom.tpl6
-rw-r--r--webgli/templates/header.tpl59
-rw-r--r--webgli/templates/index.tpl1
-rw-r--r--webgli/templates_c/%%09^090^090AEC3A%%bootloader.tpl.php105
-rw-r--r--webgli/templates_c/%%45^45E^45E480CD%%index.tpl.php7
-rw-r--r--webgli/templates_c/%%65^655^6551DB6B%%bottom.tpl.php8
-rw-r--r--webgli/templates_c/%%F7^F7F^F7F34188%%header.tpl.php64
-rw-r--r--webgli/webgli.css107
-rw-r--r--webgli/webgli.js80
-rw-r--r--webgli/webgliIP.php1671
33 files changed, 2300 insertions, 0 deletions
diff --git a/webgli/banner-800x64.png b/webgli/banner-800x64.png
new file mode 100755
index 0000000..fa60b92
--- /dev/null
+++ b/webgli/banner-800x64.png
Binary files differ
diff --git a/webgli/bootloader.php b/webgli/bootloader.php
new file mode 100644
index 0000000..cd210ca
--- /dev/null
+++ b/webgli/bootloader.php
@@ -0,0 +1,100 @@
+<?php
+include('webgliIP.php');
+if (!isset($_SESSION['install_profile'])) {
+ print "must set install profile. doing so now.";
+ session_start();
+ $_SESSION['install_profile'] = new InstallProfile;
+ session_write_close();
+}
+print_r( $_SESSION);
+#return 0;
+#session_unset();
+$ip = $_SESSION['install_profile'];
+print "<br><br>".$ip->boot_loader_pkg;
+
+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['setbootloader']) {
+ if ($_POST['bootloader']) {
+ //try:
+ $_SESSION['install_profile']->set_boot_loader_pkg($_POST['bootloader']) or
+ // except:
+ $error_msg .= "ERROR: Could not set the bootloader pkg!";
+ }
+ if ($_POST['bootmbr']) {
+ //try:
+ $_SESSION['install_profile']['bootmbr'] = $_POST['bootmbr'] or
+ $error_msg .= "ERROR: Could not set the bootloader MBR flag to TRUE";
+ if ($_POST['boot_drive_choice']) {
+ //try:
+ $_SESSION['install_profile']['boot_drive_choice'] = $_POST['boot_drive_choice'] or
+ $error_msg .= "ERROR! Could not set the boot device! ".$_POST['boot_drive_choice'];
+ //except:
+ }
+ }
+ else {
+ //try:
+ $_SESSION['install_profile']['bootmbr'] = False or
+ //except:
+ $error_msg .= "ERROR: Could not set the bootloader MBR flag to FALSE.";
+ if ($_POST['bootargs']) {
+ //try:
+ $_SESSION['install_profile']['bootargs'] = $_POST['bootargs'] or
+ //except:
+ $error_msg .= "ERROR: Could not set the bootloader kernel arguments!";
+ }
+ }
+ if (!$error_msg) {
+ $error_msg = "Values saved successfully";
+ }
+}
+$arch = "x86";
+$parts;
+//arch = shared_info.client_profile.get_architecture_template()
+//parts = shared_info.install_profile.get_partition_tables()
+$advanced = $_SESSION['install_profile']['advanced'] or $advanced = True;
+$boot_device = "hda"; //$_SESSION['install_profile']['boot_device'];
+#Bootloader code yanked from the x86ArchTemplate
+//if shared_info.install_profile.get_boot_device():
+/*
+ $boot_device = shared_info.install_profile.get_boot_device()
+else:
+ boot_device = ""
+ foundboot = False
+ for device in parts:
+ tmp_partitions = parts[device] #.get_install_profile_structure()
+ for partition in tmp_partitions:
+ mountpoint = tmp_partitions[partition]['mountpoint']
+ if (mountpoint == "/boot"):
+ foundboot = True
+ if (( (mountpoint == "/") and (not foundboot) ) or (mountpoint == "/boot")):
+ boot_device = device
+
+bootloader = shared_info.install_profile.get_boot_loader_pkg()
+$arch_loaders = array('x86': [
+ ("grub",(u"GRand Unified Bootloader, newer, RECOMMENDED")),
+ ("lilo",(u"LInux LOader, older, traditional.(detects windows partitions)"))],
+ 'amd64': [
+ ("grub",(u"GRand Unified Bootloader, newer, RECOMMENDED"))]} #FIXME ADD OTHER ARCHS
+boot_loaders = arch_loaders[arch]
+boot_loaders.append(("none", (u"Do not install a bootloader. (System may be unbootable!)")))
+bootargs = shared_info.install_profile.get_bootloader_kernel_args()
+*/
+ $bootloaders = array();
+ array_push($bootloaders, array("grub", "GRand Unified Bootloader, newer, RECOMMENDED") );
+ array_push($bootloaders, array("lilo", "LInux LOader, older, traditional.(detects windows partitions)") );
+
+ $smarty->assign('boot_device', $boot_device);
+ $smarty->assign('bootargs', $bootargs);
+ $smarty->assign('bootloaders', $bootloaders);
+ $smarty->assign('advanced', $advanced);
+
+ $smarty->display('bootloader.tpl');
+?>
diff --git a/webgli/images/CVS/Entries b/webgli/images/CVS/Entries
new file mode 100644
index 0000000..5dbc73e
--- /dev/null
+++ b/webgli/images/CVS/Entries
@@ -0,0 +1,16 @@
+/header.png/1.1/Sun Oct 23 18:16:11 2005//
+/spacer.png/1.1/Sun Oct 23 18:16:11 2005//
+/tab_n_l.png/1.1/Sun Oct 23 18:16:11 2005//
+/tab_n_m.png/1.1/Sun Oct 23 18:16:11 2005//
+/tab_n_r.png/1.1/Sun Oct 23 18:16:11 2005//
+/tab_s_l.png/1.1/Sun Oct 23 18:16:11 2005//
+/tab_s_ml.png/1.1/Sun Oct 23 18:16:11 2005//
+/tab_s_mr.png/1.1/Sun Oct 23 18:16:11 2005//
+/tab_s_r.png/1.1/Sun Oct 23 18:16:11 2005//
+/icon-harddisk-noia_48x48.png/1.1/Fri Nov 11 00:21:00 2005//
+/header_bg.png/1.2/Sun Dec 4 03:33:55 2005//
+/arrow_l.gif/1.1/Thu Jan 26 03:36:56 2006//
+/arrow_r.gif/1.1/Thu Jan 26 03:36:56 2006//
+/partition_bg.png/1.1/Thu Jan 26 03:36:56 2006//
+/partition_drag.png/1.1/Thu Jan 26 03:36:56 2006//
+D
diff --git a/webgli/images/CVS/Repository b/webgli/images/CVS/Repository
new file mode 100644
index 0000000..7c54577
--- /dev/null
+++ b/webgli/images/CVS/Repository
@@ -0,0 +1 @@
+gentoo/src/installer/src/net/server/html/images
diff --git a/webgli/images/CVS/Root b/webgli/images/CVS/Root
new file mode 100644
index 0000000..3079522
--- /dev/null
+++ b/webgli/images/CVS/Root
@@ -0,0 +1 @@
+codeman@cvs.gentoo.org:/var/cvsroot
diff --git a/webgli/images/arrow_l.gif b/webgli/images/arrow_l.gif
new file mode 100644
index 0000000..6e91fea
--- /dev/null
+++ b/webgli/images/arrow_l.gif
Binary files differ
diff --git a/webgli/images/arrow_r.gif b/webgli/images/arrow_r.gif
new file mode 100644
index 0000000..da5867d
--- /dev/null
+++ b/webgli/images/arrow_r.gif
Binary files differ
diff --git a/webgli/images/header.png b/webgli/images/header.png
new file mode 100644
index 0000000..22da58c
--- /dev/null
+++ b/webgli/images/header.png
Binary files differ
diff --git a/webgli/images/header_bg.png b/webgli/images/header_bg.png
new file mode 100644
index 0000000..d8b1063
--- /dev/null
+++ b/webgli/images/header_bg.png
Binary files differ
diff --git a/webgli/images/icon-harddisk-noia_48x48.png b/webgli/images/icon-harddisk-noia_48x48.png
new file mode 100644
index 0000000..a6c27af
--- /dev/null
+++ b/webgli/images/icon-harddisk-noia_48x48.png
Binary files differ
diff --git a/webgli/images/partition_bg.png b/webgli/images/partition_bg.png
new file mode 100644
index 0000000..dc63f2b
--- /dev/null
+++ b/webgli/images/partition_bg.png
Binary files differ
diff --git a/webgli/images/partition_drag.png b/webgli/images/partition_drag.png
new file mode 100644
index 0000000..beae23d
--- /dev/null
+++ b/webgli/images/partition_drag.png
Binary files differ
diff --git a/webgli/images/spacer.png b/webgli/images/spacer.png
new file mode 100644
index 0000000..8728643
--- /dev/null
+++ b/webgli/images/spacer.png
Binary files differ
diff --git a/webgli/images/tab_n_l.png b/webgli/images/tab_n_l.png
new file mode 100644
index 0000000..91bad72
--- /dev/null
+++ b/webgli/images/tab_n_l.png
Binary files differ
diff --git a/webgli/images/tab_n_m.png b/webgli/images/tab_n_m.png
new file mode 100644
index 0000000..51a60e7
--- /dev/null
+++ b/webgli/images/tab_n_m.png
Binary files differ
diff --git a/webgli/images/tab_n_r.png b/webgli/images/tab_n_r.png
new file mode 100644
index 0000000..fa4ab52
--- /dev/null
+++ b/webgli/images/tab_n_r.png
Binary files differ
diff --git a/webgli/images/tab_s_l.png b/webgli/images/tab_s_l.png
new file mode 100644
index 0000000..735c22a
--- /dev/null
+++ b/webgli/images/tab_s_l.png
Binary files differ
diff --git a/webgli/images/tab_s_ml.png b/webgli/images/tab_s_ml.png
new file mode 100644
index 0000000..5491ad6
--- /dev/null
+++ b/webgli/images/tab_s_ml.png
Binary files differ
diff --git a/webgli/images/tab_s_mr.png b/webgli/images/tab_s_mr.png
new file mode 100644
index 0000000..f0678b3
--- /dev/null
+++ b/webgli/images/tab_s_mr.png
Binary files differ
diff --git a/webgli/images/tab_s_r.png b/webgli/images/tab_s_r.png
new file mode 100644
index 0000000..1cfc705
--- /dev/null
+++ b/webgli/images/tab_s_r.png
Binary files differ
diff --git a/webgli/index.php b/webgli/index.php
new file mode 100644
index 0000000..1c89f3e
--- /dev/null
+++ b/webgli/index.php
@@ -0,0 +1,31 @@
+<?php
+
+include('Smarty.class.php');
+#require_once('Frodo.php');
+#if(!isset($_SESSION['userid'])) {
+ #print "<h1>NO MATCH</h1>";
+# header("Location: login.php");
+#}
+#else {
+# print "Welcome $_SESSION[userid]<br>";
+#}
+
+$smarty = new Smarty;
+#phpinfo();
+$smarty->template_dir = './templates';
+$smarty->compile_dir = './templates_c';
+$smarty->cache_dir = './cache';
+$smarty->config_dir = './configs';
+
+
+
+$smarty->display('index.tpl');
+
+
+# print "Welcome to WebGLI. This is the index page. It has index-y stuff on it. ok?";
+
+
+
+
+
+?>
diff --git a/webgli/templates/.bootloader.tpl.swp b/webgli/templates/.bootloader.tpl.swp
new file mode 100644
index 0000000..791978d
--- /dev/null
+++ b/webgli/templates/.bootloader.tpl.swp
Binary files differ
diff --git a/webgli/templates/bootloader.tpl b/webgli/templates/bootloader.tpl
new file mode 100644
index 0000000..a484bae
--- /dev/null
+++ b/webgli/templates/bootloader.tpl
@@ -0,0 +1,43 @@
+{include file="header.tpl" title="WebGLI - Bootloader"}
+<p>Bootloader Settings:</p>
+{if $error_msg}
+<br>{$error_msg}<br><br>
+{/if}
+<form name="Bloader" method="post" action="" enctype="multipart/form-data">
+<p>To boot successfully into your new Linux system, a bootloader will be needed. If you already have a bootloader you want to use you can select None here. The bootloader choices available are dependent on what GLI supports and what architecture your system is. Choose a bootloader:</p>
+<table width="100%" border="1">
+{section name=bl loop=$bootloaders}
+<tr><td><input name="bootloader" type="radio" value="{$bootloaders[bl][0]}" {if $bootloaders[bl][0] == $bootloader} checked {/if} > {$bootloaders[bl][0]}</td><td>{$bootloaders[bl][1]}</td></tr>
+{/section}
+</table>
+{if $advanced}
+ <hr>
+ Most bootloaders have the ability to install to either the Master Boot Record (MBR) or some other partition. Most people will want their bootloader installed on the MBR for successful boots, but if you have special circumstances, you can have the bootloader installed to the /boot partition instead. Do you want the boot loader installed in the MBR? (YES is RECOMMENDED)
+ <p>
+
+<input name="bootmbr" type="checkbox" id="bootmbr" value="True" {if $bootmbr} checked {/if}> Install to MBR </p>
+{/if}
+
+{if (!$boot_device)}
+<br> You need to partition before you can select the boot device.<br>
+{/if}
+{if ($boot_device)}
+ and $boot_device[-1] != 'a'
+ Your boot device may not be correct. It is currently set to {$boot_device}, but this device may not be the first to boot. Usually boot devices end in 'a' such as hda or sda.
+ <br>Please confirm your boot device.<br>
+ {section name=bootdevices loop=bootdevices}
+ <input type="radio" name="boot_drive_choice" value="{$bootdevices}">{$bootdevices}<br>
+ {/section}
+{/if}
+
+<br>
+{if $advanced}
+ <p>If you have any additional optional arguments you want to pass to the kernel at boot, type them here:
+ <input name="bootargs" type="text" id="bootargs" value="{$bootargs}">
+ </p>
+{/if}
+<p>
+<input name="setbootloader" type="submit" id="setbootloader" value="Save Bootloader Settings">
+</p>
+</form>
+{include file="bottom.tpl"}
diff --git a/webgli/templates/bottom.tpl b/webgli/templates/bottom.tpl
new file mode 100644
index 0000000..99c2255
--- /dev/null
+++ b/webgli/templates/bottom.tpl
@@ -0,0 +1,6 @@
+ </td>
+ </tr>
+</table>
+
+</body>
+</html>
diff --git a/webgli/templates/header.tpl b/webgli/templates/header.tpl
new file mode 100644
index 0000000..4e16042
--- /dev/null
+++ b/webgli/templates/header.tpl
@@ -0,0 +1,59 @@
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>{$title|default:"WebGLI"}</title>
+<link rel="stylesheet" href="webgli.css" type="text/css" />
+ <script language="JavaScript" SRC="webgli.js">
+ </script>
+</head>
+<body>
+
+<table id="layout" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr id="header">
+ <td colspan="2">
+ <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="50%">
+ <img src="images/header_bg.png" border="0" width="100%" height="64">
+ </td>
+ <td>
+ <img src="images/header.png" alt="Gentoo Linux Installer" border="0" width="400" height="64">
+ </td>
+ <td width="50%">
+ <img src="images/header_bg.png" border="0" width="100%" height="64">
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <ul id="steps">
+ <li><a class="step" href="/webgli/index.php">Welcome</a></li>
+ <li><a class="step" href="/webgli/clientconfig.php">Client Config</a></li>
+ <li><a class="step" href="/webgli/partitioning.php">Partitioning</a></li>
+ <li><a class="step" href="/webgli/networkmounts.php">Network Mounts</a></li>
+ <li><a class="step" href="/webgli/stageselection.php">Stage Selection</a></li>
+ <li><a class="step" href="/webgli/portagetree.php">Portage Tree</a></li>
+ <li><a class="step" href="/webgli/globaluse.php">Global USE Flags</a></li>
+ <li><a class="step" href="/webgli/localuse.php">Local USE Flags</a></li>
+{if $advanced_mode}
+ <li><a class="step" href="/webgli/makedotconf.php">Make.conf</a></li>
+ <li><a class="step" href="/webgli/configfiles.php">Config Files</a></li>
+ <li><a class="step" href="/webgli/etc_portage.php">etc/portage</a></li>
+{/if}
+ <li><a class="step" href="/webgli/kernel.php">Kernel</a></li>
+ <li><a class="step" href="/webgli/bootloader.php">Bootloader</a></li>
+ <li><a class="step" href="/webgli/timezone.php">Timezone</a></li>
+ <li><a class="step" href="/webgli/networking.php">Networking</a></li>
+ <li><a class="step" href="/webgli/daemons.php">Daemons</a></li>
+ <li><a class="step" href="/webgli/extrapackages.php">Extra Packages</a></li>
+ <li><a class="step" href="/webgli/services.php">Services</a></li>
+ <li><a class="step" href="/webgli/users.php">Users</a></li>
+ <li><a class="step" href="/webgli/review.php">Review</a></li>
+ </ul>
+ <ul id="menu">
+ <li><a href="/webgli/saveprofile.php">Save Profile</a></li>
+ <li><a href="/webgli/loadprofile.php">Load Profile</a></li>
+ </ul>
+ </td>
+ <td id="content" width="100%" valign="top">
diff --git a/webgli/templates/index.tpl b/webgli/templates/index.tpl
new file mode 100644
index 0000000..8276f7f
--- /dev/null
+++ b/webgli/templates/index.tpl
@@ -0,0 +1 @@
+{include file="header.tpl" title="WebGLI - Main Page"}
diff --git a/webgli/templates_c/%%09^090^090AEC3A%%bootloader.tpl.php b/webgli/templates_c/%%09^090^090AEC3A%%bootloader.tpl.php
new file mode 100644
index 0000000..ad2583a
--- /dev/null
+++ b/webgli/templates_c/%%09^090^090AEC3A%%bootloader.tpl.php
@@ -0,0 +1,105 @@
+<?php /* Smarty version 2.6.10, created on 2006-04-14 19:56:49
+ compiled from bootloader.tpl */ ?>
+<?php $_smarty_tpl_vars = $this->_tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "header.tpl", 'smarty_include_vars' => array('title' => "WebGLI - Bootloader")));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?>
+<p>Bootloader Settings:</p>
+<?php if ($this->_tpl_vars['error_msg']): ?>
+<br><?php echo $this->_tpl_vars['error_msg']; ?>
+<br><br>
+<?php endif; ?>
+<form name="Bloader" method="post" action="" enctype="multipart/form-data">
+<p>To boot successfully into your new Linux system, a bootloader will be needed. If you already have a bootloader you want to use you can select None here. The bootloader choices available are dependent on what GLI supports and what architecture your system is. Choose a bootloader:</p>
+<table width="100%" border="1">
+<?php unset($this->_sections['bl']);
+$this->_sections['bl']['name'] = 'bl';
+$this->_sections['bl']['loop'] = is_array($_loop=$this->_tpl_vars['bootloaders']) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
+$this->_sections['bl']['show'] = true;
+$this->_sections['bl']['max'] = $this->_sections['bl']['loop'];
+$this->_sections['bl']['step'] = 1;
+$this->_sections['bl']['start'] = $this->_sections['bl']['step'] > 0 ? 0 : $this->_sections['bl']['loop']-1;
+if ($this->_sections['bl']['show']) {
+ $this->_sections['bl']['total'] = $this->_sections['bl']['loop'];
+ if ($this->_sections['bl']['total'] == 0)
+ $this->_sections['bl']['show'] = false;
+} else
+ $this->_sections['bl']['total'] = 0;
+if ($this->_sections['bl']['show']):
+
+ for ($this->_sections['bl']['index'] = $this->_sections['bl']['start'], $this->_sections['bl']['iteration'] = 1;
+ $this->_sections['bl']['iteration'] <= $this->_sections['bl']['total'];
+ $this->_sections['bl']['index'] += $this->_sections['bl']['step'], $this->_sections['bl']['iteration']++):
+$this->_sections['bl']['rownum'] = $this->_sections['bl']['iteration'];
+$this->_sections['bl']['index_prev'] = $this->_sections['bl']['index'] - $this->_sections['bl']['step'];
+$this->_sections['bl']['index_next'] = $this->_sections['bl']['index'] + $this->_sections['bl']['step'];
+$this->_sections['bl']['first'] = ($this->_sections['bl']['iteration'] == 1);
+$this->_sections['bl']['last'] = ($this->_sections['bl']['iteration'] == $this->_sections['bl']['total']);
+?>
+<tr><td><input name="bootloader" type="radio" value="<?php echo $this->_tpl_vars['bootloaders'][$this->_sections['bl']['index']][0]; ?>
+" <?php if ($this->_tpl_vars['bootloaders'][$this->_sections['bl']['index']][0] == $this->_tpl_vars['bootloader']): ?> checked <?php endif; ?> > <?php echo $this->_tpl_vars['bootloaders'][$this->_sections['bl']['index']][0]; ?>
+</td><td><?php echo $this->_tpl_vars['bootloaders'][$this->_sections['bl']['index']][1]; ?>
+</td></tr>
+<?php endfor; endif; ?>
+</table>
+<?php if ($this->_tpl_vars['advanced']): ?>
+ <hr>
+ Most bootloaders have the ability to install to either the Master Boot Record (MBR) or some other partition. Most people will want their bootloader installed on the MBR for successful boots, but if you have special circumstances, you can have the bootloader installed to the /boot partition instead. Do you want the boot loader installed in the MBR? (YES is RECOMMENDED)
+ <p>
+
+<input name="bootmbr" type="checkbox" id="bootmbr" value="True" <?php if ($this->_tpl_vars['bootmbr']): ?> checked <?php endif; ?>> Install to MBR </p>
+<?php endif; ?>
+
+<?php if (( ! $this->_tpl_vars['boot_device'] )): ?>
+<br> You need to partition before you can select the boot device.<br>
+<?php endif; if (( $this->_tpl_vars['boot_device'] )): ?>
+ and $boot_device[-1] != 'a'
+ Your boot device may not be correct. It is currently set to <?php echo $this->_tpl_vars['boot_device']; ?>
+, but this device may not be the first to boot. Usually boot devices end in 'a' such as hda or sda.
+ <br>Please confirm your boot device.<br>
+ <?php unset($this->_sections['bootdevices']);
+$this->_sections['bootdevices']['name'] = 'bootdevices';
+$this->_sections['bootdevices']['loop'] = is_array($_loop='bootdevices') ? count($_loop) : max(0, (int)$_loop); unset($_loop);
+$this->_sections['bootdevices']['show'] = true;
+$this->_sections['bootdevices']['max'] = $this->_sections['bootdevices']['loop'];
+$this->_sections['bootdevices']['step'] = 1;
+$this->_sections['bootdevices']['start'] = $this->_sections['bootdevices']['step'] > 0 ? 0 : $this->_sections['bootdevices']['loop']-1;
+if ($this->_sections['bootdevices']['show']) {
+ $this->_sections['bootdevices']['total'] = $this->_sections['bootdevices']['loop'];
+ if ($this->_sections['bootdevices']['total'] == 0)
+ $this->_sections['bootdevices']['show'] = false;
+} else
+ $this->_sections['bootdevices']['total'] = 0;
+if ($this->_sections['bootdevices']['show']):
+
+ for ($this->_sections['bootdevices']['index'] = $this->_sections['bootdevices']['start'], $this->_sections['bootdevices']['iteration'] = 1;
+ $this->_sections['bootdevices']['iteration'] <= $this->_sections['bootdevices']['total'];
+ $this->_sections['bootdevices']['index'] += $this->_sections['bootdevices']['step'], $this->_sections['bootdevices']['iteration']++):
+$this->_sections['bootdevices']['rownum'] = $this->_sections['bootdevices']['iteration'];
+$this->_sections['bootdevices']['index_prev'] = $this->_sections['bootdevices']['index'] - $this->_sections['bootdevices']['step'];
+$this->_sections['bootdevices']['index_next'] = $this->_sections['bootdevices']['index'] + $this->_sections['bootdevices']['step'];
+$this->_sections['bootdevices']['first'] = ($this->_sections['bootdevices']['iteration'] == 1);
+$this->_sections['bootdevices']['last'] = ($this->_sections['bootdevices']['iteration'] == $this->_sections['bootdevices']['total']);
+?>
+ <input type="radio" name="boot_drive_choice" value="<?php echo $this->_tpl_vars['bootdevices']; ?>
+"><?php echo $this->_tpl_vars['bootdevices']; ?>
+<br>
+ <?php endfor; endif; endif; ?>
+
+<br>
+<?php if ($this->_tpl_vars['advanced']): ?>
+ <p>If you have any additional optional arguments you want to pass to the kernel at boot, type them here:
+ <input name="bootargs" type="text" id="bootargs" value="<?php echo $this->_tpl_vars['bootargs']; ?>
+">
+ </p>
+<?php endif; ?>
+<p>
+<input name="setbootloader" type="submit" id="setbootloader" value="Save Bootloader Settings">
+</p>
+</form>
+<?php $_smarty_tpl_vars = $this->_tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "bottom.tpl", 'smarty_include_vars' => array()));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?> \ No newline at end of file
diff --git a/webgli/templates_c/%%45^45E^45E480CD%%index.tpl.php b/webgli/templates_c/%%45^45E^45E480CD%%index.tpl.php
new file mode 100644
index 0000000..1637412
--- /dev/null
+++ b/webgli/templates_c/%%45^45E^45E480CD%%index.tpl.php
@@ -0,0 +1,7 @@
+<?php /* Smarty version 2.6.10, created on 2006-04-13 22:13:15
+ compiled from index.tpl */ ?>
+<?php $_smarty_tpl_vars = $this->_tpl_vars;
+$this->_smarty_include(array('smarty_include_tpl_file' => "header.tpl", 'smarty_include_vars' => array('title' => "WebGLI - Main Page")));
+$this->_tpl_vars = $_smarty_tpl_vars;
+unset($_smarty_tpl_vars);
+ ?> \ No newline at end of file
diff --git a/webgli/templates_c/%%65^655^6551DB6B%%bottom.tpl.php b/webgli/templates_c/%%65^655^6551DB6B%%bottom.tpl.php
new file mode 100644
index 0000000..55005a8
--- /dev/null
+++ b/webgli/templates_c/%%65^655^6551DB6B%%bottom.tpl.php
@@ -0,0 +1,8 @@
+<?php /* Smarty version 2.6.10, created on 2006-04-14 15:40:39
+ compiled from bottom.tpl */ ?>
+ </td>
+ </tr>
+</table>
+
+</body>
+</html> \ No newline at end of file
diff --git a/webgli/templates_c/%%F7^F7F^F7F34188%%header.tpl.php b/webgli/templates_c/%%F7^F7F^F7F34188%%header.tpl.php
new file mode 100644
index 0000000..6ebc8ce
--- /dev/null
+++ b/webgli/templates_c/%%F7^F7F^F7F34188%%header.tpl.php
@@ -0,0 +1,64 @@
+<?php /* Smarty version 2.6.10, created on 2006-04-14 15:00:11
+ compiled from header.tpl */ ?>
+<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
+smarty_core_load_plugins(array('plugins' => array(array('modifier', 'default', 'header.tpl', 3, false),)), $this); ?>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title><?php echo ((is_array($_tmp=@$this->_tpl_vars['title'])) ? $this->_run_mod_handler('default', true, $_tmp, 'WebGLI') : smarty_modifier_default($_tmp, 'WebGLI')); ?>
+</title>
+<link rel="stylesheet" href="webgli.css" type="text/css" />
+ <script language="JavaScript" SRC="webgli.js">
+ </script>
+</head>
+<body>
+
+<table id="layout" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr id="header">
+ <td colspan="2">
+ <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="50%">
+ <img src="images/header_bg.png" border="0" width="100%" height="64">
+ </td>
+ <td>
+ <img src="images/header.png" alt="Gentoo Linux Installer" border="0" width="400" height="64">
+ </td>
+ <td width="50%">
+ <img src="images/header_bg.png" border="0" width="100%" height="64">
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <ul id="steps">
+ <li><a class="step" href="/webgli/index.php">Welcome</a></li>
+ <li><a class="step" href="/webgli/clientconfig.php">Client Config</a></li>
+ <li><a class="step" href="/webgli/partitioning.php">Partitioning</a></li>
+ <li><a class="step" href="/webgli/networkmounts.php">Network Mounts</a></li>
+ <li><a class="step" href="/webgli/stageselection.php">Stage Selection</a></li>
+ <li><a class="step" href="/webgli/portagetree.php">Portage Tree</a></li>
+ <li><a class="step" href="/webgli/globaluse.php">Global USE Flags</a></li>
+ <li><a class="step" href="/webgli/localuse.php">Local USE Flags</a></li>
+<?php if ($this->_tpl_vars['advanced_mode']): ?>
+ <li><a class="step" href="/webgli/makedotconf.php">Make.conf</a></li>
+ <li><a class="step" href="/webgli/configfiles.php">Config Files</a></li>
+ <li><a class="step" href="/webgli/etc_portage.php">etc/portage</a></li>
+<?php endif; ?>
+ <li><a class="step" href="/webgli/kernel.php">Kernel</a></li>
+ <li><a class="step" href="/webgli/bootloader.php">Bootloader</a></li>
+ <li><a class="step" href="/webgli/timezone.php">Timezone</a></li>
+ <li><a class="step" href="/webgli/networking.php">Networking</a></li>
+ <li><a class="step" href="/webgli/daemons.php">Daemons</a></li>
+ <li><a class="step" href="/webgli/extrapackages.php">Extra Packages</a></li>
+ <li><a class="step" href="/webgli/services.php">Services</a></li>
+ <li><a class="step" href="/webgli/users.php">Users</a></li>
+ <li><a class="step" href="/webgli/review.php">Review</a></li>
+ </ul>
+ <ul id="menu">
+ <li><a href="/webgli/saveprofile.php">Save Profile</a></li>
+ <li><a href="/webgli/loadprofile.php">Load Profile</a></li>
+ </ul>
+ </td>
+ <td id="content" width="100%" valign="top"> \ No newline at end of file
diff --git a/webgli/webgli.css b/webgli/webgli.css
new file mode 100644
index 0000000..41f253b
--- /dev/null
+++ b/webgli/webgli.css
@@ -0,0 +1,107 @@
+html {
+ margin: 0px;
+}
+body {
+ margin: 0px;
+ font-family: Bitstream Vera Sans, Helvetica, Sans;
+ font-size: 10pt;
+}
+table {
+ border-spacing: 0px;
+}
+td {
+ padding: 0px;
+}
+p {
+ margin-top: 0px;
+ margin-bottom: 5px;
+}
+ul {
+ margin: 0px;
+ padding: 0px;
+ border-top: 1px solid #ffffff;
+ border-bottom: 10px solid #ffffff;
+}
+li {
+ width: 150px;
+ border-right: 1px solid #ffffff;
+ border-bottom: 1px solid #ffffff;
+}
+#content {
+ padding-top: 7px;
+ padding-left: 7px;
+}
+.title {
+ font-size: 1.2em;
+ font-weight: bold;
+}
+a.step {
+ display: block;
+ position: relative;
+ width: 100%;
+ padding: 1px;
+ background-color: #d8d4e2;
+ color: #000000;
+ text-decoration: none;
+}
+a.step:hover {
+ background: #7e60e2 url("images/arrow_l.gif") no-repeat scroll right;
+}
+.currentstep {
+ padding: 1px;
+ background: #ffffff url("images/arrow_r.gif") no-repeat scroll right;
+ font-weight: bold;
+ cursor: default;
+}
+a.menuitem {
+ display: block;
+ position: relative;
+ padding: 1px;
+ background-color: #d8d4e2;
+ color: #000000;
+ text-decoration: none;
+}
+a.menuitem:hover {
+ background: #7e60e2 url("images/arrow_l.gif") no-repeat scroll right;
+}
+.partition {
+ display: table;
+ background: #d8d4e2 url("images/partition_bg.png") no-repeat;
+}
+.partition_drag {
+ padding-right: 15px;
+ height: 30px;
+ background: transparent url("images/partition_drag.png") no-repeat scroll top right;
+ cursor: w-resize;
+ overflow: hidden;
+ position: relative;
+}
+.partition_drag[class] {
+ position: static;
+ display: table;
+}
+.partition_inner {
+ cursor: default;
+ position: absolute;
+ top: 50%;
+}
+.partition_inner[class] {
+ position: static;
+ display: table-cell;
+ vertical-align: middle;
+}
+.partition_free {
+ height: 18px;
+ margin-left: 6px;
+ border-right: 4px solid #d8d4e2;
+ background-color: #ffffff;
+ position: relative;
+ top: -50%;
+}
+.partition_free[class] {
+ position: static;
+}
+.partition_used {
+ height: 18px;
+ background-color: #00ffff;
+}
diff --git a/webgli/webgli.js b/webgli/webgli.js
new file mode 100644
index 0000000..00dd4ab
--- /dev/null
+++ b/webgli/webgli.js
@@ -0,0 +1,80 @@
+ function browserType() {
+ var type;
+ if (document.layers) {
+ type = 'nn4';
+ }
+ if (document.all) {
+ type = 'ie';
+ }
+ if (window.navigator.userAgent.toLowerCase().match("gecko")) {
+ type = 'gecko';
+ }
+ return type;
+ }
+ var browser_type = browserType();
+ function findLayer(name) {
+ var layer;
+ if (browser_type == 'gecko') {
+ layer = eval('document.getElementById(\'' + name + '\')');
+ } else if (browser_type == 'ie') {
+ layer = eval('document.all[\'' + name + '\']');
+ } else {
+ layer = eval('document.layers[\'' + name + '\']');
+ }
+ return layer;
+ }
+ var resizeOb = new Object();
+ function resizeStart(event) {
+ var x;
+ if (browser_type == 'ie') {
+ resizeOb.layer = window.event.srcElement;
+ x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
+ } else {
+ resizeOb.layer = event.target;
+ x = event.clientX + window.scrollX;
+ }
+ resizeOb.startX = x;
+ resizeOb.startW = parseInt(resizeOb.layer.style.width, 10);
+ if (isNaN(resizeOb.startW)) {
+ resizeOb.startW = 0;
+ }
+ if (browser_type == 'ie') {
+ document.attachEvent("onmousemove", resizeMove);
+ document.attachEvent("onmouseup", resizeStop);
+ window.event.cancelBubble = true;
+ window.event.returnValue = false;
+ } else {
+ document.addEventListener("mousemove", resizeMove, true);
+ document.addEventListener("mouseup", resizeStop, true);
+ event.preventDefault();
+ }
+ }
+ function resizeMove(event) {
+ var x, w;
+ if (browser_type == 'ie') {
+ x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
+ } else {
+ x = event.clientX + window.scrollX;
+ }
+ w = (resizeOb.startW + (x - resizeOb.startX));
+ if (w <= (parseInt(resizeOb.layer.parentNode.style.width, 10) - (15 + 4))) {
+ if (w >= (parseInt(findLayer('partition_used').style.width, 10) + 10)) {
+ resizeOb.layer.style.width = w + 'px';
+ }
+ }
+ if (browser_type == 'ie') {
+ window.event.cancelBubble = true;
+ window.event.returnValue = false;
+ } else {
+ event.preventDefault();
+ }
+ }
+ function resizeStop(event) {
+ if (browser_type == 'ie') {
+ document.detachEvent("onmousemove", resizeMove);
+ document.detachEvent("onmouseup", resizeStop);
+ } else {
+ document.removeEventListener("mousemove", resizeMove, true);
+ document.removeEventListener("mouseup", resizeStop, true);
+ }
+ }
diff --git a/webgli/webgliIP.php b/webgli/webgliIP.php
new file mode 100644
index 0000000..7200c36
--- /dev/null
+++ b/webgli/webgliIP.php
@@ -0,0 +1,1671 @@
+<?php
+/*"""
+# Copyright 1999-2005 Gentoo Foundation
+# This source code is distributed under the terms of version 2 of the GNU
+# General Public License as published by the Free Software Foundation, a copy
+# of which can be found in the main directory of this project.
+Gentoo Linux Installer
+
+$Id: GLIInstallProfile.py,v 1.89 2006/04/09 17:34:39 agaffney Exp $
+
+The GLI module contains all classes used in the Gentoo Linux Installer (or GLI).
+The InstallProfile contains all information related to the new system to be
+installed.
+
+PROCEDURE TO ADD NEW VARIABLES:
+ 1. Add a handler to the list. If the variable has children make sure you do it right.
+ Look at the existing structure to get an idea.
+ 2. Create a section for the two or three functions.
+ 3. Create the get_variable_name and set_variable_name functions.
+ Ensure the set function has correct error checking.
+ 4. If a simple value, add to the list in the general serialize() function.
+ If more complex add a serialize_variable_name to the list of special cases.
+ Then add the serialize_variable_name function to the section for the variable.
+"""
+*/
+
+##
+# This class contains all the settings used during the install
+class InstallProfile {
+ /*
+ An object representation of a profile.
+ InstallProfile is an object representation of a parsed installation
+ profile file.
+ */
+
+ ##
+ # Initializes all variables to default values and adds handlers.
+ # Configuration information - profile data
+ # All variables must be declared here with a default value to ensure
+ # the XML will correctly serialize.
+ var $cron_daemon_pkg = "vixie-cron";
+ var $logging_daemon_pkg = "syslog-ng";
+ var $boot_device;
+ var $boot_loader_mbr = True;
+ var $boot_loader_pkg = "grub";
+ var $kernel_modules = array();
+ var $kernel_config_uri = "";
+ var $kernel_build_method = "genkernel";
+ var $bootloader_kernel_args = "";
+ var $kernel_initrd = True;
+ var $kernel_bootsplash = False;
+ var $kernel_source_pkg = "livecd-kernel";
+ var $users = array();
+ var $root_pass_hash = "";
+ var $time_zone = "UTC";
+ var $stage_tarball_uri = "";
+ var $install_stage = 3;
+ var $portage_tree_sync_type = "sync";
+ var $portage_tree_snapshot_uri = "";
+ var $domainname = "localdomain";
+ var $hostname = "localhost";
+ var $http_proxy = "";
+ var $ftp_proxy = "";
+ var $rsync_proxy = "";
+ var $nisdomainname = "";
+ var $partition_tables = array();
+ var $network_mounts = array();
+ var $temp_partition_table = array();
+ var $network_interfaces = array();
+ var $make_conf = array();
+ var $install_rp_pppoe = False;
+ var $filesystem_tools = array();
+ var $install_pcmcia_cs = False;
+ var $dns_servers = array();
+ var $default_gateway = array();
+ var $install_packages = array();
+ var $services = array();
+ var $mta_pkg = "";
+ var $grp_install = False;
+ var $post_install_script_uri = "";
+ var $etc_files = array();
+ var $temp_etc_file = array();
+ var $dynamic_stage3 = False;
+ var $install_distcc = False;
+
+ var $xmldoc = "";
+
+ /* # Parser handler calls. For each XML attribute and children of that attribute, a handler is needed.
+ self._parser = SimpleXMLParser.SimpleXMLParser()
+ self._parser.addHandler('gli-profile/bootloader', self.set_boot_loader_pkg)
+ self._parser.addHandler('gli-profile/boot-device', self.set_boot_device)
+ self._parser.addHandler('gli-profile/bootloader-kernel-args', self.set_bootloader_kernel_args)
+ self._parser.addHandler('gli-profile/bootloader-mbr', self.set_boot_loader_mbr)
+ self._parser.addHandler('gli-profile/cron-daemon', self.set_cron_daemon_pkg)
+ self._parser.addHandler('gli-profile/default-gateway', self.set_default_gateway)
+ self._parser.addHandler('gli-profile/dns-servers', self.set_dns_servers)
+ self._parser.addHandler('gli-profile/domainname', self.set_domainname)
+ self._parser.addHandler('gli-profile/dynamic-stage3', self.set_dynamic_stage3)
+ self._parser.addHandler('gli-profile/etc-files/file', self.add_etc_files_file, call_on_null=True)
+ self._parser.addHandler('gli-profile/etc-files/file/entry', self.add_etc_files_file_entry, call_on_null=True)
+ self._parser.addHandler('gli-profile/ftp-proxy', self.set_ftp_proxy)
+ self._parser.addHandler('gli-profile/grp-install', self.set_grp_install)
+ self._parser.addHandler('gli-profile/hostname', self.set_hostname)
+ self._parser.addHandler('gli-profile/http-proxy', self.set_http_proxy)
+ self._parser.addHandler('gli-profile/install-distcc', self.set_install_distcc)
+ self._parser.addHandler('gli-profile/install-packages', self.set_install_packages)
+ self._parser.addHandler('gli-profile/install-pcmcia-cs', self.set_install_pcmcia_cs)
+ self._parser.addHandler('gli-profile/install-rp-pppoe', self.set_install_rp_pppoe)
+ self._parser.addHandler('gli-profile/install-stage', self.set_install_stage)
+ self._parser.addHandler('gli-profile/kernel-bootsplash', self.set_kernel_bootsplash)
+ self._parser.addHandler('gli-profile/kernel-build-method', self.set_kernel_build_method)
+ self._parser.addHandler('gli-profile/kernel-config', self.set_kernel_config_uri)
+ self._parser.addHandler('gli-profile/kernel-initrd', self.set_kernel_initrd)
+ self._parser.addHandler('gli-profile/kernel-modules/module', self.add_kernel_module)
+ self._parser.addHandler('gli-profile/kernel-source', self.set_kernel_source_pkg)
+ self._parser.addHandler('gli-profile/logging-daemon', self.set_logging_daemon_pkg)
+# self._parser.addHandler('gli-profile/make-conf/variable', self.make_conf_add_var)
+ self._parser.addHandler('gli-profile/mta', self.set_mta_pkg)
+ self._parser.addHandler('gli-profile/network-interfaces/device', self.add_network_interface)
+ self._parser.addHandler('gli-profile/network-mounts/netmount', self.add_netmount, call_on_null=True)
+ self._parser.addHandler('gli-profile/nisdomainname', self.set_nisdomainname)
+ self._parser.addHandler('gli-profile/partitions/device', self.add_partitions_device, call_on_null=True)
+ self._parser.addHandler('gli-profile/partitions/device/partition', self.add_partitions_device_partition, call_on_null=True)
+ self._parser.addHandler('gli-profile/portage-snapshot', self.set_portage_tree_snapshot_uri)
+ self._parser.addHandler('gli-profile/portage-tree-sync', self.set_portage_tree_sync_type)
+ self._parser.addHandler('gli-profile/post-install-script-uri', self.set_post_install_script_uri)
+# self._parser.addHandler('gli-profile/rc-conf/variable', self.rc_conf_add_var)
+ self._parser.addHandler('gli-profile/root-pass-hash', self.set_root_pass_hash)
+ self._parser.addHandler('gli-profile/rsync-proxy', self.set_rsync_proxy)
+ self._parser.addHandler('gli-profile/services', self.set_services)
+ self._parser.addHandler('gli-profile/stage-tarball', self.set_stage_tarball_uri)
+ self._parser.addHandler('gli-profile/time-zone', self.set_time_zone)
+ self._parser.addHandler('gli-profile/users/user', self.add_user)
+
+ ##
+ # Parses the given filename populating the client_configuration.
+ # @param filename Parameter description
+ def parse(self, filename):
+ self._parser.parse(filename)
+
+ ##
+ # This method serializes the configuration data and output a nice XML document.
+ # NOTE: this method currently does not serialize: _partition_tables or _kernel_modules
+ def serialize(self):
+ xmltab = { 'boot-device': self.get_boot_device,
+ 'bootloader': self.get_boot_loader_pkg,
+ 'bootloader-mbr': self.get_boot_loader_mbr,
+ 'bootloader-kernel-args': self.get_bootloader_kernel_args,
+ 'cron-daemon': self.get_cron_daemon_pkg,
+ 'domainname': self.get_domainname,
+ 'dynamic-stage3': self.get_dynamic_stage3,
+ 'ftp-proxy': self.get_ftp_proxy,
+ 'grp-install': self.get_grp_install,
+ 'hostname': self.get_hostname,
+ 'http-proxy': self.get_http_proxy,
+ 'install-distcc': self.get_install_distcc,
+ 'install-pcmcia-cs': self.get_install_pcmcia_cs,
+ 'install-rp-pppoe': self.get_install_rp_pppoe,
+ 'install-stage': self.get_install_stage,
+ 'kernel-bootsplash': self.get_kernel_bootsplash,
+ 'kernel-build-method': self.get_kernel_build_method,
+ 'kernel-config': self.get_kernel_config_uri,
+ 'kernel-initrd': self.get_kernel_initrd,
+ 'kernel-source': self.get_kernel_source_pkg,
+ 'logging-daemon': self.get_logging_daemon_pkg,
+ 'mta': self.get_mta_pkg,
+ 'nisdomainname': self.get_nisdomainname,
+ 'portage-snapshot': self.get_portage_tree_snapshot_uri,
+ 'portage-tree-sync': self.get_portage_tree_sync_type,
+ 'post-install-script-uri': self.get_post_install_script_uri,
+ 'root-pass-hash': self.get_root_pass_hash,
+ 'rsync-proxy': self.get_rsync_proxy,
+ 'stage-tarball': self.get_stage_tarball_uri,
+ 'time-zone': self.get_time_zone,
+ }
+ self.xmldoc = "<?xml version=\"1.0\"?>"
+ self.xmldoc += "<gli-profile>"
+
+ # Normal cases
+ for key in xmltab.keys():
+ self.xmldoc += "<%s>%s</%s>" % (key, xmltab[key](), key)
+
+ # Special cases
+ self.serialize_default_gateway()
+ self.serialize_dns_servers()
+ self.serialize_install_packages()
+ self.serialize_kernel_modules()
+# self.serialize_make_conf()
+ self.serialize_network_interfaces()
+ self.serialize_network_mounts()
+ self.serialize_partition_tables()
+# self.serialize_rc_conf()
+ self.serialize_services()
+ self.serialize_users()
+ self.serialize_etc_files()
+
+ self.xmldoc += "</gli-profile>"
+
+ dom = xml.dom.minidom.parseString(self.xmldoc)
+ return dom.toprettyxml()
+ */
+ ############################################################################
+ ############################################################################
+ #### Boot Device Selection
+
+ ##
+ # boot_device is a string to decide which device to install the bootloader to
+ function set_boot_device($boot_device) {
+ #check data type
+ if (!is_string($boot_device)) {
+ return False;
+ }
+ $this->boot_device = $boot_device;
+ return True;
+ }
+ ##
+ # returns boot_device
+ function get_boot_device() {
+ return $this->boot_device;
+ }
+
+ ############################################################################
+ #### Bootloader Package Selection
+
+ ##
+ # boot_loader_pkg is a string to decide which boot loader to install. (ie. 'grub')
+ function set_boot_loader_pkg($boot_loader_pkg) {
+ # Check data type
+ if (!is_string($boot_loader_pkg)) {
+ return False;
+ }
+ $this->boot_loader_pkg = $boot_loader_pkg;
+ return True;
+ }
+
+ ##
+ # returns boot_loader_pkg
+ function get_boot_loader_pkg() {
+ return $this->boot_loader_pkg;
+ }
+
+ ############################################################################
+ #### Bootloader Kernel Arguments
+
+ ##
+ # FIXME: agaffney, what error checking needs to be done here?
+ # kernel_args are the arguments to pass the kernel at boot from the bootloader.
+ function set_bootloader_kernel_args($bootloader_kernel_args) {
+ if (!is_string($bootloader_kernel_args)) {
+ return False;
+ }
+ $this->bootloader_kernel_args = $bootloader_kernel_args;
+ return True;
+ }
+ ##
+ # Returns kernel arguments
+ function get_bootloader_kernel_args() {
+ return $this->bootloader_kernel_args;
+ }
+ ############################################################################
+ #### Bootloader Installation to MBR
+
+ ##
+ # boot_loader_mbr is a bool. True installs boot loader to MBR.
+ # False installs boot loader to the boot or root partition.
+ function set_boot_loader_mbr($boot_loader_mbr) {
+ # Check data type
+ if (!is_bool($boot_loader_mbr)) {
+ return False;
+ }
+ $this->boot_loader_mbr = $boot_loader_mbr;
+ return True;
+ }
+ ##
+ # returns boot_loader_mbr
+ function get_boot_loader_mbr() {
+ return $this->boot_loader_mbr;
+ }
+}
+/*
+ ############################################################################
+ #### Cron Daemon Package
+
+ ##
+ # cron_daemon_pkg is a string to determine which cron daemon to install and configure (ie. 'vixie-cron')
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param cron_daemon_pkg package name
+ # @param xml_attr Not used here.
+ function set_cron_daemon_pkg(self, xml_path, cron_daemon_pkg, xml_attr):
+ # Check data type
+ if type(cron_daemon_pkg) != str:
+ raise GLIException("CronDaemonPKGError", 'fatal', 'set_cron_daemon_pkg', "Input must be type 'string'!")
+ self._cron_daemon_pkg = cron_daemon_pkg
+
+ ##
+ # Returns the cron daemon pkg name
+ function get_cron_daemon_pkg(self):
+ return self._cron_daemon_pkg
+
+ ############################################################################
+ #### Network Gateway
+
+ ##
+ # Set the default gateway for the post-installed system.
+ # The format of the input is: <default-gateway interface="interface name">ip of gateway</default-gateway>
+ # It saves this information in the following format: (<interface>, <ip of gateway>)
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param gateway gateway ip address
+ # @param xml_attr Parameter description
+ function set_default_gateway(self, xml_path, gateway, xml_attr):
+ if not GLIUtility.is_realstring(gateway):
+ raise GLIException('DefaultGatewayError', 'fatal', 'set_default_gateway', "The gateway must be a non-empty string!")
+ if not 'interface' in xml_attr.keys():
+ raise GLIException('DefaultGatewayError', 'fatal', 'set_default_gateway', 'No interface information specified!')
+
+ interface = str(xml_attr['interface'])
+
+ if not GLIUtility.is_eth_device(interface):
+ raise GLIException('DefaultGatewayError', 'fatal', 'set_default_gateway', "Invalid device!")
+ if not GLIUtility.is_ip(gateway):
+ raise GLIException("DefaultGateway", 'fatal', 'set_default_gateway', "The IP Provided is not valid!")
+ self._default_gateway = (interface, gateway)
+
+ ##
+ # Returns the default gateway
+ function get_default_gateway(self):
+ return self._default_gateway
+
+ ##
+ # Serializes default_gateway
+ function serialize_default_gateway(self):
+ if self.get_default_gateway() != ():
+ gw = self.get_default_gateway()
+ self.xmldoc += "<default-gateway interface=\"%s\">%s</default-gateway>" % (gw[0], gw[1])
+
+
+ ############################################################################
+ #### DNS Servers
+
+ ##
+ # Set the DNS servers for the post-installed system.
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param dns_servers a tuple or space-separated list of dns servers
+ # @param xml_attr Parameter description
+ function set_dns_servers(self, xml_path, dns_servers, xml_attr):
+ if type(dns_servers) == tuple:
+ dns_servers = dns_servers[0:3]
+ elif type(dns_servers) == str:
+ dns_servers = string.split(dns_servers)
+ else:
+ raise GLIException("DnsServersError", 'fatal', 'set_dns_servers', "Invalid input!")
+
+ for server in dns_servers:
+ if not GLIUtility.is_ip(server):
+ raise GLIException("DnsServersError", 'fatal', 'set_dns_servers', server + " must be a valid IP address!")
+
+ self._dns_servers = dns_servers
+
+ ##
+ # This returns a tuple of the form: (<nameserver 1>, <nameserver 2>, <nameserver 3>)
+ function get_dns_servers(self):
+ return self._dns_servers
+
+ ##
+ # Serializes DNS Servers
+ function serialize_dns_servers(self):
+ if self.get_dns_servers() != ():
+ self.xmldoc += "<dns-servers>"
+ self.xmldoc += string.join(self.get_dns_servers(), ' ')
+ self.xmldoc += "</dns-servers>"
+
+############################################################################
+ #### Domainname
+
+ ##
+ # domainname is a string containing the domainname for the new system. (ie. 'mydomain.com'; NOT FQDN)
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param domainname string of the domain name
+ # @param xml_attr not used here
+ function set_domainname(self, xml_path, domainname, xml_attr):
+ # Check type
+ if type(domainname) != str:
+ raise GLIException("DomainnameError", 'fatal', 'set_domainname', "Must be a string!")
+ self._domainname = domainname
+
+ ##
+ # Returns domainname
+ function get_domainname(self):
+ return self._domainname
+
+ ###################################################################
+ ##
+ # Set whether or not to build the stage3 from the LiveCD
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param dynamic_stage3 True/False
+ # @param xml_attr not used here
+ function set_dynamic_stage3(self, xml_path, dynamic_stage3, xml_attr):
+ if type(dynamic_stage3) != bool:
+ if type(dynamic_stage3) == str:
+ self._dynamic_stage3 = GLIUtility.strtobool(dynamic_stage3)
+ else:
+ raise GLIException("DynamicStage3", 'fatal', 'set_dynamic_stage3', "Input must be type 'bool'!")
+ else:
+ self._dynamic_stage3 = dynamic_stage3
+
+ ##
+ # Returns whether or not to build the stage3 from the LiveCD
+ function get_dynamic_stage3(self):
+ return self._dynamic_stage3
+
+ ##
+ # Used internally for XML parsing...adds an entry to a file
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param value uhh...the value
+ # @param attr used for XML parsing
+ function add_etc_files_file_entry(self, xml_path, value, attr):
+ if 'name' in attr.getNames():
+ if not self._temp_etc_file:
+ self._temp_etc_file = {}
+ self._temp_etc_file[attr['name']] = value
+ else:
+ if not self._temp_etc_file:
+ self._temp_etc_file = []
+ self._temp_etc_file.append(value)
+
+ ##
+ # Used internally for XML parsing...adds a file
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param unused this should be obvious
+ # @param attr used for XML parsing
+ function add_etc_files_file(self, xml_path, unused, attr):
+ self._etc_files[attr['name']] = self._temp_etc_file
+ self._temp_etc_file = None
+
+ ##
+ # Returns etc_files structure
+ function get_etc_files(self):
+ return self._etc_files
+
+ ##
+ # Replaces etc_files structure with one passed in
+ # @param etc_files new etc_files structure
+ function set_etc_files(self, etc_files):
+ self._etc_files = etc_files
+
+ ##
+ # Serializes the etc_files structure
+ function serialize_etc_files(self):
+ self.xmldoc += "<etc-files>"
+ for etc_file in self._etc_files:
+ self.xmldoc += "<file name=\"%s\">" % etc_file
+ for entry in self._etc_files[etc_file]:
+ self.xmldoc += "<entry"
+ if isinstance(self._etc_files[etc_file], dict):
+ self.xmldoc += " name=\"%s\">%s" % (entry, self._etc_files[etc_file][entry])
+ else:
+ self.xmldoc += ">%s" % entry
+ self.xmldoc += "</entry>"
+ self.xmldoc += "</file>"
+ self.xmldoc += "</etc-files>"
+
+
+ ############################################################################
+ #### FTP Proxy
+
+ ##
+ # FTP proxy is a uri containing a proxy if needed for ftp traffic. (ie. 'ftp://myhost.mydomain:myport')
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param ftp_proxy ftp proxy address
+ # @param xml_attr not used here
+ function set_ftp_proxy(self, xml_path, ftp_proxy, xml_attr):
+ # Check type
+ if ftp_proxy and not GLIUtility.is_uri(ftp_proxy):
+ raise GLIException("FTPProxyError", 'fatal', 'set_ftp_proxy', "Must be a uri!")
+ self._ftp_proxy = ftp_proxy
+
+ ##
+ # Returns FTP proxy
+ function get_ftp_proxy(self):
+ return self._ftp_proxy
+
+ ############################################################################
+ #### GRP Install
+
+ ##
+ # grp_install is a bool. True installs GRP. False doesn't.
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param grp_install boolean
+ # @param xml_attr Parameter description
+ function set_grp_install(self, xml_path, grp_install, xml_attr):
+ # Check data type
+ if type(grp_install) != bool:
+ if type(grp_install) == str:
+ grp_install = GLIUtility.strtobool(grp_install)
+ else:
+ raise GLIException("GRPInstall", 'fatal', 'set_grp_install', "Input must be type 'bool'!")
+ self._grp_install = grp_install
+
+ ##
+ # returns grp_install
+ function get_grp_install(self):
+ return self._grp_install
+
+ ############################################################################
+ #### Hostname
+
+ ##
+ # Hostname is a string containing the hostname for the new system. (ie. 'myhost'; NOT 'myhost.mydomain.com')
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param hostname string of hostname
+ # @param xml_attr not used here.
+ function set_hostname(self, xml_path, hostname, xml_attr):
+ # Check type
+ if type(hostname) != str:
+ raise GLIException("HostnameError", 'fatal', 'set_hostname', "Must be a string!")
+ self._hostname = hostname
+
+ ##
+ # Returns hostname
+ function get_hostname(self):
+ return self._hostname
+
+ ############################################################################
+ #### HTTP Proxy
+
+ ##
+ # HTTP proxy is a URI containing a proxy if needed for http traffic. (ie. 'http://myhost.mydomain:myport')
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param http_proxy http proxy address
+ # @param xml_attr not used here
+ function set_http_proxy(self, xml_path, http_proxy, xml_attr):
+ # Check type
+ if http_proxy and not GLIUtility.is_uri(http_proxy):
+ raise GLIException("HTTPProxyError", 'fatal', 'set_http_proxy', "Must be a uri!")
+ self._http_proxy = http_proxy
+
+ ##
+ # Returns HTTP proxy
+ function get_http_proxy(self):
+ return self._http_proxy
+
+ ############################################################################
+ #### Install Distcc
+
+ ##
+ # This tells the installer whether or not to install the distcc package
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param install_distcc boolean
+ # @param xml_attr Parameter description
+ function set_install_distcc(self, xml_path, install_distcc, xml_attr):
+ if type(install_distcc) != bool:
+ if type(install_distcc) == str:
+ install_distcc = GLIUtility.strtobool(install_distcc)
+ else:
+ raise GLIException("InstallDistcc", 'fatal', 'set_install_distcc', "Input must be type 'bool'!")
+
+ self._install_distcc = install_distcc
+
+ ##
+ # Returns the boolean _install_distcc
+ function get_install_distcc(self):
+ return self._install_distcc
+
+ ############################################################################
+ #### Install Package List
+ ##
+ # Returns the list of packages to include in the Extra Packages screens.
+ function get_install_package_list(self):
+ install_package_list = {
+ 'Desktop': ("Popular Desktop Applications",
+ {"bittorrent": "tool for distributing files via a distributed network of nodes",
+ "evolution": "A GNOME groupware application, a Microsoft Outlook workalike",
+ "gaim": "GTK Instant Messenger client",
+ "gftp": "Gnome based FTP Client",
+ "gimp": "GNU Image Manipulation Program",
+ "inkscape": "A SVG based generic vector-drawing program",
+ "koffice": "An integrated office suite for KDE, the K Desktop Environment",
+ "mozilla": "The Mozilla Web Browser",
+ "mozilla-firefox": "The Mozilla Firefox Web Browser",
+ "mozilla-thunderbird": "Thunderbird Mail Client",
+ "mplayer": "Media Player for Linux",
+ "openoffice": "OpenOffice.org, a full office productivity suite.",
+ "openoffice-bin": "Same as OpenOffice but a binary package (no compiling!)",
+# Removed because fetch-restriction would cause install to fail
+# "realplayer": "Real Media Player",
+ "rhythmbox": "Music management and playback software for GNOME",
+ "vlc": "VLC media player - Video player and streamer",
+ "xchat": "Graphical IRC Client",
+ "xine-ui": "Xine movie player",
+ "xmms": "X MultiMedia System" }),
+ 'Servers': ("Applications often found on servers.",
+ {"apache": "Apache Web Server",
+ "cups": "The Common Unix Printing System",
+ "exim": "A highly configurable, drop-in replacement for sendmail",
+ "iptables": "Linux kernel (2.4+) firewall, NAT and packet mangling tools",
+ "mod_php": "Apache module for PHP",
+ "mysql": "A fast, multi-threaded, multi-user SQL database server",
+ "postfix": "A fast and secure drop-in replacement for sendmail",
+ "postgresql": "sophisticated Object-Relational DBMS",
+ "proftpd": "ProFTP Server",
+ "samba": "SAMBA client/server programs for UNIX",
+ "sendmail": "Widely-used Mail Transport Agent (MTA)",
+ "traceroute": "Utility to trace the route of IP packets" }),
+ 'X11': ("Window managers and X selection.",
+ {"xorg-x11": "An X11 implementation maintained by the X.Org Foundation",
+ "gnome": "The Gnome Desktop Environment",
+ "kde": "The K Desktop Environment",
+ "blackbox": "A small, fast, full-featured window manager for X",
+ "enlightenment": "Enlightenment Window Manager",
+ "fluxbox": "Fluxbox is an X11 window manager featuring tabs and an iconbar",
+ "xfce4": "XFCE Desktop Environment" }),
+ 'Misc': ("Miscellaneous Applications you may want.",
+ {"emacs": "An incredibly powerful, extensible text editor",
+ "ethereal": "A commercial-quality network protocol analyzer",
+ "gkrellm": "Single process stack of various system monitors",
+ "gvim": "GUI version of the Vim text editor",
+ "keychain": "ssh-agent manager",
+ "logrotate": "Rotates, compresses, and mails system logs",
+ "ntp": "Network Time Protocol suite/programs",
+ "rdesktop": "A Remote Desktop Protocol Client",
+ "slocate": "Secure way to index and quickly search for files on your system",
+ "ufed": "Gentoo Linux USE flags editor",
+ "vim": "Vim, an improved vi-style text editor" }),
+ 'Recommended': ("Applications recommended by the GLI Team.",
+ {"anjuta": "A versatile IDE for GNOME",
+ "chkrootkit": "a tool to locally check for signs of a rootkit",
+ "crack-attack": "Addictive OpenGL-based block game",
+ "gnupg": "The GNU Privacy Guard, a GPL pgp replacement",
+ "net-snmp": "Software for generating and retrieving SNMP data",
+ "netcat": "the network swiss army knife",
+ "nmap": "A utility for network exploration or security auditing",
+ "screen": "full-screen window manager that multiplexes between several processes",
+ "xpdf": "An X Viewer for PDF Files" })
+ }
+ return install_package_list
+
+ ############################################################################
+ #### Install Packages
+
+ ##
+ # Sets up the list of packages to be installed for the new system.
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param install_packages The space-separated list of packages to install.
+ # @param xml_attr Parameter description
+ function set_install_packages(self, xml_path, install_packages, xml_attr):
+ if type(install_packages) == str:
+ install_packages = string.split(install_packages)
+ else:
+ raise GLIException("InstallPackagesError", 'fatal', 'set_install_packages', "Invalid input!")
+
+ for install_package in install_packages:
+ if not GLIUtility.is_realstring(install_package):
+ raise GLIException("InstallPackagesError", 'fatal', 'set_install_packages', install_package + " must be a valid string!")
+ self._install_packages = install_packages
+
+ ##
+ # This returns a list of the packages
+ function get_install_packages(self):
+ return self._install_packages
+
+ ##
+ # Serializes install_packages
+ function serialize_install_packages(self):
+ if self.get_install_packages() != ():
+ self.xmldoc += "<install-packages>"
+ self.xmldoc += string.join(self.get_install_packages(), ' ')
+ self.xmldoc += "</install-packages>"
+
+ ############################################################################
+ #### PCMCIA-CS
+
+ ##
+ # This tells the installer whether or not to install the pcmcia_cs package
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param install_pcmcia boolean
+ # @param xml_attr Parameter description
+ function set_install_pcmcia_cs(self, xml_path, install_pcmcia, xml_attr):
+ if type(install_pcmcia) != bool:
+ if type(install_pcmcia) == str:
+ install_pcmcia = GLIUtility.strtobool(install_pcmcia)
+ else:
+ raise GLIException("InstallPcmciaCS", 'fatal', 'set_install_pcmcia_cs', "Input must be type 'bool'!")
+
+ self._install_pcmcia_cs = install_pcmcia
+
+ ##
+ # Returns the boolean _install_pcmcia_cs
+ function get_install_pcmcia_cs(self):
+ return self._install_pcmcia_cs
+
+ ############################################################################
+ #### RP-PPPoE Installation
+
+ ##
+ # Tell the installer whether or not to install the rp-pppoe package
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param install_rp_pppoe boolean
+ # @param xml_attr Parameter description
+ function set_install_rp_pppoe(self, xml_path, install_rp_pppoe, xml_attr):
+ if type(install_rp_pppoe) != bool:
+ if type(install_rp_pppoe) == str:
+ install_rp_pppoe = GLIUtility.strtobool(install_rp_pppoe)
+ else:
+ raise GLIException("InstallRP_PPPOE", 'fatal', 'set_install_rp_pppoe', "Invalid input!")
+
+ self._install_rp_pppoe = install_rp_pppoe
+
+ ##
+ # Return the boolean value of _install_rp_pppoe
+ function get_install_rp_pppoe(self):
+ return self._install_rp_pppoe
+
+ ############################################################################
+ #### Install Stage
+
+ ##
+ # install_stage is a integer to define which stage install to use. Appropriate stages are 1-3.
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param install_stage install stage number
+ # @param xml_attr not used here.
+ function set_install_stage(self, xml_path, install_stage, xml_attr):
+ # Check type
+ if type(install_stage) != int:
+ if type(install_stage) == str:
+ install_stage = int(install_stage)
+ else:
+ raise GLIException("InstallStageError", 'fatal', 'set_install_stage', "Must be an integer!")
+
+ # Check for stage bounds
+ if 0 < install_stage < 4:
+ self._install_stage = install_stage
+ else:
+ raise GLIException("InstallStageError", 'fatal', 'set_install_stage', "install_stage must be 1-3!")
+
+ ##
+ # Returns install_stage
+ function get_install_stage(self):
+ return self._install_stage
+
+ ############################################################################
+ #### Kernel Bootsplash Option
+
+ ##
+ # kernel_bootsplash is a bool to determine whether or not to install bootsplash into the kernel.
+ # True builds in bootsplash support to the initrd.
+ # WARNING: kernel_source_pkg must contain a kernel with bootsplash support or the bootsplash will not appear.
+ # If you set this to true, it will build an initrd kernel even if you chose false for kernel_initrd!
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param kernel_bootsplash boolean
+ # @param xml_attr not used here.
+ function set_kernel_bootsplash(self, xml_path, kernel_bootsplash, xml_attr):
+ # Check type
+ if type(kernel_bootsplash) != bool:
+ if type(kernel_bootsplash) == str:
+ kernel_bootsplash = GLIUtility.strtobool(kernel_bootsplash)
+ else:
+ raise GLIException("KernelBootsplashError", 'fatal', 'set_kernel_bootsplash', "Must be a bool!")
+
+ self._kernel_bootsplash = kernel_bootsplash
+
+ ##
+ # Returns kernel_bootsplash
+ function get_kernel_bootsplash(self):
+ return self._kernel_bootsplash
+
+ ############################################################################
+ #### Kernel Build Method
+
+ ##
+ # kernel_build_method is a string specifying what build method you wish to use for the kernel.
+ # Can also be a http:// or ftp:// path.
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param kernel_build_method URI of kernel .config file
+ # @param xml_attr not used here.
+ function set_kernel_build_method(self, xml_path, kernel_build_method, xml_attr):
+ # Check type
+ if type(kernel_build_method) != str:
+ raise GLIException("KernelBuildMethodError", 'fatal', 'set_kernel_build_method', "Must be a string!")
+
+ self._kernel_build_method = kernel_build_method
+
+ ##
+ # Returns kernel_build_method
+ function get_kernel_build_method(self):
+ return self._kernel_build_method
+
+ ############################################################################
+ #### Kernel Configuration URI
+
+ ##
+ # kernel_config_uri is a string that is the path to the kernel config file you wish to use.
+ # Can also be a http:// or ftp:// path.
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param kernel_config_uri URI of kernel .config file
+ # @param xml_attr not used here.
+ function set_kernel_config_uri(self, xml_path, kernel_config_uri, xml_attr):
+ # Check type
+ if type(kernel_config_uri) != str:
+ raise GLIException("KernelConfigURIError", 'fatal', 'set_kernel_config_uri', "Must be a string!")
+
+ # Check validity (now done in the FE)
+ #if not (kernel_config_uri):
+ # raise GLIException("KernelConfigURIError", 'fatal', 'set_kernel_config_uri', "Empty Kernel URI!")
+
+ self._kernel_config_uri = kernel_config_uri
+
+ ##
+ # Returns kernel_config_uri
+ function get_kernel_config_uri(self):
+ return self._kernel_config_uri
+
+ ############################################################################
+ #### Kernel Initrd Option
+
+ ##
+ # kernel_initrd is a bool to determine whether or not to build an initrd kernel. False builds a non-initrd kernel.
+ # (overwritten by kernel_bootsplash; needs genkernel non-initrd support not yet present)
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param kernel_initrd boolean
+ # @param xml_attr not used here
+ function set_kernel_initrd(self, xml_path, kernel_initrd, xml_attr):
+ # Check type
+ if type(kernel_initrd) != bool:
+ if type(kernel_initrd) == str:
+ kernel_initrd = GLIUtility.strtobool(kernel_initrd)
+ else:
+ raise GLIException("KernelInitRDError", 'fatal', 'set_kernel_initrd', "Must be a bool!")
+
+ self._kernel_initrd = kernel_initrd
+
+ ##
+ # Returns kernel_initrd
+ function get_kernel_initrd(self):
+ return self._kernel_initrd
+
+ ############################################################################
+ #### Kernel Modules
+
+ ##
+ # Add a kernel module to the list of kernel modules
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param kernel_module string of a module name
+ # @param xml_attr not used here
+ function add_kernel_module(self, xml_path, kernel_module, xml_attr):
+ if type(kernel_module) != str:
+ raise GLIException("KernelModuleError", 'fatal', 'add_kernel_module', "The kernel module must be a string!")
+ self._kernel_modules.append(kernel_module)
+
+ ##
+ # "kernel_modules is a tuple of strings containing names of modules to automatically load at boot time. (ie. '( 'ide-scsi', )')"
+ # @param kernel_modules Parameter description
+ function set_kernel_modules(self, kernel_modules):
+ # Check type
+ if type(kernel_modules) != tuple:
+ raise GLIException("KernelModulesError", 'fatal', 'set_kernel_modules', "Must be a tuple!")
+
+ self._kernel_modules = []
+
+ # Check tuple data type
+ for module in kernel_modules:
+ self._kernel_modules.append(module)
+
+ ##
+ # Returns kernel_modules
+ function get_kernel_modules(self):
+ return self._kernel_modules
+
+ ##
+ # Serializes kernel modules
+ function serialize_kernel_modules(self):
+ if self.get_kernel_modules() != []:
+ kernel_modules = self.get_kernel_modules()
+ self.xmldoc += "<kernel-modules>";
+ for module in kernel_modules:
+ self.xmldoc += "<module>%s</module>" % module
+ self.xmldoc += "</kernel-modules>";
+
+ ############################################################################
+ #### Kernel Sources
+
+ ##
+ # kernel_source_pkg is a string to define which kernel source to use. (ie. 'gentoo-sources')
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param kernel_source_pkg package name of the kernel sources to be emerged
+ # @param xml_attr not used here.
+ function set_kernel_source_pkg(self, xml_path, kernel_source_pkg, xml_attr):
+ # Check type
+ if type(kernel_source_pkg) != str:
+ raise GLIException("KernelSourcePKGError", 'fatal', 'set_kernel_source_pkg', "Must be a string!")
+ self._kernel_source_pkg = kernel_source_pkg
+
+ ##
+ # Returns kernel_source_pkg
+ function get_kernel_source_pkg(self):
+ return self._kernel_source_pkg
+
+ ############################################################################
+ #### Logging Daemon Package
+
+ ##
+ # logging_daemon_pkg is a string to determine which logging daemon to install and configure (ie. 'sysklogd')
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param logging_daemon_pkg package name of logging daemon to be emerged
+ # @param xml_attr Parameter description
+ function set_logging_daemon_pkg(self, xml_path, logging_daemon_pkg, xml_attr):
+ # Check data type
+ if type(logging_daemon_pkg) != str:
+ raise GLIException("LoggingDaemonPKGError", 'fatal', 'set_logging_daemon_pkg', "Input must be type 'string'!")
+ self._logging_daemon_pkg = logging_daemon_pkg
+
+ ##
+ # Returns logging daemon pkg name
+ function get_logging_daemon_pkg(self):
+ return self._logging_daemon_pkg
+
+ ############################################################################
+ #### /etc/make.conf Configuration
+
+ ##
+ # Adds a variable to the new system make.conf
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param data a string that is the value of the variable name.
+ # @param attr an xml attribute that contains the name of the variable
+ # OR attr is a variable name, like 'USE'. This makes it easier for front-end designers.
+ function make_conf_add_var(self, xml_path, data, attr):
+ if 'name' not in attr.keys():
+ raise GLIException("MakeConfError", 'fatal', 'make_conf_add_var', "Every value needs to have a variable name!")
+
+ varName = attr['name']
+ if not "make.conf" in self._etc_files:
+ self._etc_files['make.conf'] = {}
+ self._make_conf[str(varName)] = str(data)
+
+ ##
+ # make_conf is a dictionary that will be set to _make_conf
+ # There is no checking that needs to be done, so please sure sure that the make_conf dictionary
+ # that is passed in is valid.
+ # @param make_conf a dictionary that will be set to _make_conf
+ function set_make_conf(self, make_conf):
+ self._etc_files['make.conf'] = make_conf
+
+ ##
+ # Return a dictionary of the make.conf
+ function get_make_conf(self):
+ if "make.conf" in self._etc_files:
+ return self._etc_files['make.conf']
+ else:
+ return {}
+
+ ##
+ # Serializes make.conf (no longer used)
+ function serialize_make_conf(self):
+ if self.get_make_conf() != {}:
+ self.xmldoc += "<make-conf>"
+
+ # keys should always be in the same order!
+ make_conf = self.get_make_conf()
+ make_conf_keys = make_conf.keys()
+ make_conf_keys.sort()
+
+ for var in make_conf_keys:
+ self.xmldoc += "<variable name=\"%s\">%s</variable>" % (var, make_conf[var])
+
+ self.xmldoc += "</make-conf>"
+
+ ############################################################################
+ #### MTA Selection
+
+ ##
+ # Sets the intended MTA package
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param mta package name of mta
+ # @param xml_attr Parameter description
+ function set_mta_pkg(self, xml_path, mta_pkg, xml_attr):
+ if type(mta_pkg) != str:
+ raise GLIException("MTAError", 'fatal', 'set_mta_pkg', "The MTA must be a string!")
+ self._mta_pkg = mta_pkg
+
+ ##
+ # returns the MTA
+ function get_mta_pkg(self):
+ return self._mta_pkg
+
+ ############################################################################
+ #### Network Interface Selection
+
+ ##
+ # This adds an ethernet device to the _network_interfaces dictionary.
+ # The format of this dictionary is:
+ # { <eth_device> : (options tuple), ... }
+ #
+ # eth_device can be a valid ethernet device eth0, eth1, wlan*... OR
+ # it can be a valid MAC address.
+ #
+ # The format of the options tuple is for a static IP:
+ # ( <ip address>, <broadcast>, <netmask> )
+ #
+ # For DHCP, the format of the options tuple is:
+ # ( 'dhcp', <dhcp options>, None )
+ #
+ # We keep the None as a placeholder, to not break anything that uses this
+ # in other parts of the installer.
+ #
+ # Aliases are no longer needed in the tuple because they can be treated like
+ # an individual interface. GLIUtility.is_eth_device will recognize
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param device the type and name of the device
+ # @param attr should be dhcp or a tuple of the ip addresses.
+ function add_network_interface(self, xml_path, device, attr):
+ options = None
+ ip = broadcast = netmask = dhcp_options = None
+ dhcp = True
+
+ if type(device) != str:
+ raise GLIException("NetworkInterfacesError", 'fatal', 'add_network_interface', "Invalid or unimplimented device type (" + device + ")!")
+
+ if not GLIUtility.is_eth_device(device):
+ device = GLIUtility.format_mac(device)
+ if not GLIUtility.is_mac(device):
+ raise GLIException("NetworkInterfacesError", 'fatal', 'add_network_interface', "Invalid or unimplimented device type (" + device + ")!")
+
+ if type(attr) == tuple:
+ ip = attr[0]
+ dhcp_options = broadcast = attr[1]
+ netmask = attr[2]
+ if ip != 'dhcp':
+ dhcp = False
+ else:
+ for attrName in attr.keys():
+ if attrName == 'ip':
+ ip = str(attr[attrName])
+ elif attrName == 'broadcast':
+ broadcast = str(attr[attrName])
+ elif attrName == 'netmask':
+ netmask = str(attr[attrName])
+ elif attrName == 'options':
+ dhcp_options = str(attr[attrName])
+
+ if ip != 'dhcp' and ip != None:
+ dhcp = False
+
+ if not dhcp:
+ if not GLIUtility.is_ip(ip):
+ raise GLIException("NetworkInterfacesError", 'fatal', 'add_network_interface', "The ip address you specified for " + device + " is not valid!")
+ if not GLIUtility.is_ip(broadcast):
+ raise GLIException("NetworkInterfacesError", 'fatal', 'add_network_interface', "The broadcast address you specified for " + device + " is not valid!")
+ if not GLIUtility.is_ip(netmask):
+ raise GLIException("NetworkInterfacesError", 'fatal', 'add_network_interface', "The netmask address you specified for " + device + " is not valid!")
+ options = (ip, broadcast, netmask)
+ else:
+ options = ('dhcp', dhcp_options, None)
+
+ self._network_interfaces[device] = options
+
+ ##
+ # This method sets the network interfaces diction to network_interfaces.
+ # This method uses the function add_network_interfaces to do all of the real work.
+ # @param network_interfaces a dict with all the networking info. see add_ for specification.
+ function set_network_interfaces(self, network_interfaces):
+ # Check type
+ if type(network_interfaces) != dict:
+ raise GLIException("NetworkInterfacesError", 'fatal', 'set_network_interfaces', "Must be a dictionary!")
+
+ self._network_interfaces = {}
+ for device in network_interfaces:
+ self.add_network_interface(None, device, network_interfaces[device])
+
+ ##
+ # Returns network_interfaces
+ function get_network_interfaces(self):
+ return self._network_interfaces
+
+ ##
+ # Serialize Network Interfaces
+ function serialize_network_interfaces(self):
+ if self.get_network_interfaces() != {}:
+ self.xmldoc += "<network-interfaces>"
+ interfaces = self.get_network_interfaces()
+ for iface in interfaces:
+ if interfaces[iface][0] == 'dhcp':
+ attrs = "ip=\"dhcp\""
+ if interfaces[iface][1] != None:
+ dhcp_options = "options=\"%s\"" % interfaces[iface][1]
+ attrs = attrs + " " + dhcp_options
+ self.xmldoc += "<device %s>%s</device>" % (attrs, iface)
+ else:
+ self.xmldoc += "<device ip=\"%s\" broadcast=\"%s\" netmask=\"%s\">%s</device>" % (interfaces[iface][0], interfaces[iface][1], interfaces[iface][2], iface)
+ self.xmldoc += "</network-interfaces>"
+
+ ############################################################################
+ #### Network Mounts
+
+ ##
+ # FIXME: agaffney: Brief description of function
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param unused Parameter description
+ # @param attr Parameter description
+ function add_netmount(self, xml_path, unused, attr):
+ netmount_entry = {'export': '', 'host': '', 'mountopts': '', 'mountpoint': '', 'type': ''}
+ if type(attr) == tuple:
+ netmount_entry['export'] = attr[0]
+ netmount_entry['host'] = attr[1]
+ netmount_entry['mountopts'] = attr[2]
+ netmount_entry['mountpoint'] = attr[3]
+ netmount_entry['type'] = attr[4]
+ else:
+ if "export" in attr.getNames():
+ for attrName in attr.getNames():
+ netmount_entry[attrName] = str(attr.getValue(attrName))
+ self._network_mounts.append(netmount_entry)
+
+ ##
+ # Sets Network Mounts given a netmounts found probably in the config file. Not sure if used.
+ # @param netmounts Parameter description
+ function set_network_mounts(self, netmounts):
+ self._network_mounts = netmounts
+
+ ##
+ # Returns the network mounts.
+ function get_network_mounts(self):
+ return self._network_mounts
+
+ ##
+ # Serializes network mounts
+ function serialize_network_mounts(self):
+ if self.get_network_mounts() != {}:
+ netmounts = self.get_network_mounts()
+ self.xmldoc += "<network-mounts>"
+ for mount in netmounts:
+ self.xmldoc += "<netmount host=\"%s\" export=\"%s\" type=\"%s\" mountpoint=\"%s\" mountopts=\"%s\" />" % (mount['host'], mount['export'], mount['type'], mount['mountpoint'], mount['mountopts'])
+ self.xmldoc += "</network-mounts>"
+
+ ############################################################################
+ #### NIS Domain Name
+
+ ##
+ # nisdomainname is a string containing the NIS domainname for the new system.
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param nisdomainname the name. is a string.
+ # @param xml_attr not used here
+ function set_nisdomainname(self, xml_path, nisdomainname, xml_attr):
+ # Check type
+ if type(nisdomainname) != str:
+ raise GLIException("NISDomainnameError", 'fatal', 'set_nisdomainname', "Must be a string!")
+
+ self._nisdomainname = nisdomainname
+
+ ##
+ # Returns nisdomainname
+ function get_nisdomainname(self):
+ return self._nisdomainname
+
+ ############################################################################
+ #### Partitioning
+
+ ##
+ # FIXME: agaffney
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param unused Parameter description
+ # @param attr Parameter description
+ function add_partitions_device(self, xml_path, unused, attr):
+ devnode = None
+ if type(attr) == tuple:
+ devnode = attr[0]
+ disklabel = attr[1]
+ else:
+ if "devnode" in attr.getNames():
+ devnode = str(attr.getValue("devnode"))
+ if "disklabel" in attr.getNames():
+ disklabel = str(attr.getValue("disklabel"))
+ else:
+ disklabel = ""
+ self._partition_current_device = devnode
+ self._partition_tables[devnode] = GLIStorageDevice.Device(devnode)
+ self._partition_tables[devnode].set_disklabel(disklabel)
+ self._partition_tables[devnode].set_partitions_from_install_profile_structure(self._temp_partition_table)
+ self._temp_partition_table = []
+
+ ##
+ # FIXME: agaffney
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param unused Parameter description
+ # @param attr Parameter description
+ function add_partitions_device_partition(self, xml_path, unused, attr):
+ part_entry = {'end': 0, 'format': None, 'mb': 0, 'minor': 0, 'mountopts': '', 'mountpoint': '', 'origminor': '', 'start': 0, 'type': ''}
+# if type(attr) == tuple:
+# part_entry['end'] = attr[0]
+# part_entry['format'] = attr[1]
+# part_entry['mb'] = attr[2]
+# part_entry['minor'] = attr[3]
+# part_entry['mountopts'] = attr[4]
+# part_entry['mountpoint'] = attr[5]
+# part_entry['origminor'] = attr[6]
+# part_entry['start'] = attr[7]
+# part_entry['type'] = attr[8]
+# else:
+ if "minor" in attr.getNames():
+ for attrName in attr.getNames():
+ part_entry[attrName] = str(attr.getValue(attrName))
+ if type(part_entry['format']) == str: part_entry['format'] = GLIUtility.strtobool(part_entry['format'])
+ if type(part_entry['resized']) == str: part_entry['resized'] = GLIUtility.strtobool(part_entry['resized'])
+# if GLIUtility.is_numeric(part_entry['end']): part_entry['end'] = long(part_entry['end'])
+# if GLIUtility.is_numeric(part_entry['start']): part_entry['start'] = long(part_entry['start'])
+ if GLIUtility.is_numeric(part_entry['mb']): part_entry['mb'] = long(part_entry['mb'])
+ if GLIUtility.is_numeric(part_entry['minor']):
+# if part_entry['type'] == "free":
+ part_entry['minor'] = float(part_entry['minor'])
+ if int(part_entry['minor']) == part_entry['minor']:
+ part_entry['minor'] = int(part_entry['minor'])
+ if GLIUtility.is_numeric(part_entry['origminor']): part_entry['origminor'] = int(part_entry['origminor'])
+ self._temp_partition_table.append(part_entry)
+
+ ############################################################################
+ #### Partition Tables
+
+ ##
+ # Sets the partition Tables
+ # @param partition_tables multilevel dictionary described below.
+ function set_partition_tables(self, partition_tables):
+ """
+ Sets the partition tables. A partition is a multi level dictionary in the following format:
+ { <device (local)>: <partition table>, <device (nfs)>: <mount point> }
+
+ <device (local)> is a string containing the path to the local file. (ie. '/dev/hda')
+ <device (nfs)> is a string containing the ip address of the nfs mount. (ie. '192.168.1.2')
+
+ <partition table> is a dictionary in the following format:
+ { <minor>: { 'mb': <size in mb>, 'type': <type>, 'mountpoint': <mount point>, 'start': <start cylinder>,
+ 'end': <end cylinder>, 'mountopts': <mount options>, 'format': <format> } }
+
+ ie. partition_tables['/dev/hda'][1] would return { 'mb': 0, 'type': 'ext3', 'mountpoint': '/boot', 'start': 12345,
+ 'end': 34567, 'mountopts': 'auto', format: 'False' }
+
+ Types are as follows:
+ string: <device>, <mount point>, <mount options>, <type>
+ integer: <minor>, <size in mb>, <start cylinder>, <end cylinder>
+ boolean: <format>
+
+ Current <type> options include:
+ ext2, ext3, reiserfs, xfs, jfs, linux-swap, extended, others?
+
+ There will be a method in the partitioning code to make sure that the current parition_tables can actually be implemented.
+ Should we call that function to test the culpability of our potential partitioning scheme?
+ Should we create a method in the Controller to take raw variables and put them in the proper structure?
+ Are all filesystems supported by all arches?
+ """
+
+ # All the sanity checks are being commented out until I can fix them for the GLIStorageDevice stuff
+ """
+ if type(partition_tables) != dict:
+ raise GLIException("PartitionTableError", 'fatal', 'set_partition_tables', "Invalid data type! partition_tables is a dict...")
+
+ for device in partition_tables:
+
+ # If the device is a valid local device...
+ if GLIUtility.is_device(device):
+
+ # We should check to make sure device is in /proc/partitions
+ # If it is in /proc/partitions, it is a partitionable device
+
+ # ... then loop through each minor to check data
+ for minor in partition_tables[device]:
+
+ # Make sure that the <minor> is an integer or can be converted to one
+ try:
+ int(minor)
+ except:
+ raise GLIException("ParitionTableError", 'fatal', 'set_partition_tables', "The minor you specified (" + minor + ") is not an integer!")
+
+ # Make sure that a minor number is valid
+ if minor < 1:
+ raise GLIException("ParitionTableError", 'fatal', 'set_partition_tables', "The minor you specified (" + minor + ") is not a valid minor!")
+
+ # Make sure that <size>, <type> and <mount point> are all set
+ #if len(partition_tables[device][minor]) != 3:
+ # raise GLIException("ParitionTableError", 'fatal', 'set_partition_tables', "The number of attributes for minor " + minor + " is incorrect!")
+ #
+ # Make sure that the <size> is an integer or can be converted to one
+ #try:
+ # int(partition_tables[device][minor][0])
+ #except:
+ # raise GLIException("ParitionTableError", 'fatal', 'set_partition_tables', "The size you specified (" + partition_tables[device][minor][0] + ") is not an integer!")
+
+ # Else, if the device is a valid remote device (hostname or ip)
+ elif GLIUtility.is_ip(device) or GLIUtility.is_hostname(device):
+
+ pass
+ # Make sure that only the mount point is set
+ # if type(partition_tables[device]) != str:
+ # raise GLIException("ParitionTableError", 'fatal', 'set_partition_tables', "Invalid mount point for nfs mount (device: " + device + ")!")
+
+ # If the device is not a local or remote device, then it is invalid
+ else:
+ raise GLIException("PartitionTableError", 'fatal', 'set_partition_tables', "The device you specified (" + device + ") is not valid!")
+ """
+
+ # If all the tests clear, then set the variable
+ self._partition_tables = partition_tables
+
+ ##
+ # Returns partition_tables
+ function get_partition_tables(self):
+ return self._partition_tables
+
+ ##
+ # Serializes partition tables
+ function serialize_partition_tables(self):
+ if self.get_partition_tables() != {}:
+ partitions = self.get_partition_tables()
+ self.xmldoc += "<partitions>";
+ for device in partitions.keys():
+ self.xmldoc += "<device devnode=\"%s\" disklabel=\"%s\">" % (device, partitions[device].get_disklabel())
+ ips = partitions[device].get_install_profile_structure()
+ for part in ips:
+# part = ips[minor]
+ self.xmldoc += "<partition minor=\"%s\" origminor=\"%s\" mb=\"%s\" type=\"%s\" mountpoint=\"%s\" mountopts=\"%s\" format=\"%s\" mkfsopts=\"%s\" resized=\"%s\" />" % (str(part['minor']), str(part['origminor']), str(part['mb']), str(part['type']), str(part['mountpoint']), str(part['mountopts']), str(part['format']), str(part['mkfsopts']), str(part['resized']))
+ self.xmldoc += "</device>"
+ self.xmldoc += "</partitions>"
+
+ ############################################################################
+ #### Portage Snapshot URI
+
+ ##
+ # portage_tree_snapshot_uri is a string defining the path to a portage tree
+ # snapshot. (ie. 'file:///mnt/cdrom/snapshots/portage-*.tar.bz2')
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param portage_tree_snapshot_uri URI of the portage tree shapshot location
+ # @param xml_attr not used here
+ function set_portage_tree_snapshot_uri(self, xml_path, portage_tree_snapshot_uri, xml_attr):
+ # Check type
+ if type(portage_tree_snapshot_uri) != str:
+ raise GLIException("PortageTreeSnapshotURIError", 'fatal', 'set_portage_tree_snapshot_uri', "Must be a string!")
+
+ self._portage_tree_snapshot_uri = portage_tree_snapshot_uri
+
+ ##
+ # Returns portage_tree_snapshot_uri
+ function get_portage_tree_snapshot_uri(self):
+ return self._portage_tree_snapshot_uri
+
+ ############################################################################
+ #### Portage Tree Sync Type
+
+ ##
+ # Sets the sync type to be used by portage
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param portage_tree_sync string with sync type
+ # @param xml_attr not used here
+ function set_portage_tree_sync_type(self, xml_path, portage_tree_sync, xml_attr):
+ # Check type
+ if type(portage_tree_sync) != str:
+ raise GLIException("PortageTreeSyncError", 'fatal', 'set_portage_tree_sync_type', "Must be a string!")
+
+ if string.lower(portage_tree_sync) not in ('sync', 'webrsync', 'custom', 'snapshot', 'none'):
+ raise GLIException("PortageTreeSyncError", 'fatal', 'set_portage_tree_sync_type', "Invalid Input!")
+
+ self._portage_tree_sync_type = string.lower(portage_tree_sync)
+
+ ##
+ # Returns portage_tree_sync
+ function get_portage_tree_sync_type(self):
+ return self._portage_tree_sync_type
+
+ ############################################################################
+ #### Post-Install Script URI
+
+ ##
+ # Sets the URI for the post install script
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param post_install_script_uri the URI
+ # @param xml_attr Parameter description
+ function set_post_install_script_uri(self, xml_path, post_install_script_uri, xml_attr):
+ self._post_install_script_uri = post_install_script_uri
+
+ ##
+ # Returns the URI for the post install script
+ function get_post_install_script_uri(self):
+ return self._post_install_script_uri
+
+ ############################################################################
+ #### /etc/rc.conf Configuration
+
+ ##
+ # Adds a variable set for the new system rc.conf
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param data a string that is the value of the variable name.
+ # @param attr an xml attribute that contains the name of the variable
+ function rc_conf_add_var(self, xml_path, data, attr):
+ if 'name' not in attr.keys():
+ raise GLIException("RCConfError", 'fatal', 'rc_conf_add_var', "Every value needs to have a variable name!")
+
+ varName = attr['name']
+ if not "rc.conf" in self._etc_files:
+ self._etc_files['rc.conf'] = {}
+ self._etc_files[str(varName)] = str(data)
+
+ ##
+ # rc_conf is a dictionary that will be set to _rc_conf
+ # There is no checking that needs to be done, so please sure sure that the rc_conf dictionary
+ # that is passed in is valid.Brief description of function
+ # @param rc_conf dictionary in the format specified above.
+ function set_rc_conf(self, rc_conf):
+ self._etc_files['rc.conf'] = rc_conf
+
+ ##
+ # Return a dictionary of the make.conf
+ function get_rc_conf(self):
+ if "rc.conf" in self._etc_files:
+ return self._etc_files['rc.conf']
+ else:
+ return {}
+
+ ##
+ # Serializes rc.conf (no longer used)
+ function serialize_rc_conf(self):
+ if self.get_rc_conf() != {}:
+ self.xmldoc += "<rc-conf>"
+
+ rc_conf = self.get_rc_conf()
+ for var in rc_conf:
+ self.xmldoc += "<variable name=\"%s\">%s</variable>" % (var, rc_conf[var])
+
+ self.xmldoc += "</rc-conf>"
+
+ ############################################################################
+ #### Root Password Hash
+
+ ##
+ # root_pass_hash is a string containing an md5 password hash to be assinged as the password for the root user.
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param root_pass_hash Parameter description
+ # @param xml_attr Parameter description
+ function set_root_pass_hash(self, xml_path, root_pass_hash, xml_attr):
+ # Check type
+ if type(root_pass_hash) != str:
+ raise GLIException("RootPassHashError", 'fatal', 'set_root_pass_hash', "Must be a string!")
+ self._root_pass_hash = root_pass_hash
+
+ ##
+ # Returns root_pass_hash
+ function get_root_pass_hash(self):
+ return self._root_pass_hash
+
+ ############################################################################
+ #### RSYNC Proxy
+
+ ##
+ # RSYNC proxy is a uri containing a proxy if needed for rsync traffic. (ie. 'rsync://myhost.mydomain:myport')
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param rsync_proxy the proxy address
+ # @param xml_attr not used here
+ function set_rsync_proxy(self, xml_path, rsync_proxy, xml_attr):
+ # Check type
+ if rsync_proxy and not GLIUtility.is_uri(rsync_proxy):
+ raise GLIException("RSYNCProxyError", 'fatal', 'set_rsync_proxy', "Must be a uri!")
+ self._rsync_proxy = rsync_proxy
+
+ ##
+ # Returns RSYNC proxy
+ function get_rsync_proxy(self):
+ return self._rsync_proxy
+
+ ############################################################################
+ #### Services
+
+ ##
+ # Set the services to be started on bootup. Services should be
+ # seperated by ','. WARNING: This used to be ' ' instead!
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param services comma-separated list of services
+ # @param xml_attr Parameter description
+ function set_services(self, xml_path, services, xml_attr):
+ if type(services) == str:
+ services = services.split(',')
+ else:
+ raise GLIException("ServicesError", 'fatal', 'set_services', "Invalid input!")
+
+ for service in services:
+ if not GLIUtility.is_realstring(service):
+ raise GLIException("ServicesError", 'fatal', 'set_services', service + " must be a valid string!")
+ self._services = services
+
+ ##
+ # This returns a list of the packages:
+ function get_services(self):
+ return self._services
+
+ ##
+ # Serializes services
+ function serialize_services(self):
+ if self.get_services() != ():
+ self.xmldoc += "<services>"
+ self.xmldoc += string.join(self.get_services(), ',')
+ self.xmldoc += "</services>"
+
+ ############################################################################
+ #### Stage Tarball URI
+
+ ##
+ # stage_tarball_uri is a string that is the full path to the tarball you
+ # wish to use. (ie. 'file:///path/to/mytarball.tar.bz2')
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param stage_tarball_uri string of URI for stage tarball location.
+ # @param xml_attr not used here.
+ function set_stage_tarball_uri(self, xml_path, stage_tarball_uri, xml_attr):
+ # Check type
+ if type(stage_tarball_uri) != str:
+ raise GLIException("StageTarballURIError", 'fatal', 'set_stage_tarball_uri', "Must be a string!")
+
+ # Check validity (now done in the FE)
+ #if not stage_tarball_uri:
+ # raise GLIException("CustomStage3TarballURIError", 'fatal', 'set_stage_tarball_uri', "Empty URI!")
+
+ self._stage_tarball_uri = stage_tarball_uri
+
+ ##
+ # Returns stage_tarball_uri
+ function get_stage_tarball_uri(self):
+ return self._stage_tarball_uri
+
+ ############################################################################
+ #### Timezone
+
+ ##
+ # time_zone is a string defining the time zone to use.
+ # Time zones are found in /usr/share/zoneinfo/. Syntax is 'UTC' or 'US/Eastern'.
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param time_zone string of the intended timezone
+ # @param xml_attr not used here.
+ function set_time_zone(self, xml_path, time_zone, xml_attr):
+ # Check type
+ if type(time_zone) != str:
+ raise GLIException("TimeZoneError", 'fatal', 'set_time_zone', "Must be a string!")
+ self._time_zone = time_zone
+
+ ##
+ # Returns time_zone
+ function get_time_zone(self):
+ return self._time_zone
+
+ ############################################################################
+ #### Users
+
+ ##
+ # Adds a user to the list of users
+ # @param xml_path Used internally by the XML parser. Should be None when calling directly
+ # @param username name of user to be added
+ # @param attr=None parameters for the user.
+ function add_user(self, xml_path, username, attr=None):
+ """
+ This will take a username (that is a string) and a set of attributes and it will verify everything is valid
+ and convert it into a 7-tuple set. Then it adds this tuple into the users list.
+ username and hash are manditory. All other attributes are optional. Or this method will
+ take a 7-tuple set, verify it's correctness and then append it to the _users list.
+ All items are strings except <uid>, which is an integer, and groups, which is a tuple.
+
+ The finished tuples look like this:
+ ( <user name>, <password hash>, (<tuple of groups>), <shell>, <home directory>, <user id>, <user comment> )
+
+ """
+ hash = ''
+ shell = None
+ groups = None
+ shell = None
+ homedir = None
+ uid = None
+ comment = None
+
+ if type(username) == tuple:
+ if len(username) != 7:
+ raise GLIException("UserError", 'fatal', 'add_user', "Wrong format for user tuple!")
+
+ username_tmp = username[0]
+ hash = username[1]
+ groups = username[2]
+ shell = username[3]
+ homedir = username[4]
+ uid = username[5]
+ comment = username[6]
+ username = username_tmp
+
+ if type(groups) != tuple:
+ if groups != None:
+ groups = tuple(groups.split(','))
+ else:
+ for attrName in attr.keys():
+ if attrName == 'groups':
+ groups = tuple(str(attr[attrName]).split(','))
+ elif attrName == 'shell':
+ shell = str(attr[attrName])
+ elif attrName == 'hash':
+ hash = str(attr[attrName])
+ elif attrName == 'homedir':
+ homedir = str(attr[attrName])
+ elif attrName == 'uid':
+ if attr[attrName]:
+ uid = int(attr[attrName])
+ elif attrName == 'comment':
+ comment = str(attr[attrName])
+
+ allowable_nonalphnum_characters = '_-'
+
+ if not GLIUtility.is_realstring(username):
+ raise GLIException("UserError", 'fatal', 'add_user', "username must be a non-empty string")
+
+ if username[0] not in (string.lowercase + string.uppercase):
+ raise GLIException("UsersError", 'fatal', 'add_user', "A username must start with a letter!")
+
+ for x in username:
+ if x not in (string.lowercase + string.uppercase + string.digits + allowable_nonalphnum_characters):
+ raise GLIException("UsersError", 'fatal', 'add_user', "A username must contain only letters, numbers, or these symbols: " + allowable_nonalphnum_characters)
+
+ for user in self._users:
+ if username == user[0]:
+ raise GLIException("UserError", 'fatal', 'add_user', "This username already exists!")
+
+ if (hash == None) or (hash == ''):
+ raise GLIException("UserError", 'fatal', 'add_user', "A password hash must be given for every user!")
+
+ self._users.append((username,hash,groups,shell,homedir,uid,comment))
+
+ ##
+ # Remove "username" from the _users list.
+ # @param username name of user to be removed
+ function remove_user(self, username):
+ for user in self._users:
+ if username == user[0]:
+ self._users.remove(user)
+ break
+
+ ##
+ # users is a tuple(user) of tuple's. This sets _users to this set of tuples.
+ # @param users a tuple(user) of tuple's.
+ function set_users(self, users):
+ self._users = []
+ if users != None:
+ for user in users:
+ self._users.append(user)
+
+ ##
+ # Returns users
+ function get_users(self):
+ return self._users
+
+ ##
+ # Serializes users
+ function serialize_users(self):
+ if self.get_users() != []:
+ self.xmldoc += "<users>"
+ users = self.get_users()
+ for user in users:
+ attrstr = ""
+ username = user[0]
+
+ if user[1] != None:
+ attrstr += "hash=\"%s\" " % user[1]
+ if user[2] != None:
+ attrstr += "groups=\"%s\" " % string.join(user[2],',')
+ if user[3] != None:
+ attrstr += "shell=\"%s\" " % user[3]
+ if user[4] != None:
+ attrstr += "homedir=\"%s\" " % user[4]
+ if user[5] != None:
+ attrstr += "uid=\"%s\" " % user[5]
+ if user[6] != None:
+ attrstr += "comment=\"%s\" " % user[6]
+
+ self.xmldoc += "<user %s>%s</user>" % (string.strip(attrstr), username)
+ self.xmldoc += "</users>"
+*/
+?>