From 75306936c0cce2a0d0f708ef7ca52d553d31648d Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Fri, 16 Jan 2015 10:22:43 -0500 Subject: [PATCH] Workaround for comment character conflict between python ConfigObj and PHP --- airtime_mvc/public/setup/media-setup.php | 2 +- airtime_mvc/public/setup/setup-functions.php | 8 +++++++- install | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/airtime_mvc/public/setup/media-setup.php b/airtime_mvc/public/setup/media-setup.php index 40c0f6312..f7f979a09 100644 --- a/airtime_mvc/public/setup/media-setup.php +++ b/airtime_mvc/public/setup/media-setup.php @@ -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); } /** diff --git a/airtime_mvc/public/setup/setup-functions.php b/airtime_mvc/public/setup/setup-functions.php index 115245b84..36d96265e 100644 --- a/airtime_mvc/public/setup/setup-functions.php +++ b/airtime_mvc/public/setup/setup-functions.php @@ -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 { diff --git a/install b/install index 27df41902..74426e5fd 100755 --- a/install +++ b/install @@ -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