aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam McLoughlin <hexxeh@hexxeh.net>2011-08-02 18:21:43 +0100
committerLiam McLoughlin <hexxeh@hexxeh.net>2011-08-02 18:21:43 +0100
commitc626a0b84da7ec05c04543c12594869988b4e886 (patch)
tree80480960978057d0d2795ca96c9cc0c2abd981d3
parentKeyboard layout support for build tool, Stage3/Portage/BINHOST override from ... (diff)
downloadgentoaster-c626a0b84da7ec05c04543c12594869988b4e886.tar.gz
gentoaster-c626a0b84da7ec05c04543c12594869988b4e886.tar.bz2
gentoaster-c626a0b84da7ec05c04543c12594869988b4e886.zip
Fix a simultaneous builds bug where failed builds were counted as still being in progress, add keyboard layout support to WebUI.
-rw-r--r--web/config.php3
-rw-r--r--web/index.php20
-rw-r--r--web/process.php2
3 files changed, 21 insertions, 4 deletions
diff --git a/web/config.php b/web/config.php
index 210d1db..39f505f 100644
--- a/web/config.php
+++ b/web/config.php
@@ -3,6 +3,9 @@
// Gentoaster web interface settings
// Licensed under GPL v3, see COPYING file
+ // Path to the Gentoaster binaries/resources
+ define("GENTOASTER_PATH", "/usr/share/gentoaster");
+
// Path to the zonetab file
define("ZONETAB", "/usr/share/zoneinfo/zone.tab");
diff --git a/web/index.php b/web/index.php
index 55484d0..b6cb119 100644
--- a/web/index.php
+++ b/web/index.php
@@ -23,12 +23,14 @@
FILTER_VALIDATE_IP
);
- $stmt = $db->prepare("SELECT id FROM builds WHERE ipaddress = ?");
- $stmt->bind_param("s", $ipaddress);
+ $query = "SELECT id, returncode ".
+ "FROM builds WHERE ipaddress = ?";
+ $stmt = $db->prepare($query);
+ $stmt->bind_param("sd", $ipaddress, $returncode);
$stmt->execute();
$stmt->store_result();
- if ($stmt->num_rows == 1) {
+ if ($stmt->num_rows == 1 && $returncode === null) {
$stmt->bind_result($buildID);
$stmt->fetch();
$url = "status.php?uuid=".$buildID."&simultaneous=true";
@@ -57,6 +59,16 @@
foreach ($timezones as $timezone => $description) {
$timezoneOption .= "<option>".$timezone."</option>\n";
}
+ $layoutLines = file(GENTOASTER_PATH."/res/keyboard.lst");
+ $keyboardOption = "";
+
+ foreach($layoutLines as $layout) {
+ $layoutdata = explode("\t", $layout);
+ $keyboardOption .= "<option value=\"".$layoutdata[0]."\">";
+ $keyboardOption .= trim($layoutdata[1])."</option>\n";
+ }
+
+ asort($layouts);
?>
<html>
<head>
@@ -117,7 +129,7 @@
<br />
<select id="locale_keyboard" class="required"
name="keyboard">
- <option>United Kingdom</option>
+ <?php echo $keyboardOption; ?>
</select>
<br>
diff --git a/web/process.php b/web/process.php
index b16f272..c590bee 100644
--- a/web/process.php
+++ b/web/process.php
@@ -51,6 +51,7 @@
$swapMegabytes = filter_input(INPUT_POST, "swap_size", FILTER_VALIDATE_INT);
$rootMegabytes = filter_input(INPUT_POST, "root_size", FILTER_VALIDATE_INT);
$timezone = filter_input(INPUT_POST, "timezone", FILTER_CALLBACK, $sfi);
+ $keyboard = filter_input(INPUT_POST, "keyboard", FILTER_CALLBACK, $sfi);
$hostname = filter_input(INPUT_POST, "hostname", FILTER_CALLBACK, $sfi);
$username = filter_input(INPUT_POST, "username", FILTER_CALLBACK, $sfi);
$password = filter_input(INPUT_POST, "password", FILTER_CALLBACK, $sfi);
@@ -69,6 +70,7 @@ BOOT_MEGABYTES='$bootMegabytes'
SWAP_MEGABYTES='$swapMegabytes'
ROOT_MEGABYTES='$rootMegabytes'
TIMEZONE=$timezone
+KEYBOARD=$keyboard
HOSTNAME=$hostname
ROOT_PASSWORD=$rootPass
DEFAULT_USERNAME=$username