aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam McLoughlin <hexxeh@hexxeh.net>2011-08-10 18:39:11 +0100
committerLiam McLoughlin <hexxeh@hexxeh.net>2011-08-10 18:39:11 +0100
commit7f2c98b0d095c5c173fed07a0f8f32d51798d97e (patch)
treefe1d3817c8a221c72c70a0205f8e776e08554ec7
parentAdding GNOME config (diff)
downloadgentoaster-7f2c98b0d095c5c173fed07a0f8f32d51798d97e.tar.gz
gentoaster-7f2c98b0d095c5c173fed07a0f8f32d51798d97e.tar.bz2
gentoaster-7f2c98b0d095c5c173fed07a0f8f32d51798d97e.zip
Combine configs, fix image download path via a new config option, add initscript
-rw-r--r--config.php9
-rwxr-xr-xgentoaster35
-rw-r--r--gentoaster.sql20
-rw-r--r--web/config.php11
-rw-r--r--web/index.php1
-rw-r--r--web/status.php2
6 files changed, 68 insertions, 10 deletions
diff --git a/config.php b/config.php
index c1807fa..96b5728 100644
--- a/config.php
+++ b/config.php
@@ -5,12 +5,19 @@
// Set the publically viewable URL for this Gentoaster instance
define("GENTOASTER_URL", "http://192.168.2.169");
+
+ // Set the publically viewable URL for images to be downloaded
+ // This should point to the same folder as CONFIGURATIONS_PATH
+ define("IMAGES_URL", "http://192.168.2.169/images");
// Set the path that completed images should be stored at
define("CONFIGURATIONS_PATH", "/var/www/gentoaster/images");
// Set the path to the folder the Gentoaster tool is at
- define("GENTOASTER_PATH", "/usr/share/gentoaster");
+ // As long as we're not being used by the WebUI
+ if (!defined("GENTOASTER_PATH")) {
+ define("GENTOASTER_PATH", "/usr/share/gentoaster");
+ }
// Set the name of the image creation tool
define("BUILD_TOOL_NAME", "create_image.sh");
diff --git a/gentoaster b/gentoaster
new file mode 100755
index 0000000..32d7d63
--- /dev/null
+++ b/gentoaster
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+USER=root
+GENTOASTER=/usr/share/gentoaster/daemon.php
+RETVAL=0
+
+start() {
+ echo "Starting Gentoaster"
+ start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/php -- -f $GENTOASTER
+ RETVAL=$?
+}
+stop() {
+ echo "Stopping Gentoaster"
+ killall -q -w -u $USER $GENTOASTER
+ RETVAL=$?
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo "Usage: gentoaster {start|stop|restart}"
+ exit 1
+ ;;
+esac
+exit $RETVAL
+
diff --git a/gentoaster.sql b/gentoaster.sql
new file mode 100644
index 0000000..17034b8
--- /dev/null
+++ b/gentoaster.sql
@@ -0,0 +1,20 @@
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `builds` (
+ `id` varchar(32) NOT NULL,
+ `handle` varchar(32) NOT NULL,
+ `returncode` int(11) DEFAULT NULL,
+ `result` text,
+ `ipaddress` varchar(15) DEFAULT NULL,
+ `email` varchar(50) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `ports` (
+ `id` varchar(32) NOT NULL,
+ `port` int(11) NOT NULL,
+ `pid` int(11) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
diff --git a/web/config.php b/web/config.php
index 38076e8..9c5ef50 100644
--- a/web/config.php
+++ b/web/config.php
@@ -36,13 +36,10 @@
// What should we limit the virtual machine disk size to?
define("MAX_DISK_SIZE", 16384);
- // Set the MySQL access details that should be used
- define("MYSQL_HOSTNAME", "localhost");
- define("MYSQL_USERNAME", "gentoaster");
- define("MYSQL_PASSWORD", "");
- define("MYSQL_DATABASE", "gentoaster");
-
// Set the RECAPTCHA keys that should be used, if enabled
define("RECAPTCHA_ENABLED", false);
define("RECAPTCHA_PUBLIC_KEY", "REPLACE_ME");
- define("RECAPTCHA_PRIVATE_KEY", "REPLACE_ME"); \ No newline at end of file
+ define("RECAPTCHA_PRIVATE_KEY", "REPLACE_ME");
+
+ // Load all the configuration for the daemon, too
+ require_once GENTOASTER_PATH."/config.php"; \ No newline at end of file
diff --git a/web/index.php b/web/index.php
index f46af2b..6bb2f9f 100644
--- a/web/index.php
+++ b/web/index.php
@@ -1,6 +1,5 @@
<?php
require_once "config.php";
- require_once GENTOASTER_PATH."/config.php";
if (RECAPTCHA_ENABLED) {
require_once "recaptcha.php";
diff --git a/web/status.php b/web/status.php
index 69e8afc..bde0ad2 100644
--- a/web/status.php
+++ b/web/status.php
@@ -69,7 +69,7 @@
"What would you like to do now?".
"<br /><br /><center>".
"<table><tr><td>".
- "<a href=\"/gentoaster/".
+ "<a href=\"".IMAGES_URL."/".
$buildID."/".$buildID.
".tar.gz\">".
"<img style=\"padding: 10px;\" ".