Changeset 2700
- Timestamp:
- 10/15/06 11:03:42 (2 years ago)
- Files:
-
- freepbx/trunk/amp_conf/bin/retrieve_conf (modified) (1 diff)
- freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php (modified) (1 diff)
- freepbx/trunk/install_amp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/bin/retrieve_conf
r2684 r2700 269 269 } 270 270 271 // setting engine and version 272 $engine = "asterisk"; 273 //Need a way to know exact asterisk path 274 list ( , $version) = explode(' ', exec("/usr/sbin/asterisk -V"), 2); 271 272 // Write out engine information 273 274 switch ($amp_conf['AMPENGINE']) { 275 case 'asterisk': 276 default: 277 // *** Write to ASTETCDIR/version 278 outn('Writing '.$amp_conf['ASTETCDIR'].'/version..'); 279 $tmpoutput = ''; 280 $tmpout = exec("asterisk -V", $tmpoutput, $exitcode); 281 if ($exitcode != 0) { 282 fatal("Error executing asterisk: be sure Asterisk is installed and in the path"); 283 } 284 if (!$fd = fopen($amp_conf['ASTETCDIR'].'/version','w')) { 285 fatal('Cannot open '.$amp_conf['ASTETCDIR'].'/version for writing'); 286 } 287 fwrite($fd, $tmpout); 288 fclose($fd); 289 // change to read-only 290 chmod($amp_conf['ASTETCDIR'].'/version',0444); 291 out('OK'); 292 break; 293 } 294 295 $engineinfo = engine_getinfo(); 296 // was setting these variables before, assume we still need them 297 $engine = $engineinfo['engine']; 298 $version = $engineinfo['version']; 299 275 300 276 301 // run all of the *_get_config and _hookGet_config functions, which will populate the appropriate objects freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php
r2695 r2700 270 270 switch ($amp_conf['AMPENGINE']) { 271 271 case 'asterisk': 272 $verinfo = exec('asterisk -V');272 $verinfo = file_get_contents($amp_conf['ASTETCDIR'].'/version'); 273 273 if (preg_match('/^Asterisk (\d+(\.\d+)*)(-?(.*))$/', $verinfo, $matches)) { 274 274 return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[4]); freepbx/trunk/install_amp
r2642 r2700 1 1 #!/usr/bin/php -q 2 2 <?php 3 4 define("AMP_CONF", "/etc/amportal.conf"); 5 6 define("ASTERISK_CONF", "/etc/asterisk/asterisk.conf"); 7 8 define("UPGRADE_DIR", dirname(__FILE__)."/upgrades"); 9 3 10 4 11 // define versions. latest version must be last … … 35 42 ); 36 43 37 define("AMP_CONF", "/etc/amportal.conf"); 38 39 define("ASTERISK_CONF", "/etc/asterisk/asterisk.conf"); 40 41 define("UPGRADE_DIR", dirname(__FILE__)."/upgrades"); 44 define("REQ_ASTERISK_VERSION", "1.2"); 42 45 43 46 /********************************************************************************************************************/ … … 782 785 write_amportal_conf(AMP_CONF, $amp_conf); 783 786 784 // **** Check for func_callerid.so - this is only in asterisk 1.2 785 786 outn("Checking for Asterisk 1.2.."); 787 if (!file_exists($amp_conf["ASTMODDIR"]."/func_callerid.so")) { 788 fatal("Asterisk 1.2 is required for this version of freePBX"); 789 } 790 out("OK"); 787 788 // **** Write asterisk version to ASTETCDIR/version 789 790 $tmpoutput = ''; 791 $tmpout = exec("asterisk -V", $tmpoutput, $exitcode); 792 if ($exitcode != 0) { 793 fatal("Error executing asterisk: be sure Asterisk is installed and in the path"); 794 } 795 if (!$fd = fopen($amp_conf['ASTETCDIR'].'/version','w')) { 796 fatal('Cannot open '.$amp_conf['ASTETCDIR'].'/version for writing'); 797 } 798 fwrite($fd, $tmpout); 799 fclose($fd); 800 // change to read-only 801 chmod($amp_conf['ASTETCDIR'].'/version',0444); 802 803 804 // normally this would be the contents of ASTETCDIR/version, but this is for simplicity, as we just read it above 805 $verinfo = $tmpout; 806 807 // **** Check asterisk verison 808 809 outn("Checking for Asterisk ".REQ_ASTERISK_VERSION.".."); 810 if (preg_match('/^Asterisk (\d+(\.\d+)*)(-?(.*))$/', $verinfo, $matches)) { 811 if (version_compare($matches[1], REQ_ASTERISK_VERSION) < 0) { 812 fatal("Asterisk 1.2 is required for this version of freePBX"); 813 } 814 out("OK"); 815 } else { 816 fatal("Could not determine asterisk version (got: \"".$verinfo."\" please report this)"); 817 } 791 818 792 819 // **** Make sure selinux isn't enabled 793 820 794 821 outn("Checking for selinux.."); 822 $tmpoutput = ''; 795 823 $tmpout = exec("selinuxenabled 2>&1", $tmpoutput, $sereturn); 796 824 if ($sereturn == 0) {
