Skip to content

Commit

Permalink
Made the process of switching from an old (pre-2.5.2) install to the …
Browse files Browse the repository at this point in the history
…new version smoother
  • Loading branch information
dpsommer committed Jan 15, 2015
1 parent ee9163f commit 36c5d22
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 47 deletions.
17 changes: 13 additions & 4 deletions airtime_mvc/build/airtime-setup/forms/database-settings.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?php
$tempConfigPath = "/etc/airtime/airtime.conf.tmp";
if (file_exists($tempConfigPath)) {
$airtimeConfig = parse_ini_file($tempConfigPath, true);
$db = $airtimeConfig["database"];
}
?>

<form action="#" role="form" id="dbSettingsForm">
Expand All @@ -10,22 +15,26 @@
</p>
<div class="form-group">
<label class="control-label" for="dbUser">Username</label>
<input required class="form-control" type="text" name="dbUser" id="dbUser" placeholder="Username" value="airtime"/>
<input required class="form-control" type="text" name="dbUser" id="dbUser" placeholder="Username"
value=<?php echo (isset($db) ? $db["dbuser"] : "airtime"); ?>/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<div class="form-group">
<label class="control-label" for="dbPass">Password</label>
<input required class="form-control" type="password" name="dbPass" id="dbPass" placeholder="Password" value="airtime"/>
<input required class="form-control" type="password" name="dbPass" id="dbPass" placeholder="Password"
value=<?php echo (isset($db) ? $db["dbpass"] : "airtime"); ?>/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<div class="form-group">
<label class="control-label" for="dbName">Name</label>
<input required class="form-control" type="text" name="dbName" id="dbName" placeholder="Name" value="airtime"/>
<input required class="form-control" type="text" name="dbName" id="dbName" placeholder="Name"
value=<?php echo (isset($db) ? $db["dbname"] : "airtime"); ?>/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<div class="form-group">
<label class="control-label" for="dbHost">Host</label>
<input required class="form-control" type="text" name="dbHost" id="dbHost" placeholder="Host" value="localhost"/>
<input required class="form-control" type="text" name="dbHost" id="dbHost" placeholder="Host"
value=<?php echo (isset($db) ? $db["host"] : "localhost"); ?>/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<input class="form-control" type="hidden" name="dbErr" id="dbErr" aria-describedby="helpBlock"/>
Expand Down
4 changes: 4 additions & 0 deletions airtime_mvc/build/airtime-setup/forms/finish-settings.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php
$tempConfigPath = "/etc/airtime/airtime.conf.tmp";
if (file_exists($tempConfigPath)) {
rename($tempConfigPath, "/etc/airtime/airtime.conf.bak");
}
?>

<form action="#" role="form" id="finishSettingsForm">
Expand Down
20 changes: 15 additions & 5 deletions airtime_mvc/build/airtime-setup/forms/rabbitmq-settings.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?php
$tempConfigPath = "/etc/airtime/airtime.conf.tmp";
if (file_exists($tempConfigPath)) {
$airtimeConfig = parse_ini_file($tempConfigPath, true);
$rmq = $airtimeConfig["rabbitmq"];
}
?>

