cc-2055: switch to init.d

-initial upgrade script
This commit is contained in:
martin 2011-06-01 15:28:24 -04:00
parent 4c9c86bf4f
commit d516b963e4
5 changed files with 42 additions and 18 deletions

View File

@ -53,7 +53,11 @@ if(isset($version) && ($version != false) && ($version == AIRTIME_VERSION) && !i
if(isset($version) && ($version != false) && ($version < AIRTIME_VERSION)) {
echo "Airtime version $version found.".PHP_EOL;
require_once("airtime-upgrade.php");
exit(1);
//Make sure to exit with non-zero error code so that airtime-install
//shell script does not continue with installing pypo, show-recorder,
//media-monitor etc.
exit(2);
}
// -------------------------------------------------------------------------

View File

@ -11,10 +11,38 @@ require_once __DIR__.'/../../../airtime_mvc/application/configs/conf.php';
require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php');
require_once(dirname(__FILE__).'/../../include/AirtimeIni.php');
// clean up old files
@unlink('/usr/bin/airtime-pypo-start');
@unlink('/usr/bin/airtime-pypo-stop');
@unlink(dirname(__FILE__).'/../../../python_apps/pypo/airtime-pypo-start');
@unlink(dirname(__FILE__).'/../../../python_apps/pypo/airtime-pypo-stop');
AirtimeInstall::CreateZendPhpLogFile();
/* In version 1.9.0 we have have switched from daemontools to more traditional
* init.d daemon system. Let's remove all the daemontools files
*/
exec("airtime-pypo-stop");
exec("airtime-show-recorder-stop");
exec("airtime-media-monitor-stop");
$pathnames = array("/usr/bin/airtime-pypo-start",
"/usr/bin/airtime-pypo-stop",
"/usr/bin/airtime-show-recorder-start",
"/usr/bin/airtime-show-recorder-stop",
"/usr/bin/airtime-media-monitor-start",
"/usr/bin/airtime-media-monitor-stop",
"/etc/service/pypo",
"/etc/service/pypo-liquidsoap",
"/etc/service/media-monitor",
"/etc/service/recorder",
"/var/log/airtime/pypo/main",
"/var/log/airtime/show-recorder/main"
);
foreach ($pathnames as $pn){
exec("rm -rf ".$pn);
}
/* Run install scripts for pypo, show-recorder and media-monitor.
* This is to install the init.d scripts. */
exec("python ".__DIR__."/../../../python_apps/pypo/install/pypo-install.py");
exec("python ".__DIR__."/../../../python_apps/show-recorder/install/recorder-install.py");
exec("python ".__DIR__."/../../../python_apps/media-monitor/install/media-monitor-install.py");

View File

@ -51,7 +51,7 @@ try:
current_script_dir = get_current_script_dir()
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
p = Popen("/etc/init.d/airtime-media-monitor stop >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
print "Creating log directories"
@ -82,6 +82,4 @@ try:
except Exception, e:
print "exception:" + str(e)
sys.exit(1)

View File

@ -20,8 +20,6 @@ def create_path(path):
if not (os.path.exists(path)):
print "Creating directory " + path
os.makedirs(path)
else:
print "Directory already exists " + path
def copy_dir(src_dir, dest_dir):
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
@ -62,7 +60,7 @@ try:
current_script_dir = get_current_script_dir()
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
p = Popen("/etc/init.d/airtime-playout stop >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
create_path(config["pypo_log_dir"])
@ -111,7 +109,6 @@ try:
os.system("rm -f /usr/bin/airtime-liquidsoap")
os.system("ln -s "+config["bin_dir"]+"/bin/airtime-liquidsoap /usr/bin/")
print "Installing pypo daemon"
shutil.copy(config["bin_dir"]+"/bin/airtime-playout-init-d", "/etc/init.d/airtime-playout")
@ -126,6 +123,5 @@ try:
except Exception, e:
print "exception:" + str(e)
sys.exit(1)

View File

@ -44,7 +44,7 @@ try:
current_script_dir = get_current_script_dir()
p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True)
p = Popen("/etc/init.d/airtime-show-recorder stop >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
print "Creating temporary media storage directory"
@ -80,6 +80,4 @@ try:
except Exception, e:
print "exception:" + str(e)
sys.exit(1)