Made the process of switching from an old (pre-2.5.2) install to the new version smoother

This commit is contained in:
Duncan Sommerville 2015-01-15 13:48:40 -05:00
parent ee9163fa8e
commit 36c5d22e25
5 changed files with 58 additions and 47 deletions

View File

@ -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">
@ -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"/>

View File

@ -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">

View File

@ -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">
@ -19,12 +24,14 @@
<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!
@ -32,17 +39,20 @@
</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"/>

View File

@ -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
# ----------------------------------------------------------------------

11
install
View File

@ -233,7 +233,11 @@ echo "/ | \ || | \ | | | / Y \| \ "
echo "\____|__ /___||____|_ / |____| |___\____|__ /_______ / "
echo -e " \/ \/ \/ \/ \n"
if [ -f /etc/airtime/airtime.conf ]; then
OLD_CONF=$(grep "[media-monitor]" /etc/airtime/airtime.conf)
if [ -n "${OLD_CONF}" ]; then
set +e
verbose "Stopping airtime services..."
service airtime-playout stop-with-monit
@ -241,8 +245,8 @@ if [ -f /etc/airtime/airtime.conf ]; then
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"
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/
@ -255,9 +259,10 @@ will be moved to /etc/airtime/airtime.conf.bak"
rm -rf /usr/share/airtime
fi
mv /etc/airtime/airtime.conf /etc/airtime/airtime.conf.bak
mv /etc/airtime/airtime.conf /etc/airtime/airtime.conf.tmp
set -e
fi
fi
if [ "$apache" = "f" -a ${_i} -eq 1 ]; then
echo -e "Install default Airtime apache configuration? (Y/n): \c"