Merge branch '2.0.x' into devel
Conflicts: VERSION airtime_mvc/application/models/Systemstatus.php install_minimal/include/airtime-constants.php install_minimal/include/airtime-upgrade.php python_apps/api_clients/api_client.py python_apps/media-monitor/install/media-monitor-copy-files.py python_apps/media-monitor/install/media-monitor-initialize.py python_apps/pypo/install/pypo-initialize.py python_apps/pypo/liquidsoap_bin python_apps/pypo/pypopush.py utils/airtime-log.php
This commit is contained in:
commit
f96b990275
23 changed files with 121 additions and 30 deletions
8
CREDITS
8
CREDITS
|
@ -1,3 +1,11 @@
|
|||
=======
|
||||
CREDITS
|
||||
=======
|
||||
Version 2.0.3
|
||||
-------------
|
||||
Same as previous version.
|
||||
|
||||
|
||||
=======
|
||||
CREDITS
|
||||
=======
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2.0.3 - April 3rd, 2012
|
||||
* Bug Fixes:
|
||||
* monit user should have read-only permissions by default
|
||||
* pypo user's shell should be /bin/false by default
|
||||
|
||||
2.0.2 - February 28, 2012
|
||||
* Bug Fixes:
|
||||
* Fixed Airtime could stop automatically playing after 24 hours if the web interface isn't used (regression in 2.0.1).
|
||||
|
@ -8,6 +13,7 @@
|
|||
* Other
|
||||
* Various optimizations to make Airtime feel snappier in the browser. Various views should
|
||||
load much quicker.
|
||||
|
||||
2.0.1 - February 14, 2012
|
||||
* Changes:
|
||||
* Widgets should have a version string so users can make sure widgets are up to date
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Check if root user
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -33,7 +33,7 @@ class AirtimeInstall
|
|||
public static function ExitIfNotRoot()
|
||||
{
|
||||
// Need to check that we are superuser before running this.
|
||||
if(exec("whoami") != "root"){
|
||||
if(posix_geteuid() != 0){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#-e Causes bash script to exit if any of the installers
|
||||
#return with a non-zero return value.
|
||||
|
||||
if [ `whoami` != 'root' ]; then
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Please run as root user."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -11,7 +11,7 @@ require_once(__DIR__.'/airtime-constants.php');
|
|||
require_once(dirname(__FILE__).'/AirtimeIni.php');
|
||||
require_once(dirname(__FILE__).'/AirtimeInstall.php');
|
||||
|
||||
if(exec("whoami") != "root"){
|
||||
if(posix_geteuid() != 0){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
@ -111,9 +111,12 @@ if (strcmp($version, "2.0.2") < 0){
|
|||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.2/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
if (strcmp($version, "2.0.3") < 0){
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.3/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
if (strcmp($version, "2.1.0") < 0){
|
||||
passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.1.0/airtime-upgrade.php");
|
||||
pause();
|
||||
}
|
||||
|
||||
//set the new version in the database.
|
||||
|
|
75
install_minimal/upgrades/airtime-2.0.3/airtime-upgrade.php
Normal file
75
install_minimal/upgrades/airtime-2.0.3/airtime-upgrade.php
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Airtime
|
||||
* @subpackage StorageServer
|
||||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
|
||||
/*
|
||||
* In the future, most Airtime upgrades will involve just mutating the
|
||||
* data that is stored on the system. For example, The only data
|
||||
* we need to preserve between versions is the database, /etc/airtime, and
|
||||
* /srv/airtime. Everything else is just binary files that can be removed/replaced
|
||||
* with the new version of Airtime. Of course, the data may need to be in a new
|
||||
* format, and that's what this upgrade script will be for.
|
||||
*/
|
||||
|
||||
class AirtimeStorWatchedDirsUpgrade{
|
||||
|
||||
public static function start(){
|
||||
}
|
||||
}
|
||||
|
||||
/* This class deals with any modifications to config files in /etc/airtime
|
||||
* as well as backups. All functions other than start() should be marked
|
||||
* as private. */
|
||||
class AirtimeConfigFileUpgrade{
|
||||
|
||||
public static function start(){
|
||||
}
|
||||
}
|
||||
|
||||
/* This class deals with any modifications to config files in /etc/airtime
|
||||
* as well as backups. All functions other than start() should be marked
|
||||
* as private. */
|
||||
class AirtimeMiscUpgrade{
|
||||
|
||||
public static function start(){
|
||||
self::modifyPypo();
|
||||
self::modifyMonitPassword();
|
||||
self::updateMonitConfFiles();
|
||||
}
|
||||
|
||||
public static function modifyPypo(){
|
||||
echo "* Modifying User Pypo".PHP_EOL;
|
||||
exec("usermod -s /bin/false pypo");
|
||||
exec("passwd --delete pypo");
|
||||
}
|
||||
|
||||
public static function modifyMonitPassword(){
|
||||
echo "* Generating Monit password".PHP_EOL;
|
||||
copy(__DIR__."/monit-airtime-generic.cfg", "/etc/monit/conf.d/monit-airtime-generic.cfg");
|
||||
$pass = self::GenerateRandomString(10);
|
||||
exec("sed -i 's/\$admin_pass/$pass/g' /etc/monit/conf.d/monit-airtime-generic.cfg");
|
||||
}
|
||||
|
||||
public static function updateMonitConfFiles(){
|
||||
echo "* Updating Monit Conf Files".PHP_EOL;
|
||||
@unlink("/etc/monit/conf.d/monit-airtime-show-recorder.cfg");
|
||||
}
|
||||
|
||||
public static function GenerateRandomString($p_len=20, $p_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
|
||||
{
|
||||
$string = '';
|
||||
for ($i = 0; $i < $p_len; $i++)
|
||||
{
|
||||
$pos = mt_rand(0, strlen($p_chars)-1);
|
||||
$string .= $p_chars{$pos};
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
AirtimeConfigFileUpgrade::start();
|
||||
AirtimeMiscUpgrade::start();
|
|
@ -0,0 +1,6 @@
|
|||
set daemon 10 # Poll at 10 second intervals
|
||||
set logfile /var/log/monit.log
|
||||
|
||||
set httpd port 2812
|
||||
allow admin:$admin_pass
|
||||
allow guest:airtime read-only
|
|
@ -11,13 +11,7 @@ def create_user(username):
|
|||
if (output[0:3] != "uid"):
|
||||
# Make the pypo user
|
||||
print " * Creating user "+username
|
||||
os.system("adduser --system --quiet --group --shell /bin/bash "+username)
|
||||
|
||||
#set pypo password
|
||||
p = os.popen('/usr/bin/passwd pypo 1>/dev/null 2>&1', 'w')
|
||||
p.write('pypo\n')
|
||||
p.write('pypo\n')
|
||||
p.close()
|
||||
os.system("adduser --system --quiet --group "+username)
|
||||
else:
|
||||
print "User already exists."
|
||||
#add pypo to audio group
|
||||
|
|
|
@ -50,7 +50,6 @@ try:
|
|||
#copy monit files
|
||||
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True)
|
||||
|
||||
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
|
||||
#create log dir
|
||||
|
|
|
@ -9,7 +9,7 @@ if os.geteuid() != 0:
|
|||
try:
|
||||
print "Waiting for media-monitor processes to stop...",
|
||||
if (os.path.exists('/etc/init.d/airtime-media-monitor')):
|
||||
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
|
||||
p = Popen("invoke-rc.d airtime-media-monitor stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
print "OK"
|
||||
else:
|
||||
|
|
|
@ -29,7 +29,7 @@ try:
|
|||
print 'Error loading config file: ', e
|
||||
sys.exit(1)
|
||||
|
||||
os.system("/etc/init.d/airtime-media-monitor stop")
|
||||
os.system("invoke-rc.d airtime-media-monitor stop")
|
||||
os.system("rm -f /etc/init.d/airtime-media-monitor")
|
||||
os.system("update-rc.d -f airtime-media-monitor remove >/dev/null 2>&1")
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@ def create_dir(path):
|
|||
def get_rand_string(length=10):
|
||||
return ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(length))
|
||||
|
||||
def get_rand_string(length=10):
|
||||
return ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(length))
|
||||
|
||||
PATH_INI_FILE = '/etc/airtime/pypo.cfg'
|
||||
|
||||
try:
|
||||
|
|
|
@ -224,10 +224,6 @@ class PypoPush(Thread):
|
|||
problem_start_time = queue_item['start']
|
||||
break
|
||||
iteration+=1
|
||||
|
||||
|
||||
|
||||
|
||||
return (problem_at_iteration, problem_start_time)
|
||||
|
||||
|
||||
|
|
|
@ -33,8 +33,9 @@ class AirtimeCheck {
|
|||
public static function ExitIfNotRoot()
|
||||
{
|
||||
// Need to check that we are superuser before running this.
|
||||
$user = exec("whoami");
|
||||
if($user != "root" && $user != "www-data"){
|
||||
$euid = posix_geteuid();
|
||||
$user = posix_getlogin();
|
||||
if($euid != 0 && $user != "www-data"){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ logging.disable(50)
|
|||
# add ch to logger
|
||||
logger.addHandler(ch)
|
||||
|
||||
if (commands.getoutput("whoami") != 'root'):
|
||||
if (os.geteuid() != 0):
|
||||
print 'Must be a root user.'
|
||||
sys.exit()
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ array_filter($log_files, "file_exists");
|
|||
function exitIfNotRoot()
|
||||
{
|
||||
// Need to check that we are superuser before running this.
|
||||
if(exec("whoami") != "root"){
|
||||
if(posix_geteuid() != 0){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
|||
function exitIfNotRoot()
|
||||
{
|
||||
// Need to check that we are superuser before running this.
|
||||
if(exec("whoami") != "root"){
|
||||
if(posix_geteuid() != 0){
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue