Workaround for comment character conflict between python ConfigObj and PHP

This commit is contained in:
Duncan Sommerville 2015-01-16 10:22:43 -05:00
parent 04a1d82172
commit 75306936c0
3 changed files with 18 additions and 12 deletions

View File

@ -91,7 +91,7 @@ class MediaSetup extends Setup {
*/
function moveAirtimeConfig() {
return copy(AIRTIME_CONF_TEMP_PATH, self::AIRTIME_CONF_PATH)
&& unlink(AIRTIME_CONF_TEMP_PATH);
&& unlink(AIRTIME_CONF_TEMP_PATH);
}
/**

View File

@ -40,7 +40,13 @@ abstract class Setup {
$inSection = false;
}
if ($inSection) {
if (substr(trim($line), 0, 1) == "#") {
/* Workaround to strip comments from airtime.conf.
* We need to do this because python's ConfigObj and PHP
* have different (and equally strict) rules about comment
* characters in configuration files.
*/
} else if ($inSection) {
$key = trim(@substr($line, 0, strpos($line, "=")));
$fileOutput .= $key && isset($properties[$key]) ? $key . " = " . $properties[$key] . "\n" : $line;
} else {

20
install
View File

@ -240,9 +240,9 @@ if [ -f /etc/airtime/airtime.conf ]; then
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
loudCmd "service airtime-playout stop-with-monit"
loudCmd "service airtime-media-monitor stop-with-monit"
loudCmd "service airtime-liquidsoap stop-with-monit"
verbose "...Done"
echo "Looks like you have an old version of Airtime. Your current /etc/airtime/airtime.conf \
@ -284,7 +284,7 @@ returncode=$?
set -e
if [ "$returncode" != "0" ]; then
echo "deb http://apt.sourcefabric.org/ $code main" >> /etc/apt/sources.list
apt-get update
loudCmd "apt-get update"
fi
verbose "...Done"
@ -387,7 +387,7 @@ cp -R ${AIRTIMEROOT}/python_apps/media-monitor/media-monitor2 /usr/lib/airtime/m
verbose "...Done"
verbose "\n * Installing media-monitor..."
python ${AIRTIMEROOT}/python_apps/media-monitor/setup.py install
loudCmd "python ${AIRTIMEROOT}/python_apps/media-monitor/setup.py install"
verbose "...Done"
verbose "\n * Copying pypo files..."
@ -396,20 +396,20 @@ cp -R ${AIRTIMEROOT}/python_apps/pypo/pypo /usr/lib/airtime/pypo/bin/
verbose "...Done"
verbose "\n * Installing pypo..."
python ${AIRTIMEROOT}/python_apps/pypo/setup.py install
loudCmd "python ${AIRTIMEROOT}/python_apps/pypo/setup.py install"
verbose "...Done"
verbose "\n * Creating liquidsoap symlink..."
ln -sf /usr/bin/liquidsoap /usr/bin/airtime-liquidsoap
verbose "...Done"
for i in /etc/init/airtime*; do
for i in /etc/init/airtime*.template; do
chmod 644 $i
sed -i "s/WEB_USER/${web_user}/g" $i
mv $i ${i%.template}
done
initctl reload-configuration
loudCmd "initctl reload-configuration"
if [ ! -d /var/log/airtime ]; then
loud "\n-----------------------------------------------------"
@ -553,13 +553,13 @@ for i in `ls /usr/share/airtime/locale | grep ".._.."`; do
verbose "$i.UTF-8 UTF-8" >> /etc/locale.gen
fi
else
locale-gen "$i.utf8"
loudCmd "locale-gen \"$i.utf8\""
fi
done
set -e
if [ "$dist" = "Debian" ]; then
/usr/sbin/locale-gen
loudCmd "/usr/sbin/locale-gen"
fi
if [ "$install_dependencies" = "t" ]; then