changes for fhs layout for pkgs

This commit is contained in:
Richard Neese 2014-09-13 02:26:14 +00:00
parent 3c3df6dadc
commit c32a09a2e2
2 changed files with 57 additions and 20 deletions

View File

@ -127,8 +127,9 @@ include "root.php";
} }
} }
//copy resources/templates/conf to the freeswitch conf dir //copy resources/templates/conf to the freeswitch conf dir
if (file_exists('/usr/share/fusionpbx/resources/templates/conf')){ // added /examples/ into the string
$src_dir = "/usr/share/fusionpbx/resources/templates/conf"; if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')){
$src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf";
} }
else { else {
@ -141,11 +142,11 @@ include "root.php";
//print_r($install->result); //print_r($install->result);
} }
} }
// added /examples/ into the string
function copy_scripts() { function copy_scripts() {
if (file_exists($this->switch_scripts_dir)) { if (file_exists($this->switch_scripts_dir)) {
if (file_exists('/usr/share/fusionpbx/resources/install/scripts')){ if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){
$src_dir = '/usr/share/fusionpbx/resources/install/scripts'; $src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts';
} }
else { else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'; $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
@ -158,11 +159,18 @@ include "root.php";
chmod($dst_dir, 0774); chmod($dst_dir, 0774);
} }
} }
function copy_sounds() { function copy_sounds() {
if (file_exists($this->switch_sounds_dir)) { if (file_exists($this->switch_sounds_dir)) {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sounds/en/us/callie/custom/'; if (file_exists('/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/')){
$dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/'; $src_dir = '/usr/share/fusionpbx/resources/install/sounds/en/us/callie/custom/';
// changes the output dir for testing
$dst_dir = $this->switch_sounds_dir.'/en/us/fusionpbx/custom/';
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sounds/en/us/callie/custom/';
$dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/';
}
$this->recursive_copy($src_dir, $dst_dir, "-n"); $this->recursive_copy($src_dir, $dst_dir, "-n");
if (is_readable($this->switch_sounds_dir)) { if (is_readable($this->switch_sounds_dir)) {
$this->recursive_copy($src_dir, $dst_dir); $this->recursive_copy($src_dir, $dst_dir);

View File

@ -163,17 +163,21 @@ require_once "resources/functions.php";
if (file_exists('/usr/bin')) { if (file_exists('/usr/bin')) {
$switch_bin_dir = '/usr/bin'; //freeswitch bin directory $switch_bin_dir = '/usr/bin'; //freeswitch bin directory
} }
if (file_exists('/etc/fusionpbx/conf')) { //new
$switch_conf_dir = '/etc/fusionpbx/conf'; if (file_exists('/etc/fusionpbx/switch/conf')) {
$switch_conf_dir = '/etc/fusionpbx/switch/conf';
$switch_extensions_dir = $switch_conf_dir.'/directory'; $switch_extensions_dir = $switch_conf_dir.'/directory';
$switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles'; $switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles';
$switch_dialplan_dir = $switch_conf_dir.'/dialplan'; $switch_dialplan_dir = $switch_conf_dir.'/dialplan';
} }
//old
else {
if (file_exists('/etc/freeswitch/vars.xml')) { if (file_exists('/etc/freeswitch/vars.xml')) {
$switch_conf_dir = '/etc/freeswitch'; $switch_conf_dir = '/etc/freeswitch';
$switch_extensions_dir = $switch_conf_dir.'/directory'; $switch_extensions_dir = $switch_conf_dir.'/directory';
$switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles'; $switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles';
$switch_dialplan_dir = $switch_conf_dir.'/dialplan'; $switch_dialplan_dir = $switch_conf_dir.'/dialplan';
}
} }
if (file_exists('/var/lib/freeswitch/db')) { if (file_exists('/var/lib/freeswitch/db')) {
$switch_db_dir = '/var/lib/freeswitch/db'; $switch_db_dir = '/var/lib/freeswitch/db';
@ -184,21 +188,47 @@ require_once "resources/functions.php";
if (file_exists('/usr/lib/freeswitch/mod')) { if (file_exists('/usr/lib/freeswitch/mod')) {
$switch_mod_dir = '/usr/lib/freeswitch/mod'; $switch_mod_dir = '/usr/lib/freeswitch/mod';
} }
if (file_exists('/usr/share/freeswitch/scripts')) { //new
$switch_scripts_dir = '/usr/share/freeswitch/scripts';
}
if (file_exists('/var/lib/fusionpbx/scripts')) { if (file_exists('/var/lib/fusionpbx/scripts')) {
$switch_scripts_dir = '/var/lib/fusionpbx/scripts'; $switch_scripts_dir = '/var/lib/fusionpbx/scripts';
} }
//old
else {
if (file_exists('/usr/share/freeswitch/scripts')) {
$switch_scripts_dir = '/usr/share/freeswitch/scripts';
}
}
//new
if (file_exists('/usr/share/freeswitch/grammar')) { if (file_exists('/usr/share/freeswitch/grammar')) {
$switch_grammar_dir = '/usr/share/freeswitch/grammar'; $switch_grammar_dir = '/usr/share/freeswitch/grammar';
} }
//old
else {
if (file_exists('/usr/share/freeswitch/grammar')) {
$switch_grammar_dir = '/usr/share/freeswitch/grammar';
}
}
//new
if (file_exists('/var/lib/fusionpbx/storage')) {
$switch_storage_dir = '/var/lib/fusionpbx/storage';
$switch_voicemail_dir = $switch_storage_dir.'/voicemail';
}
else {
//old
if (file_exists('/var/lib/freeswitch/storage')) { if (file_exists('/var/lib/freeswitch/storage')) {
$switch_storage_dir = '/var/lib/freeswitch/storage'; $switch_storage_dir = '/var/lib/freeswitch/storage';
$switch_voicemail_dir = $switch_storage_dir.'/voicemail'; $switch_voicemail_dir = $switch_storage_dir.'/voicemail';
}
} }
//new
if (file_exists('/var/lib/fusionpbx/recordings')) {
$switch_recordings_dir = '/var/lib/fusionpbx/recordings';
}
else {
//old
if (file_exists('/var/lib/freeswitch/recordings')) { if (file_exists('/var/lib/freeswitch/recordings')) {
$switch_recordings_dir = '/var/lib/freeswitch/recordings'; $switch_recordings_dir = '/var/lib/freeswitch/recordings';
}
} }
if (file_exists('/usr/share/freeswitch/sounds')) { if (file_exists('/usr/share/freeswitch/sounds')) {
$switch_sounds_dir = '/usr/share/freeswitch/sounds'; $switch_sounds_dir = '/usr/share/freeswitch/sounds';
@ -211,22 +241,21 @@ require_once "resources/functions.php";
//set the default db_path //set the default db_path
if (strlen($db_path) == 0) { if (strlen($db_path) == 0) {
$db_path = '/var/db/fusionpbx'; $db_path = '/var/db/fusionpbx';
if (!is_readable($db_path)) { mkdir($db_path,0777,true); } if (!is_readable($db_path)) { mkdir($db_path,0774,true); }
} }
//set the other default directories //set the other default directories
$switch_bin_dir = '/usr/local/bin'; //freeswitch bin directory $switch_bin_dir = '/usr/local/bin'; //freeswitch bin directory
$switch_conf_dir = '/usr/local/etc/freeswitch/conf'; $switch_conf_dir = '/usr/local/etc/freeswitch';
$switch_db_dir = '/var/db/freeswitch'; $switch_db_dir = '/var/db/freeswitch';
$switch_log_dir = '/var/log/freeswitch'; $switch_log_dir = '/var/log/freeswitch';
$switch_mod_dir = '/usr/local/lib/freeswitch/mod'; $switch_mod_dir = '/usr/local/lib/freeswitch/mod';
$switch_extensions_dir = $switch_conf_dir.'/directory'; $switch_extensions_dir = $switch_conf_dir.'/directory';
$switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles'; $switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles';
$switch_dialplan_dir = $switch_conf_dir.'/dialplan'; $switch_dialplan_dir = $switch_conf_dir.'/dialplan';
$switch_scripts_dir = '/usr/local/etc/freeswitch/scripts'; $switch_scripts_dir = '/var/cache/freeswitch/scripts';
$switch_grammar_dir = '/usr/local/etc/freeswitch/grammar'; $switch_grammar_dir = '/usr/local/share/freeswitch/grammar';
$switch_storage_dir = '/var/freeswitch'; $switch_storage_dir = '/var/cache/freeswitch/storage';
$switch_voicemail_dir = '/var/spool/freeswitch/voicemail'; $switch_recordings_dir = '/var/cache/freeswitch/recordings';
$switch_recordings_dir = '/var/freeswitch/recordings';
$switch_sounds_dir = '/usr/local/share/freeswitch/sounds'; $switch_sounds_dir = '/usr/local/share/freeswitch/sounds';
} }
elseif (file_exists('/data/freeswitch')) { elseif (file_exists('/data/freeswitch')) {