-
-
+
+
+
+
\ No newline at end of file
diff --git a/airtime_mvc/build/airtime.example.conf b/airtime_mvc/build/airtime.example.conf
index 65fa586dc..090f4103d 100644
--- a/airtime_mvc/build/airtime.example.conf
+++ b/airtime_mvc/build/airtime.example.conf
@@ -51,20 +51,20 @@ dbpass = airtime
# The default is 5672.
#
# user: The username for the RabbitMQ user.
-# The default is guest.
+# The default is airtime.
#
# password: The password for the RabbitMQ user.
-# The default is guest.
+# The default is airtime.
#
# vhost: The virtual host for the RabbitMQ service database.
-# The default is /.
+# The default is /airtime.
#
[rabbitmq]
host = 127.0.0.1
port = 5672
-user = guest
-password = guest
-vhost = /
+user = airtime
+password = airtime
+vhost = /airtime
#
# ----------------------------------------------------------------------
diff --git a/airtime_mvc/public/css/setup/config-check.css b/airtime_mvc/public/css/setup/config-check.css
new file mode 100644
index 000000000..d535a5dd3
--- /dev/null
+++ b/airtime_mvc/public/css/setup/config-check.css
@@ -0,0 +1,23 @@
+.checklist {
+ overflow: auto;
+ height: 50%;
+}
+
+.caption {
+ padding-left: .5em;
+}
+
+.component {
+ font-weight: bold;
+ width: 20%;
+}
+
+.description, .solution {
+ width: 40%;
+}
+
+.footer {
+ margin: inherit;
+ width: inherit;
+ bottom: 0;
+}
\ No newline at end of file
diff --git a/airtime_mvc/public/css/setup/setup-config.css b/airtime_mvc/public/css/setup/setup-config.css
new file mode 100644
index 000000000..9c5356791
--- /dev/null
+++ b/airtime_mvc/public/css/setup/setup-config.css
@@ -0,0 +1,206 @@
+html {
+ background: -webkit-linear-gradient(midnightblue, black); /* For Safari 5.1 to 6.0 */
+ background: -o-linear-gradient(midnightblue, black); /* For Opera 11.1 to 12.0 */
+ background: -moz-linear-gradient(midnightblue, black); /* For Firefox 3.6 to 15 */
+ background: linear-gradient(midnightblue, black); /* Standard syntax */
+}
+
+body {
+ background: rgba(0,0,0,0); /* Make the bg transparent */
+ color: white;
+ min-width: 400px;
+ width: 30%;
+ height: 100%;
+ text-align: center;
+ margin: auto;
+}
+
+.header {
+ padding-top: 1em;
+ height: 10%;
+ min-height: 75px;
+ text-align: center;
+}
+
+.header strong {
+ float: right;
+}
+
+.logo {
+ margin: auto;
+}
+
+.logo strong {
+ padding-left: .5em;
+ float: left;
+}
+
+#airtimeLogo {
+ padding-top: .7em;
+ float: left;
+}
+
+/* ############################################################################
+ *
+ * Form Styles
+ *
+ * ############################################################################ */
+
+form {
+ width: 80%;
+ margin: auto;
+}
+
+form p {
+ text-align: left;
+ margin-bottom: 1em;
+}
+
+form .form-group {
+ text-align: left;
+}
+
+.viewport {
+ position: absolute;
+ width: 30%;
+ min-width: 400px;
+ height: 89%; /* Keep 1% off of 100 to avoid overflow */
+ overflow-x: hidden;
+ overflow-y: auto;
+}
+
+.form-title {
+ margin: 1em 0;
+}
+
+.form-slider {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+}
+
+.form-control-feedback {
+ display: none;
+}
+
+/* ############################################################################
+ *
+ * Form Help Box Styles
+ *
+ * ############################################################################ */
+
+.help-block.help-message {
+ font-weight:bold;
+ margin-bottom: 15px;
+}
+
+.has-error, .has-error .control-label,
+.has-error .form-control-feedback,
+.has-error .form-control {
+ color: red;
+}
+
+.has-success {
+ color: lawngreen;
+}
+
+/* ############################################################################
+ *
+ * Overlay Styles
+ *
+ * ############################################################################ */
+
+#overlay {
+ display: none;
+ opacity: 0.6;
+ position: absolute;
+ top: 0;
+ left: 0;
+ background-color: #000;
+ width: 100%;
+ height: 100%;
+ z-index: 5000;
+}
+
+#loadingImage {
+ display: none;
+ position: absolute;
+ top: 40%;
+ left: 49%; /* Shave 1% to account for half image width */
+ z-index: 5001;
+}
+
+/* ############################################################################
+ *
+ * Button Styles
+ *
+ * ############################################################################ */
+
+.btn-primary {
+ font-weight: bold;
+}
+
+.btn-disabled {
+ disabled: disabled;
+ visibility: hidden;
+ display: block;
+}
+
+.btn-next {
+ float: right;
+ width: 49%;
+}
+
+.btn-skip {
+ margin-top: .5em;
+ width: 100%;
+}
+
+.btn-back {
+ float: left;
+ width: 49%;
+}
+
+.caret.caret-up {
+ border-top-width: 0;
+ border-bottom: 4px solid #fff;
+}
+
+/* ############################################################################
+ *
+ * Database Settings Form Styles
+ *
+ * ############################################################################ */
+
+#dbSettingsForm {
+ top: 0;
+ width: 99%;
+ position: absolute;
+ float: right;
+}
+
+#dbSettings {
+ overflow: auto;
+}
+
+/* ############################################################################
+ *
+ * RabbitMQ Settings Form Styles
+ *
+ * ############################################################################ */
+
+#rmqSettingsForm {
+ top: 0;
+ left: 100%;
+ width: 99%;
+ position: absolute;
+ float: right;
+}
+
+#rmqSettings {
+ overflow: auto;
+}
+
+#rmqFormBody {
+ display: none;
+}
\ No newline at end of file
diff --git a/airtime_mvc/public/fonts/glyphicons-halflings-regular.eot b/airtime_mvc/public/fonts/glyphicons-halflings-regular.eot
new file mode 100644
index 000000000..4a4ca865d
Binary files /dev/null and b/airtime_mvc/public/fonts/glyphicons-halflings-regular.eot differ
diff --git a/airtime_mvc/public/fonts/glyphicons-halflings-regular.svg b/airtime_mvc/public/fonts/glyphicons-halflings-regular.svg
new file mode 100644
index 000000000..25691af8f
--- /dev/null
+++ b/airtime_mvc/public/fonts/glyphicons-halflings-regular.svg
@@ -0,0 +1,229 @@
+
+
+
\ No newline at end of file
diff --git a/airtime_mvc/public/fonts/glyphicons-halflings-regular.ttf b/airtime_mvc/public/fonts/glyphicons-halflings-regular.ttf
new file mode 100644
index 000000000..67fa00bf8
Binary files /dev/null and b/airtime_mvc/public/fonts/glyphicons-halflings-regular.ttf differ
diff --git a/airtime_mvc/public/fonts/glyphicons-halflings-regular.woff b/airtime_mvc/public/fonts/glyphicons-halflings-regular.woff
new file mode 100644
index 000000000..8c54182aa
Binary files /dev/null and b/airtime_mvc/public/fonts/glyphicons-halflings-regular.woff differ
diff --git a/airtime_mvc/public/index.php b/airtime_mvc/public/index.php
index ef882bd07..41c2b7966 100644
--- a/airtime_mvc/public/index.php
+++ b/airtime_mvc/public/index.php
@@ -9,7 +9,7 @@ function showConfigCheckPage() {
if (!$configRun) {
// This will run any necessary setup we need if
// configuration hasn't been initialized
- airtimeCheckConfiguration();
+ checkConfiguration();
}
require_once(CONFIG_PATH . 'config-check.php');
@@ -47,7 +47,7 @@ if (file_exists(BUILD_PATH . AIRTIME_CONFIG)) {
* If something is improperly configured, show the user a
* configuration checklist page so they know what went wrong
*/
- if (!airtimeCheckConfiguration()) {
+ if (!checkConfiguration()) {
$configRun = true;
showConfigCheckPage();
}
diff --git a/airtime_mvc/public/js/setup/setup-config.js b/airtime_mvc/public/js/setup/setup-config.js
new file mode 100644
index 000000000..113710e8f
--- /dev/null
+++ b/airtime_mvc/public/js/setup/setup-config.js
@@ -0,0 +1,126 @@
+/**
+ * Do some cleanup when we get a success response from a POST request
+ * during setup
+ * @param data the POST request return data
+ */
+function cleanupStep(data, e) {
+ showFeedback(data);
+ // If there are no errors, we can continue with
+ // the installation process
+ if (data.errors.length == 0) {
+ // Call nextSlide from the submit button's context
+ nextSlide.call($(e.target));
+ }
+ removeOverlay();
+}
+
+/**
+ * Display the form feedback when we get POST results
+ * @param data the POST request return data
+ */
+function showFeedback(data) {
+ if (data.errors.length > 0) {
+ $(".help-message").addClass("has-error");
+ $(".form-control-feedback").show();
+ } else {
+ $(".help-message").addClass("has-success");
+ }
+ toggleMessage(data.message);
+ for (var i = 0; i < data.errors.length; i++) {
+ $("#" + data.errors[i]).parent().addClass("has-error has-feedback");
+ }
+}
+
+/**
+ * Reset form feedback when resubmitting
+ */
+function resetFeedback() {
+ $(".form-control-feedback").hide();
+ $("#helpBlock").html("");
+ $(".has-error, .has-feedback").removeClass("has-error has-feedback");
+}
+
+/**
+ * Show the return message from the POST request, then set a timeout to hide it again
+ * @param msg the return message from the POST request
+ */
+function toggleMessage(msg) {
+ /*
+ * Since setting display:none; on this element causes odd behaviour
+ * with bootstrap, hide() the element so we can slide it in.
+ * This is only really only necessary the first time this
+ * function is called after page load.
+ */
+ $(".help-message").hide();
+ $(".help-message").html(msg);
+ $(".help-message").slideDown(200);
+ window.setTimeout(function() {
+ $(".help-message").slideUp(200);
+ }, 3000);
+}
+
+/**
+ * Show the overlay and loading gif
+ */
+function addOverlay() {
+ $("body").append("

");
+}
+
+/**
+ * Remove the overlay and loading gif
+ */
+function removeOverlay() {
+ var overlay = $("#overlay, #loadingImage");
+ $("#loadingImage").fadeOut(250);
+ $("#overlay").fadeOut(500, function() {
+ overlay.remove();
+ });
+}
+
+/**
+ * Fade out the previous setup step and fade in the next one
+ */
+function nextSlide() {
+ $(".btn").attr("disabled", "disabled");
+ $(".form-slider").animate({left: "-=100%"}, 500, function() {
+ $(".btn").removeAttr("disabled");
+ });
+ var stepCount = parseInt($("#stepCount").html());
+ $("#stepCount").html(stepCount + 1);
+}
+
+/**
+ * Fade out the current setup step and fade in the previous one
+ */
+function prevSlide() {
+ $(".btn").attr("disabled", "disabled");
+ $(".form-slider").animate({left: "+=100%"}, 500, function() {
+ $(".btn").removeAttr("disabled");
+ });
+ var stepCount = parseInt($("#stepCount").html());
+ $("#stepCount").html(stepCount - 1);
+}
+
+$(function() {
+ $(".form-slider").draggable({
+ revert: true,
+ axis: 'x',
+ snap: ".viewport",
+ snapMode: "both",
+ });
+
+ window.onresize = function() {
+ var headerHeight = $(".header").outerHeight(),
+ viewport = $(".viewport"),
+ viewportHeight = viewport.outerHeight();
+ // If the viewport would go outside the page bounds,
+ // shrink it to fit the window
+ if (viewportHeight + headerHeight > window.innerHeight) {
+ viewport.css("height", window.innerHeight - headerHeight);
+ }
+ // Otherwise, go back to what we have in the stylesheet
+ else {
+ viewport.css("height", "");
+ }
+ };
+});
diff --git a/airtime_mvc/public/setup/database-setup.php b/airtime_mvc/public/setup/database-setup.php
new file mode 100644
index 000000000..f29355d83
--- /dev/null
+++ b/airtime_mvc/public/setup/database-setup.php
@@ -0,0 +1,146 @@
+validateDatabaseConnection()) {
+ // We know that the user credentials check out, so check if the database exists
+ if ($this->validateDatabaseSettings()) {
+ // The database already exists, so we can just set up the schema
+ if ($this->createDatabaseTables()) {
+ self::$message = "Successfully installed Airtime database to '" . self::$name . "'";
+ } else {
+ self::$message = "Something went wrong setting up the Airtime schema!";
+ }
+ } else {
+ // The database doesn't exist, so check if the user can create databases
+ if ($this->checkUserCanCreateDb()) {
+ // The user can create a database, do it
+ if ($this->createDatabase()) {
+ if ($this->createDatabaseTables()) {
+ self::$message = "Successfully installed Airtime database to '" . self::$name . "'";
+ } else {
+ self::$message = "Something went wrong setting up the Airtime schema!";
+ }
+ } else {
+ self::$message = "There was an error installing the database!";
+ }
+ } // The user can't create databases, so we're done
+ else {
+ self::$message = "No database " . self::$name . " exists; user " . self::$user
+ . " does not have permission to create databases on " . self::$host;
+ }
+ }
+ }
+
+ return array(
+ "message" => self::$message,
+ "errors" => self::$errors,
+ );
+ }
+
+ /**
+ * Check if the user's database connection is valid
+ * @return boolean true if the connection are valid
+ */
+ function validateDatabaseConnection() {
+ // This is pretty redundant, but we need to test both
+ // the existence and the validity of the given credentials
+ exec("export PGPASSWORD=" . self::$pass . " && psql -h "
+ . self::$host . " -U " . self::$user . " 2>&1", $out, $status);
+ foreach ($out as $o) {
+ if (strpos($o, "host name")) {
+ self::$message = "Invalid connection parameters!";
+ self::$errors[] = self::DB_HOST;
+ return false;
+ } else if (strpos($o, "authentication")) {
+ self::$message = "User credentials are invalid!";
+ self::$errors[] = self::DB_USER;
+ self::$errors[] = self::DB_PASS;
+ return false;
+ }
+ }
+ return $status == 0;
+ }
+
+ /**
+ * Check if the database settings and credentials given are valid
+ * @return boolean true if the database given exists and the user is valid and can access it
+ */
+ function validateDatabaseSettings() {
+ exec("export PGPASSWORD=" . self::$pass . " && psql -lqt -h " . self::$host . " -U " . self::$user
+ . "| cut -d \\| -f 1 | grep -w " . self::$name, $out, $status);
+ return $status == 0;
+ }
+
+ /**
+ * Check if the given user has access on the given host to create a new database
+ * @return boolean true if the given user has permission to create a database on the given host
+ */
+ function checkUserCanCreateDb() {
+ exec("export PGPASSWORD=" . self::$pass . " && psql -h " . self::$host . " -U " . self::$user . " -tAc"
+ . "\"SELECT 1 FROM pg_roles WHERE rolname='" . self::$user . "' AND rolcreatedb='t'\"", $out, $status);
+ return $status == 0;
+ }
+
+ /**
+ * Creates the Airtime database using the given credentials
+ * @return boolean true if the database was created
+ */
+ function createDatabase() {
+ exec("export PGPASSWORD=" . self::$pass . " && psql -h " . self::$host . " -U " . self::$user . " -tAc"
+ . "\"CREATE DATABASE " . self::$name . " WITH ENCODING 'UTF8' TEMPLATE template0 OWNER "
+ . self::$user . "\"", $out, $status);
+ return $status == 0;
+ }
+
+ /**
+ * Creates the Airtime database schema using the given credentials
+ * @return boolean true if the database tables were created without error
+ */
+ function createDatabaseTables() {
+ $sqlDir = dirname(dirname(__DIR__)) . "/build/sql/";
+ $files = array("schema.sql", "sequences.sql", "views.sql", "triggers.sql", "defaultdata.sql");
+
+ foreach($files as $f) {
+ try {
+ exec("export PGPASSWORD=" . self::$pass . " && psql -U " . self::$user . " --dbname "
+ . self::$name . " -h " . self::$host . " -f $sqlDir$f 2>/dev/null", $out, $status);
+ } catch(Exception $e) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/airtime_mvc/public/setup/rabbitmq-setup.php b/airtime_mvc/public/setup/rabbitmq-setup.php
new file mode 100644
index 000000000..0dc2334c2
--- /dev/null
+++ b/airtime_mvc/public/setup/rabbitmq-setup.php
@@ -0,0 +1,41 @@
+ $message,
+ "errors" => $errors
+ );
+ }
+
+}
\ No newline at end of file
diff --git a/airtime_mvc/public/setup/setup-functions.php b/airtime_mvc/public/setup/setup-functions.php
new file mode 100644
index 000000000..7273527ad
--- /dev/null
+++ b/airtime_mvc/public/setup/setup-functions.php
@@ -0,0 +1,45 @@
+runSetup());
+ }
+ }
+}
diff --git a/installer/airtime/airtime.conf b/installer/airtime/airtime.conf
deleted file mode 100644
index 7495bd9f3..000000000
--- a/installer/airtime/airtime.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-[database]
-host = localhost
-dbname = airtime
-dbuser = airtime
-dbpass = airtime
-
-[rabbitmq]
-host = 127.0.0.1
-port = 5672
-user = guest
-password = guest
-vhost = /
-
-[general]
-api_key = AAA
-web_server_user = www-data
-airtime_dir = x
-base_url = localhost
-base_port = 80
-base_dir = '/'
-
-;How many hours ahead of time should Airtime playout engine (PYPO)
-;cache scheduled media files.
-cache_ahead_hours = 1
-
-[monit]
-monit_user = guest
-monit_password = airtime
-
-[soundcloud]
-connection_retries = 3
-time_between_retries = 60
diff --git a/installer/install b/installer/install
index 043d9cae6..bcfa5eb8d 100644
--- a/installer/install
+++ b/installer/install
@@ -9,14 +9,18 @@ fi
showhelp () {
echo "Usage: airtime-install [options]
---help|-h Displays usage information."
+--help|-h Displays usage information.
+--apache|-a Installs apache and deploys a basic configuration for Airtime."
exit 0
}
+apache="f"
+
while [ $# -gt 0 ]
do
case "$1" in
(-h|--help) showhelp; exit 0;;
+ (-a|--apache) apache="t";;
(--) shift; break;;
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
@@ -37,54 +41,72 @@ echo " * \/ \/ \/
echo " ****************************************************************"
echo " ____ ______ ____ ____ __________ __ _________ ____ ____ "
-echo " / _ \\\\____ \_/ __ \ / \ / ___/ _ \| | \_ __ \_/ ___\/ __ \ "
+echo -e " / _ \\\\____ \_/ __ \ / \ / ___/ _ \| | \_ __ \_/ ___\/ __ \ "
echo " ( <_> ) |_> > ___/| | \ \___ ( <_> ) | /| | \/\ \__\ ___/ "
echo " \____/| __/ \___ >___| / /____ >____/|____/ |__| \___ >___ > "
echo " |__| \/ \/ \/ \/ \/ "
echo " .___.__ __ __ .__ "
echo "____________ __| _/|__| ____ _____ __ ___/ |_ ____ _____ _____ _/ |_|__| ____ ____ "
-echo "\_ __ \__ \ / __ | | |/ _ \ \__ \ | | \ __\/ _ \ / \\\\__ \\\\ __\ |/ _ \ / \ "
+echo -e "\_ __ \__ \ / __ | | |/ _ \ \__ \ | | \ __\/ _ \ / \\\\__ \\\\ __\ |/ _ \ / \ "
echo " | | \// __ \_/ /_/ | | ( <_> ) / __ \| | /| | ( <_> ) Y Y \/ __ \| | | ( <_> ) | \ "
echo " |__| (____ /\____ | |__|\____/ (____ /____/ |__| \____/|__|_| (____ /__| |__|\____/|___| / "
echo " \/ \/ \/ \/ \/ \/ "
+if [ apache = "t" ]; then
+ echo -e "\n-----------------------------------------------------"
+ echo " * Installing Apache * "
+ echo "-----------------------------------------------------"
+
+ apt-get -y --force-yes install apache2 libapache2-mod-php5
+ set +e
+ apache2 -v | grep "2\.4" > /dev/null
+ apacheversion=$?
+ set -e
+
+ # Apache Config File
+ if [ "$apacheversion" != "1" ]; then
+ airtimeconfigfile="airtime.conf"
+ else
+ airtimeconfigfile="airtime"
+ fi
+
+ if [ ! -f /etc/apache2/sites-available/${airtimeconfigfile} ]; then
+ echo " ## Creating Apache config for Airtime..."
+
+ cp apache/airtime-vhost /etc/apache2/sites-available/${airtimeconfigfile}
+ a2dissite 000-default
+ a2ensite airtime
+ else
+ echo "Apache config for Airtime already exists, skipping"
+ fi
+
+ if [ ! -d /usr/share/airtime/public ]; then
+ echo " ## Creating Apache web root directory..."
+ mkdir -p /usr/share/airtime/public/
+ else
+ echo "Airtime web root directory already exists, skipping"
+ fi
+fi
+
echo -e "\n-----------------------------------------------------"
-echo " * Installing Apache * "
+echo " * Installing PHP * "
echo "-----------------------------------------------------"
-apt-get -y --force-yes install apache2 libapache2-mod-php5
-set +e
-apache2 -v | grep "2\.4" > /dev/null
-apacheversion=$?
-set -e
+apt-get -y --force-yes install php5
-# Apache Config File
-if [ "$apacheversion" != "1" ]; then
- airtimeconfigfile="airtime.conf"
+echo " ## Installing Zend framework..."
+#Debian Squeeze only has zendframework package. Newer versions of Ubuntu have zend-framework package.
+#Ubuntu Lucid has both zendframework and zend-framework. Difference appears to be that zendframework is for
+#1.10 and zend-framework is 1.11
+if [ "$dist" = "Debian" ]; then
+ apt-get -y --force-yes install zendframework
else
- airtimeconfigfile="airtime"
-fi
-
-if [ ! -f /etc/apache2/sites-available/${airtimeconfigfile} ]; then
- echo "Creating Apache config for Airtime..."
-
- cp apache/airtime-vhost /etc/apache2/sites-available/${airtimeconfigfile}
- a2dissite 000-default
- a2ensite airtime
-else
- echo "Apache config for Airtime already exists, skipping"
-fi
-
-if [ ! -d /usr/share/airtime/public ]; then
- echo "Creating Apache web root directory..."
- mkdir -p /usr/share/airtime/public/
-else
- echo "Airtime web root directory already exists, skipping"
+ apt-get -y --force-yes install libzend-framework-php
fi
# PHP Config File for Apache
if [ ! -f /etc/php5/apache2/airtime.ini ]; then
- echo "Creating Airtime PHP config for Apache..."
+ echo " ## Creating Airtime PHP config for Apache..."
cp php/airtime.ini /etc/php5/apache2/conf.d/airtime.ini
else
echo "Airtime PHP config for Apache already exists, skipping"
@@ -95,44 +117,38 @@ a2enmod rewrite php5
service apache2 restart
echo -e "\n-----------------------------------------------------"
-echo " * Installing PHP * "
+echo " * Installing PostgreSQL * "
echo "-----------------------------------------------------"
-apt-get -y --force-yes install php5
-
-#Debian Squeeze only has zendframework package. Newer versions of Ubuntu have zend-framework package.
-#Ubuntu Lucid has both zendframework and zend-framework. Difference appears to be that zendframework is for
-#1.10 and zend-framework is 1.11
-if [ "$dist" = "Debian" ]; then
- apt-get -y --force-yes install zendframework
-else
- apt-get -y --force-yes install libzend-framework-php
-fi
+apt-get -y --force-yes install postgresql php5-pgsql
echo -e "\n-----------------------------------------------------"
-echo " * Setting up Airtime * "
+echo " * Setting up RabbitMQ * "
echo "-----------------------------------------------------"
-# Clear any previous configuration files
-if [ -d "/etc/airtime/" ]; then
- rm -rf /etc/airtime/*
-else
- mkdir /etc/airtime
+apt-get -y --force-yes install rabbitmq-server
+
+RABBITMQ_VHOST=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^vhost/ ) print $2}' ../airtime_mvc/build/airtime.example.conf)
+RABBITMQ_USER=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^user/ ) print $2}' ../airtime_mvc/build/airtime.example.conf)
+RABBITMQ_PASSWORD=$(awk -F ' = ' '{if (! ($0 ~ /^;/) && $0 ~ /^password/ ) print $2}' ../airtime_mvc/build/airtime.example.conf)
+EXCHANGES="airtime-pypo|pypo-fetch|airtime-media-monitor|media-monitor"
+
+rabbitmqctl list_vhosts | grep -w ${RABBITMQ_VHOST}
+RESULT="$?"
+
+if [ ${RESULT} != "0" ]; then
+ echo " ## Creating RabbitMQ user $RABBITMQ_USER"
+
+ rabbitmqctl add_vhost ${RABBITMQ_VHOST}
+ rabbitmqctl add_user ${RABBITMQ_USER} ${RABBITMQ_PASSWORD}
+ rabbitmqctl set_permissions -p ${RABBITMQ_VHOST} ${RABBITMQ_USER} "$EXCHANGES" "$EXCHANGES" "$EXCHANGES"
fi
-cp airtime/airtime.conf /etc/airtime/airtime.conf
-chown -R www-data:www-data /etc/airtime
-
-if [ ! -d "/var/log/airtime" ]; then
- mkdir /var/log/airtime
-fi
-
-chown -R www-data:www-data /var/log/airtime
-apt-get -y --force-yes install postgresql php5-pgsql php5-mysql
-
echo -e "\n-----------------------------------------------------"
echo " * Basic Setup DONE! * "
echo " "
echo " To get started with Airtime, visit localhost:5000 "
+echo " or, if you've set up your own web configuration, "
+echo " the Airtime webroot on your webserver "
echo " in your web browser of choice "
echo "-----------------------------------------------------"