<form action="#" role="form" id="rmqSettingsForm">
Expand All @@ -19,30 +24,35 @@
<div id="rmqFormBody">
<div class="form-group">
<label class="control-label" for="rmqUser">Username</label>
<input required class="form-control" type="text" name="rmqUser" id="rmqUser" placeholder="Username" value="airtime"/>
<input required class="form-control" type="text" name="rmqUser" id="rmqUser" placeholder="Username"
value=<?php echo (isset($rmq) ? $rmq["user"] : "airtime"); ?>/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<div class="form-group">
<label class="control-label" for="rmqPass">Password</label>
<input class="form-control" type="password" name="rmqPass" id="rmqPass" placeholder="Password" value="airtime"/>
<input class="form-control" type="password" name="rmqPass" id="rmqPass" placeholder="Password"
value=<?php echo (isset($rmq) ? $rmq["password"] : "airtime"); ?>/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
<span id="rmqHelpBlock" class="help-block">
You probably want to change this!
</span>
</div>
<div class="form-group">
<label class="control-label" for="rmqHost">Host</label>
<input required class="form-control" type="text" name="rmqHost" id="rmqHost" placeholder="Host" value="127.0.0.1"/>
<input required class="form-control" type="text" name="rmqHost" id="rmqHost" placeholder="Host"
value=<?php echo (isset($rmq) ? $rmq["host"] : "127.0.0.1"); ?>/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<div class="form-group">
<label class="control-label" for="rmqPort">Port</label>
<input required class="form-control" type="text" name="rmqPort" id="rmqPort" placeholder="Port" value="5672"/>
<input required class="form-control" type="text" name="rmqPort" id="rmqPort" placeholder="Port"
value=<?php echo (isset($rmq) ? $rmq["port"] : "5672"); ?>/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<div class="form-group">
<label class="control-label" for="rmqVHost">Virtual Host</label>
<input required class="form-control" type="text" name="rmqVHost" id="rmqVHost" placeholder="VHost" value="/airtime"/>
<input required class="form-control" type="text" name="rmqVHost" id="rmqVHost" placeholder="VHost"
value=<?php echo (isset($rmq) ? $rmq["vhost"] : "/airtime"); ?>/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<input class="form-control" type="hidden" name="rmqErr" id="rmqErr" aria-describedby="helpBlock"/>
Expand Down
17 changes: 0 additions & 17 deletions airtime_mvc/build/airtime.example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,6 @@ vhost = /airtime
# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
# M O N I T
# ----------------------------------------------------------------------
#
# monit_user: The username for the Monit user.
# The default is guest.
#
# monit_password: The password for the Monit user.
# The default is airtime.
#
[monit]
monit_user = guest
monit_password = airtime
#
# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
# M E D I A M O N I T O R
# ----------------------------------------------------------------------
Expand Down
47 changes: 26 additions & 21 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -233,30 +233,35 @@ echo "/ | \ || | \ | | | / Y \| \ "
echo "\____|__ /___||____|_ / |____| |___\____|__ /_______ / "
echo -e " \/ \/ \/ \/ \n"


if [ -f /etc/airtime/airtime.conf ]; then
set +e
verbose "Stopping airtime services..."
service airtime-playout stop-with-monit
service airtime-media-monitor stop-with-monit
service airtime-liquidsoap stop-with-monit
verbose "...Done"

echo "Existing Airtime installation detected. Your current /etc/airtime/airtime.conf \
will be moved to /etc/airtime/airtime.conf.bak"
# If we don't remove the existing python files in /usr/lib and the
# /etc/init.d startup scripts, services won't work properly
rm -rf /usr/lib/airtime/
rm /etc/init.d/airtime-*
# If the user selects an "in-place" install or passes in a web root,
# we need to replace the old apache airtime.conf
rm /etc/apache2/sites-available/airtime.conf
OLD_CONF=$(grep "[media-monitor]" /etc/airtime/airtime.conf)

if [ -d /usr/share/airtime -a web_root = /usr/share/airtime ]; then
rm -rf /usr/share/airtime
if [ -n "${OLD_CONF}" ]; then
set +e
verbose "Stopping airtime services..."
service airtime-playout stop-with-monit
service airtime-media-monitor stop-with-monit
service airtime-liquidsoap stop-with-monit
verbose "...Done"

echo "Looks like you have an old version of Airtime. Your current /etc/airtime/airtime.conf \
will be moved to /etc/airtime/airtime.conf.tmp"
# If we don't remove the existing python files in /usr/lib and the
# /etc/init.d startup scripts, services won't work properly
rm -rf /usr/lib/airtime/
rm /etc/init.d/airtime-*
# If the user selects an "in-place" install or passes in a web root,
# we need to replace the old apache airtime.conf
rm /etc/apache2/sites-available/airtime.conf

if [ -d /usr/share/airtime -a web_root = /usr/share/airtime ]; then
rm -rf /usr/share/airtime
fi

mv /etc/airtime/airtime.conf /etc/airtime/airtime.conf.tmp
set -e
fi

mv /etc/airtime/airtime.conf /etc/airtime/airtime.conf.bak
set -e
fi

if [ "$apache" = "f" -a ${_i} -eq 1 ]; then
Expand Down

0 comments on commit 36c5d22

Please sign in to comment.