Changeset 13054 for freepbx/branches
- Timestamp:
- 12/09/11 11:18:20 (1 year ago)
- Files:
-
- freepbx/branches/2.10/install_amp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/branches/2.10/install_amp
r12996 r13054 80 80 foreach ($file as $line) { 81 81 if (preg_match("/^\s*([a-zA-Z0-9]+)\s*=\s*(.*)\s*([;#].*)?/",$line,$matches)) { 82 $conf[ $matches[1] ] = $matches[2]; 82 83 // TODO: force booleans into 0/1 this should be ok given the limited number of configuration values 84 // 85 switch (trim(strtolower($matches[2]))) { 86 case 'false': 87 case 'no': 88 case 'off': 89 case '0': 90 $conf[$matches[1]] = '0'; 91 case 'true': 92 case 'yes': 93 case 'on': 94 case '1': 95 $conf[$matches[1]] = '1'; 96 default: 97 $conf[$matches[1]] = $matches[2]; 98 break; 99 } 83 100 } 84 101 } … … 95 112 if ( !isset($conf["AMPENGINE"]) || ($conf["AMPENGINE"] == "")) { 96 113 $conf["AMPENGINE"] = "asterisk"; 114 } 115 out("parsed amp_conf variables from $filename:"); 116 foreach ($conf as $keyword => $value) { 117 out("amp_conf [$keyword] => [$value]"); 97 118 } 98 119 … … 577 598 // **** Parse out command-line options 578 599 $shortopts = "h?u:p:"; 579 $longopts = array("help","debug","dry-run","username=","password=","force-version=","dbhost=","no-files","force-overwrite","dbname=","my-svn-is-correct","engine=","webroot=","install-moh","install-fop=","make-links-devel","dev-links","skip-module-install","uid=","gid=","scripted","freepbxip=","asteriskip=" );600 $longopts = array("help","debug","dry-run","username=","password=","force-version=","dbhost=","no-files","force-overwrite","dbname=","my-svn-is-correct","engine=","webroot=","install-moh","install-fop=","make-links-devel","dev-links","skip-module-install","uid=","gid=","scripted","freepbxip=","asteriskip=","set-freepbx-settings"); 580 601 581 602 $args = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), $shortopts, $longopts); … … 595 616 $make_links = false; 596 617 $module_install = true; 618 $set_freepbx_settings = false; 597 619 598 620 //initialize variables to avoid php notices … … 660 682 case "--install-moh": 661 683 $install_moh = true; 684 break; 685 case "--set-freepbx-settings": 686 $set_freepbx_settings = true; 662 687 break; 663 688 case "--fopwebroot": … … 753 778 // **** Check for amportal.conf, create if necessary 754 779 780 // TODO: Check if freepbx_settings has been setup, if so then we don't even want to mess with ampportal.conf, that 781 // should only be first time install. 782 // 755 783 outn("Checking for ".AMP_CONF.".."); 756 784 if (!file_exists(AMP_CONF)) { … … 1073 1101 } 1074 1102 1075 // **** Apply amportal.conf configuration to files1076 if (file_exists(dirname(__FILE__)."/apply_conf.sh")) {1077 debug("Running ".dirname(__FILE__)."/apply_conf.sh");1078 }1079 1103 1080 1104 // Ensure executables are executable … … 1108 1132 outn("no freepbx_engine.."); 1109 1133 } 1134 // TODO: we just did this above 1110 1135 if (file_exists($amp_conf["AMPBIN"]."/freepbx_setting")) { 1111 1136 exec("chmod 755 ".$amp_conf["AMPBIN"]."/freepbx_setting"); … … 1134 1159 // reload manager in asterisk if it is running: 1135 1160 // 1136 outn("apply username/password changes to conf files..");1137 1161 if (file_exists(dirname(__FILE__)."/apply_conf.sh")) { 1162 out("apply username/password changes to conf files:"); 1163 debug("Running ".dirname(__FILE__)."/apply_conf.sh"); 1164 $apply_conf_out = array(); 1138 1165 if ($force_amportal_conf) { 1166 out("running apply_conf.sh from " . AMP_CONF); 1139 1167 putenv('FORCE_AMPORTAL_CONF=1'); 1140 exec(dirname(__FILE__)."/apply_conf.sh ".AMP_CONF );1168 exec(dirname(__FILE__)."/apply_conf.sh ".AMP_CONF, $apply_conf_out); 1141 1169 putenv('FORCE_AMPORTAL_CONF='); 1142 1170 } else { 1143 exec(dirname(__FILE__)."/apply_conf.sh"); 1171 out("running apply_conf.sh from freepbx_settings"); 1172 exec(dirname(__FILE__)."/apply_conf.sh", $apply_conf_out); 1144 1173 } 1145 } 1146 out("done"); 1174 foreach ($apply_conf_out as $line) { 1175 out($line); 1176 } 1177 unset($apply_conf_out); 1178 out("done with apply_conf.sh"); 1179 } 1147 1180 1148 1181 /* As of Asterisk 1.4.16 or there about, a missing #include file will make the reload fail. So … … 1229 1262 out("..OK"); 1230 1263 1264 // TODO: if file is $force_amportal_conf let's go set any settings in freepbx_settings, 1265 // question is, should we do this further up??? 1266 // 1267 if ($set_freepbx_settings && $force_amportal_conf) { 1268 out("Setting freepbx settings form " . AMP_CONF); 1269 $freepbx_conf =& freepbx_conf::create(); 1270 foreach ($amp_conf as $keyword => $value) { 1271 if ($freepbx_conf->conf_setting_exists($keyword)) { 1272 $freepbx_conf->set_conf_values(array($keyword => $value),true,true); 1273 out("freepbx setting [$keyword] set to [$value]"); 1274 } else { 1275 out("freepbx setting [$keyword] DOES NOT EXIST, can't set to [$value]"); 1276 } 1277 } 1278 } 1279 1231 1280 // **** Generate AMP configs 1232 1281 out("Generating AMP configs..");
