Changeset 701

Show
Ignore:
Timestamp:
10/26/05 13:01:30 (7 years ago)
Author:
rcourtna
Message:

add install_amp option to use remote mysql server: --dbhost <ip>

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/AMP-1-10-010/AMP/install_amp

    r698 r701  
    5959  out("  --dry-run                Don't actually do anything"); 
    6060  out("  --force-version <ver>    Force upgrade from version <ver>"); 
     61  out("  --dbhost <ip address>    Use a remote database server"); 
    6162} 
    6263 
     
    391392 */ 
    392393function collect_settings($filename) { 
     394  global $dbhost; 
    393395  out("Creating new /etc/amportal.conf"); 
    394396   
     
    421423      break; 
    422424    } else if (mkdir($amp_conf["AMPWEBROOT"],755)){ 
    423       outn("Created ".$amp_conf["AMPWEBROOT"]}); 
     425      outn("Created ".$amp_conf["AMPWEBROOT"]); 
    424426      break; 
    425427    } else { 
     
    436438      break; 
    437439    } else if (mkdir($amp_conf["FOPWEBROOT"],755)){ 
    438       outn("Created ".$amp_conf["FOPWEBROOT"]}); 
     440      outn("Created ".$amp_conf["FOPWEBROOT"]); 
    439441      break; 
    440442    } else { 
     
    475477      break; 
    476478    } else if (mkdir($amp_conf["AMPBIN"],755)){ 
    477       outn("Created ".$amp_conf["AMPBIN"]}); 
     479      outn("Created ".$amp_conf["AMPBIN"]); 
    478480      break; 
    479481    } else { 
     
    490492      break; 
    491493    } else if (mkdir($amp_conf["AMPSBIN"],755)){ 
    492       outn("Created ".$amp_conf["AMPSBIN"]}); 
     494      outn("Created ".$amp_conf["AMPSBIN"]); 
    493495      break; 
    494496    } else { 
     
    496498    } 
    497499  } while(1); 
     500   
     501  if (isset($dbhost)) { 
     502    $amp_conf["AMPDBHOST"] = $dbhost; 
     503  } else { 
     504    $amp_conf["AMPDBHOST"] = 'localhost'; 
     505  } 
    498506   
    499507  // write amportal.conf 
     
    537545 
    538546$shortopts = "h?u:p:"; 
    539 $longopts = array("help","debug","dry-run","username=","password=","force-version="); 
     547$longopts = array("help","debug","dry-run","username=","password=","force-version=","dbhost="); 
    540548 
    541549$args = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), $shortopts, $longopts); 
     
    575583      out("Forcing upgrade from version ".$version); 
    576584    break; 
     585    case "--dbhost": 
     586      $dbhost = $arg[1]; 
     587      out("Using remote database server at ".$dbhost); 
     588    break; 
    577589  } 
    578590} 
     
    609621out("OK"); 
    610622 
    611 if (isset($new_username) || isset($new_password)) { 
     623if (isset($new_username) || isset($new_password) || isset($dbhost)) { 
    612624  // new username/pwd  
    613625   
     
    617629  if (isset($new_password)) { 
    618630    $amp_conf["AMPDBPASS"] = $new_password; 
     631  } 
     632   
     633  if (isset($dbhost)) { 
     634    $amp_conf["AMPDBHOST"] = $dbhost; 
    619635  } 
    620636   
     
    638654$db_user = $amp_conf["AMPDBUSER"]; 
    639655$db_pass = $amp_conf["AMPDBPASS"]; 
    640 $db_host = 'localhost'
     656$db_host = $amp_conf["AMPDBHOST"]
    641657$db_name = 'asterisk'; 
    642658$db_engine = 'mysql';