Ticket #1283: install_amp.without-fop-option.patch

File install_amp.without-fop-option.patch, 4.6 kB (added by splat, 6 years ago)
  • install_amp

    old new  
    7777  out("  --dbname databasename    Use database name specified, instead of 'asterisk'"); 
    7878  out("  --username <user>        Use <user> to connect to db and write config"); 
    7979  out("  --password <pass>        Use <pass> to connect to db and write config"); 
     80  out("  --without-fop            Don't Install Flash Operator Panel"); 
    8081/*  out("  --fopwebroot <path>      Web path where fop will be installed"); 
    8182  out("  --webroot <path>         Web root where freepbx will be installed"); 
    8283  out("  --cgibin <path>          Path where cgi-bin's lives"); 
     
    252253  global $check_md5s; 
    253254  global $amp_conf; 
    254255  global $asterisk_conf; 
     256  global $withfop; 
    255257   
    256258  if ($dirsource && ($dirsource[0] != "/")) $dirsource = "/".$dirsource; 
    257259   
     
    270272       
    271273      // configurable in amportal.conf 
    272274      if (strpos($destination,"htdocs_panel")) { 
    273         $destination=str_replace("/htdocs_panel",trim($amp_conf["FOPWEBROOT"]),$destination); 
     275        if ($withfop != "No") 
     276        { 
     277          $destination=str_replace("/htdocs_panel",trim($amp_conf["FOPWEBROOT"]),$destination); 
     278        } 
    274279      } else { 
    275280        $destination=str_replace("/htdocs",trim($amp_conf["AMPWEBROOT"]),$destination); 
    276281      } 
    277       $destination=str_replace("/htdocs_panel",trim($amp_conf["FOPWEBROOT"]),$destination); 
     282      if ($withfop != "No") 
     283      { 
     284        $destination=str_replace("/htdocs_panel",trim($amp_conf["FOPWEBROOT"]),$destination); 
     285      } 
    278286//      $destination=str_replace("/cgi-bin",trim($amp_conf["AMPCGIBIN"]),$destination); 
    279287      $destination=str_replace("/bin",trim($amp_conf["AMPBIN"]),$destination); 
    280288      $destination=str_replace("/sbin",trim($amp_conf["AMPSBIN"]),$destination); 
     
    466474/** Collect AMP settings 
    467475 */ 
    468476function collect_settings($filename, $dbhost = '', $dbuser = '', $dbpass = '', $dbname = 'asterisk') { 
     477  global $withfop; 
    469478  out("Creating new $filename"); 
    470479   
    471480  outn("Enter your USERNAME to connect to the '$dbname' database:\n [".($dbuser ? $dbuser : "asteriskuser")."] "); 
     
    516525  if (preg_match('/^$/',$key)) $amp_conf["AMPWEBADDRESS"] = "xx.xx.xx.xx"; 
    517526  else $amp_conf["AMPWEBADDRESS"] = $key; 
    518527   
    519   outn("Enter a PASSWORD to perform call transfers with the Flash Operator Panel:\n [passw0rd] "); 
    520   $key = trim(fgets(STDIN,1024)); 
    521   if (preg_match('/^$/',$key)) $amp_conf["FOPPASSWORD"] = "passw0rd"; 
    522   else $amp_conf["FOPPASSWORD"] = $key; 
    523    
     528  if ($withfop != "No") 
     529  { 
     530    outn("Enter a PASSWORD to perform call transfers with the Flash Operator Panel:\n [passw0rd] "); 
     531    $key = trim(fgets(STDIN,1024)); 
     532    if (preg_match('/^$/',$key)) $amp_conf["FOPPASSWORD"] = "passw0rd"; 
     533    else $amp_conf["FOPPASSWORD"] = $key; 
     534  } 
     535 
    524536  outn("Use simple Extensions [extensions] admin or separate Devices and Users [deviceanduser]?\n [extensions] "); 
    525537  $key = trim(fgets(STDIN,1024)); 
    526538  if (preg_match('/^$/',$key)) $amp_conf["AMPEXTENSIONS"] = "extensions"; 
     
    593605 
    594606// **** Parse out command-line options 
    595607$shortopts = "h?u:p:"; 
    596 $longopts = array("help","debug","dry-run","username=","password=","force-version=","dbhost=","no-files","dbname=","my-svn-is-correct","engine"); 
     608$longopts = array("help","debug","dry-run","username=","password=","without-fop","force-version=","dbhost=","no-files","dbname=","my-svn-is-correct","engine"); 
    597609 
    598610$args = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), $shortopts, $longopts); 
    599611if (is_object($args)) { 
     
    612624$dbname = null;  
    613625$new_username = null; 
    614626$new_password = null; 
     627$withfop = null; 
    615628 
    616629foreach ($args[0] as $arg) { 
    617630  switch ($arg[0]) { 
     
    635648      out("Using password: ".str_repeat("*",strlen($arg[1]))); 
    636649      $new_password = $arg[1]; 
    637650    break; 
     651    case "--without-fop": 
     652      out("Not Installing Flash Operator Panel"); 
     653      $withfop = "No"; 
     654    break; 
    638655    case "--force-version": 
    639656      $version = $arg[1]; 
    640657      out("Forcing upgrade from version ".$version); 
     
    10311048out("Generating AMP configs..OK"); 
    10321049 
    10331050// **** Bounce FOP 
    1034 outn("Restarting Flash Operator Panel.."); 
    1035 exec('su - asterisk -c "'.$amp_conf["AMPWEBROOT"].'/admin/bounce_op.sh"'); 
    1036 out("OK"); 
     1051if ($withfop != "No") 
     1052
     1053  outn("Restarting Flash Operator Panel.."); 
     1054  exec('su - asterisk -c "'.$amp_conf["AMPWEBROOT"].'/admin/bounce_op.sh"'); 
     1055  out("OK"); 
     1056
    10371057 
    10381058$version = install_getversion(); 
    10391059$filename = $amp_conf["AMPWEBROOT"]."/admin/version.txt";