Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
60141e0e01
10 changed files with 153 additions and 123 deletions
|
@ -7,11 +7,11 @@
|
||||||
|
|
||||||
echo "******************************** Install Begin *********************************".PHP_EOL;
|
echo "******************************** Install Begin *********************************".PHP_EOL;
|
||||||
|
|
||||||
require_once(dirname(__FILE__).'/include/installInit.php');
|
require_once(dirname(__FILE__).'/include/AirtimeIni.php');
|
||||||
|
|
||||||
ExitIfNotRoot();
|
AirtimeIni::ExitIfNotRoot();
|
||||||
CreateINIFile();
|
AirtimeIni::CreateIniFile();
|
||||||
UpdateINIFiles();
|
AirtimeIni::UpdateIniFiles();
|
||||||
|
|
||||||
require_once(dirname(__FILE__).'/../application/configs/conf.php');
|
require_once(dirname(__FILE__).'/../application/configs/conf.php');
|
||||||
require_once(dirname(__FILE__).'/include/AirtimeInstall.php');
|
require_once(dirname(__FILE__).'/include/AirtimeInstall.php');
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(dirname(__FILE__).'/include/installInit.php');
|
require_once(dirname(__FILE__).'/include/AirtimeIni.php');
|
||||||
// Need to check that we are superuser before running this.
|
// Need to check that we are superuser before running this.
|
||||||
ExitIfNotRoot();
|
AirtimeIni::ExitIfNotRoot();
|
||||||
|
|
||||||
require_once(dirname(__FILE__).'/../application/configs/conf.php');
|
require_once(dirname(__FILE__).'/../application/configs/conf.php');
|
||||||
require_once(dirname(__FILE__).'/include/AirtimeInstall.php');
|
require_once(dirname(__FILE__).'/include/AirtimeInstall.php');
|
||||||
|
@ -75,7 +75,7 @@ if ($results == 0) {
|
||||||
// Delete files
|
// Delete files
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
AirtimeInstall::DeleteFilesRecursive($CC_CONFIG['storageDir']);
|
AirtimeInstall::DeleteFilesRecursive($CC_CONFIG['storageDir']);
|
||||||
RemoveINIFile();
|
AirtimeIni::RemoveIniFiles();
|
||||||
|
|
||||||
$command = "python ".__DIR__."/../python_apps/pypo/install/pypo-uninstall.py";
|
$command = "python ".__DIR__."/../python_apps/pypo/install/pypo-uninstall.py";
|
||||||
system($command);
|
system($command);
|
||||||
|
|
|
@ -6,27 +6,20 @@
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Do not allow remote execution
|
require_once(dirname(__FILE__).'/include/AirtimeIni.php');
|
||||||
$arr = array_diff_assoc($_SERVER, $_ENV);
|
require_once(dirname(__FILE__).'/include/AirtimeInstall.php');
|
||||||
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
|
|
||||||
header("HTTP/1.1 400");
|
|
||||||
header("Content-type: text/plain; charset=UTF-8");
|
|
||||||
echo "400 Not executable\r\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once(dirname(__FILE__).'/installInit.php');
|
AirtimeIni::ExitIfNotRoot();
|
||||||
|
|
||||||
AirtimeInstall::ExitIfNotRoot();
|
|
||||||
|
|
||||||
echo "******************************** Update Begin *********************************".PHP_EOL;
|
echo "******************************** Update Begin *********************************".PHP_EOL;
|
||||||
AirtimeInstall::UpdateIniValue('../build/build.properties', 'project.home', realpath(__dir__.'/../'));
|
AirtimeIni::CreateIniFile();
|
||||||
|
AirtimeIni::UpdateIniFiles();
|
||||||
|
|
||||||
echo PHP_EOL."*** Updating Database Tables ***".PHP_EOL;
|
echo PHP_EOL."*** Updating Database Tables ***".PHP_EOL;
|
||||||
AirtimeInstall::MigrateTables(__DIR__);
|
AirtimeInstall::MigrateTables(__DIR__);
|
||||||
|
|
||||||
echo PHP_EOL."*** Updating Pypo ***".PHP_EOL;
|
echo PHP_EOL."*** Updating Pypo ***".PHP_EOL;
|
||||||
system("python ".__DIR__."/../pypo/install/pypo-install.py");
|
system("python ".__DIR__."/../python_apps/pypo/install/pypo-install.py");
|
||||||
|
|
||||||
echo "******************************* Update Complete *******************************".PHP_EOL;
|
echo "******************************* Update Complete *******************************".PHP_EOL;
|
||||||
|
|
||||||
|
|
115
install/include/AirtimeIni.php
Normal file
115
install/include/AirtimeIni.php
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Do not allow remote execution
|
||||||
|
$arr = array_diff_assoc($_SERVER, $_ENV);
|
||||||
|
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
|
||||||
|
header("HTTP/1.1 400");
|
||||||
|
header("Content-type: text/plain; charset=UTF-8");
|
||||||
|
echo "400 Not executable\r\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('pg_connect')) {
|
||||||
|
trigger_error("PostgreSQL PHP extension required and not found.", E_USER_ERROR);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
class AirtimeIni{
|
||||||
|
|
||||||
|
static function CreateIniFile(){
|
||||||
|
if (!file_exists("/etc/airtime/")){
|
||||||
|
if (!mkdir("/etc/airtime/", 0755, true)){
|
||||||
|
echo "Could not create /etc/airtime/ directory. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!copy(__DIR__."/../../build/airtime.conf", "/etc/airtime/airtime.conf")){
|
||||||
|
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/../../python_apps/pypo/pypo.cfg", "/etc/airtime/pypo.cfg")){
|
||||||
|
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!copy(__DIR__."/../../python_apps/show-recorder/recorder.cfg", "/etc/airtime/recorder.cfg")){
|
||||||
|
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!copy(__DIR__."/../../python_apps/pypo/scripts/liquidsoap.cfg", "/etc/airtime/liquidsoap.cfg")){
|
||||||
|
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static function RemoveIniFiles(){
|
||||||
|
if (file_exists("/etc/airtime/airtime.conf")){
|
||||||
|
unlink("/etc/airtime/airtime.conf");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists("/etc/airtime/pypo.cfg")){
|
||||||
|
unlink("/etc/airtime/pypo.cfg");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists("/etc/airtime/recorder.cfg")){
|
||||||
|
unlink("/etc/airtime/recorder.cfg");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists("/etc/airtime/liquidsoap.cfg")){
|
||||||
|
unlink("/etc/airtime/liquidsoap.cfg");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists("etc/airtime")){
|
||||||
|
rmdir("/etc/airtime/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static function ExitIfNotRoot()
|
||||||
|
{
|
||||||
|
// Need to check that we are superuser before running this.
|
||||||
|
if(exec("whoami") != "root"){
|
||||||
|
echo "Must be root user.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static function GenerateRandomString($len=20, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
|
||||||
|
{
|
||||||
|
$string = '';
|
||||||
|
for ($i = 0; $i < $len; $i++)
|
||||||
|
{
|
||||||
|
$pos = mt_rand(0, strlen($chars)-1);
|
||||||
|
$string .= $chars{$pos};
|
||||||
|
}
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function UpdateIniValue($filename, $property, $value)
|
||||||
|
{
|
||||||
|
$lines = file($filename);
|
||||||
|
$n=count($lines);
|
||||||
|
for ($i=0; $i<$n; $i++) {
|
||||||
|
if (strlen($lines[$i]) > strlen($property))
|
||||||
|
if ($property == substr($lines[$i], 0, strlen($property))){
|
||||||
|
$lines[$i] = "$property = $value\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp=fopen($filename, 'w');
|
||||||
|
for($i=0; $i<$n; $i++){
|
||||||
|
fwrite($fp, $lines[$i]);
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static function UpdateIniFiles()
|
||||||
|
{
|
||||||
|
$api_key = AirtimeIni::GenerateRandomString();
|
||||||
|
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'api_key', $api_key);
|
||||||
|
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'baseFilesDir', realpath(__DIR__.'/../../files'));
|
||||||
|
AirtimeIni::UpdateIniValue('/etc/airtime/pypo.cfg', 'api_key', "'$api_key'");
|
||||||
|
AirtimeIni::UpdateIniValue('/etc/airtime/recorder.cfg', 'api_key', "'$api_key'");
|
||||||
|
AirtimeIni::UpdateIniValue(__DIR__.'/../../build/build.properties', 'project.home', realpath(__dir__.'/../../'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,100 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Do not allow remote execution
|
|
||||||
$arr = array_diff_assoc($_SERVER, $_ENV);
|
|
||||||
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
|
|
||||||
header("HTTP/1.1 400");
|
|
||||||
header("Content-type: text/plain; charset=UTF-8");
|
|
||||||
echo "400 Not executable\r\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('pg_connect')) {
|
|
||||||
trigger_error("PostgreSQL PHP extension required and not found.", E_USER_ERROR);
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
function CreateINIFile(){
|
|
||||||
if (!file_exists("/etc/airtime/")){
|
|
||||||
if (!mkdir("/etc/airtime/", 0755, true)){
|
|
||||||
echo "Could not create /etc/airtime/ directory. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!copy(__DIR__."/../../build/airtime.conf", "/etc/airtime/airtime.conf")){
|
|
||||||
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (!copy(__DIR__."/../../python_apps/pypo/pypo.cfg", "/etc/airtime/pypo.cfg")){
|
|
||||||
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (!copy(__DIR__."/../../python_apps/show-recorder/recorder.cfg", "/etc/airtime/recorder.cfg")){
|
|
||||||
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!copy(__DIR__."/../../python_apps/pypo/scripts/liquidsoap.cfg", "/etc/airtime/liquidsoap.cfg")){
|
|
||||||
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function RemoveINIFile(){
|
|
||||||
if (file_exists("/etc/airtime/airtime.conf")){
|
|
||||||
unlink("/etc/airtime/airtime.conf");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists("etc/airtime")){
|
|
||||||
rmdir("/etc/airtime/");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function ExitIfNotRoot()
|
|
||||||
{
|
|
||||||
// Need to check that we are superuser before running this.
|
|
||||||
if(exec("whoami") != "root"){
|
|
||||||
echo "Must be root user.\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function GenerateRandomString($len=20, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
|
|
||||||
{
|
|
||||||
$string = '';
|
|
||||||
for ($i = 0; $i < $len; $i++)
|
|
||||||
{
|
|
||||||
$pos = mt_rand(0, strlen($chars)-1);
|
|
||||||
$string .= $chars{$pos};
|
|
||||||
}
|
|
||||||
return $string;
|
|
||||||
}
|
|
||||||
|
|
||||||
function UpdateIniValue($filename, $property, $value)
|
|
||||||
{
|
|
||||||
$lines = file($filename);
|
|
||||||
$n=count($lines);
|
|
||||||
for ($i=0; $i<$n; $i++) {
|
|
||||||
if (strlen($lines[$i]) > strlen($property))
|
|
||||||
if ($property == substr($lines[$i], 0, strlen($property))){
|
|
||||||
$lines[$i] = "$property = $value\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$fp=fopen($filename, 'w');
|
|
||||||
for($i=0; $i<$n; $i++){
|
|
||||||
fwrite($fp, $lines[$i]);
|
|
||||||
}
|
|
||||||
fclose($fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
function UpdateINIFiles()
|
|
||||||
{
|
|
||||||
$api_key = GenerateRandomString();
|
|
||||||
UpdateIniValue('/etc/airtime/airtime.conf', 'api_key', $api_key);
|
|
||||||
UpdateIniValue('/etc/airtime/airtime.conf', 'baseFilesDir', realpath(__DIR__.'/../../files'));
|
|
||||||
UpdateIniValue('/etc/airtime/pypo.cfg', 'api_key', "'$api_key'");
|
|
||||||
UpdateIniValue('/etc/airtime/recorder.cfg', 'api_key', "'$api_key'");
|
|
||||||
UpdateIniValue(__DIR__.'/../../build/build.properties', 'project.home', realpath(__dir__.'/../../'));
|
|
||||||
}
|
|
BIN
public/css/images/icon_finishedplaying_m.png
Normal file
BIN
public/css/images/icon_finishedplaying_m.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
public/css/images/icon_nowplaying_m.png
Normal file
BIN
public/css/images/icon_nowplaying_m.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
public/css/images/icon_soundcloud.png
Normal file
BIN
public/css/images/icon_soundcloud.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
public/css/images/icon_soundcloud_m.png
Normal file
BIN
public/css/images/icon_soundcloud_m.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -1211,6 +1211,10 @@ ul.errors {
|
||||||
margin:0;
|
margin:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.formrow-repeat ul.errors {
|
||||||
|
width:278px;
|
||||||
|
}
|
||||||
|
|
||||||
ul.errors li {
|
ul.errors li {
|
||||||
color:#902d2d;
|
color:#902d2d;
|
||||||
font-size:11px;
|
font-size:11px;
|
||||||
|
@ -1440,7 +1444,7 @@ div.success{
|
||||||
list-style-type:none;
|
list-style-type:none;
|
||||||
margin:0 0 7px 0;
|
margin:0 0 7px 0;
|
||||||
padding:0;
|
padding:0;
|
||||||
height:26px;
|
/*height:26px;*/
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
.formrow-repeat li .ui-button-icon-only {
|
.formrow-repeat li .ui-button-icon-only {
|
||||||
|
@ -1501,7 +1505,10 @@ div.success{
|
||||||
.small-icon.rebroadcast {
|
.small-icon.rebroadcast {
|
||||||
background:url(images/icon_rebroadcast.png) no-repeat 0 0;
|
background:url(images/icon_rebroadcast.png) no-repeat 0 0;
|
||||||
}
|
}
|
||||||
|
.small-icon.soundcloud {
|
||||||
|
background:url(images/icon_soundcloud.png) no-repeat 0 0;
|
||||||
|
width:21px;
|
||||||
|
}
|
||||||
.medium-icon {
|
.medium-icon {
|
||||||
display:block;
|
display:block;
|
||||||
width:25px;
|
width:25px;
|
||||||
|
@ -1511,8 +1518,23 @@ div.success{
|
||||||
}
|
}
|
||||||
.medium-icon.recording {
|
.medium-icon.recording {
|
||||||
background:url(images/icon_record_m.png) no-repeat 0 0;
|
background:url(images/icon_record_m.png) no-repeat 0 0;
|
||||||
|
width:20px;
|
||||||
}
|
}
|
||||||
.medium-icon.rebroadcast {
|
.medium-icon.rebroadcast {
|
||||||
background:url(images/icon_rebroadcast_m.png) no-repeat 0 0;
|
background:url(images/icon_rebroadcast_m.png) no-repeat 0 0;
|
||||||
}
|
}
|
||||||
|
.medium-icon.soundcloud {
|
||||||
|
background:url(images/icon_soundcloud_m.png) no-repeat 0 0;
|
||||||
|
width:21px;
|
||||||
|
}
|
||||||
|
.medium-icon.nowplaying, .medium-icon.finishedplaying {
|
||||||
|
background:url(images/icon_nowplaying_m.png) no-repeat 0 0;
|
||||||
|
width:12px;
|
||||||
|
height:9px;
|
||||||
|
float:left;
|
||||||
|
margin-left:6px;
|
||||||
|
margin-right:0;
|
||||||
|
}
|
||||||
|
.medium-icon.finishedplaying {
|
||||||
|
background:url(images/icon_finishedplaying_m.png) no-repeat 0 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue