aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2015-02-09 12:17:20 -0500
committerjim-p <jimp@pfsense.org>2015-02-09 12:17:20 -0500
commit8f19e12bcf8d47e7311f0cb86f31811538253674 (patch)
treec0bef6c9c82d6a22fe9db66c3f8020512ea09f81 /config
parent785cd2be24936b3ae7e44253417f1e2ff5a70ea5 (diff)
downloadpfsense-packages-8f19e12bcf8d47e7311f0cb86f31811538253674.tar.gz
pfsense-packages-8f19e12bcf8d47e7311f0cb86f31811538253674.tar.bz2
pfsense-packages-8f19e12bcf8d47e7311f0cb86f31811538253674.zip
Some misc fixes for bacula-client to use proper paths for configuration and binaries.
Diffstat (limited to 'config')
-rw-r--r--config/bacula-client/bacula-client.inc37
1 files changed, 20 insertions, 17 deletions
diff --git a/config/bacula-client/bacula-client.inc b/config/bacula-client/bacula-client.inc
index 233de4b6..f14c4e5c 100644
--- a/config/bacula-client/bacula-client.inc
+++ b/config/bacula-client/bacula-client.inc
@@ -38,16 +38,18 @@
/* ========================================================================== */
require_once("config.inc");
require_once("util.inc");
-
+
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
if ($pf_version > 2.0)
define('BACULA_LOCALBASE', '/usr/pbi/bacula-' . php_uname("m"));
else
- define('BACULA_LOCALBASE','/usr/local');
-
+ define('BACULA_LOCALBASE','/usr/local');
+
+define('BACULA_STARTUP_SCRIPT', '/usr/local/etc/rc.d/bacula-fd.sh');
+
function baculaclient_custom_php_install_command(){
global $g, $config;
- baculaclient_custom_php_write_config();
+ baculaclient_custom_php_write_config();
}
function baculaclient_custom_php_deinstall_command(){
@@ -56,10 +58,10 @@ function baculaclient_custom_php_deinstall_command(){
conf_mount_rw();
// 1. Delete our config file
- unlink_if_exists(BACULA_LOCALBASE."/etc/bacula-fd.conf");
+ unlink_if_exists(BACULA_LOCALBASE."/etc/bacula/bacula-fd.conf");
// 2. Re-run sshd config generation script
- exec(BACULA_LOCALBASE . "/etc/rc.d/bacula-fd.sh stop");
+ exec(BACULA_STARTUP_SCRIPT . " stop");
conf_mount_ro();
}
@@ -71,11 +73,12 @@ function baculaclient_custom_php_write_config(){
if (file_exists($startup_file)){
$startup_script=file_get_contents($startup_file);
$startup_script=preg_replace("/NO/","YES",$startup_script);
- $startup_script=preg_replace("@/usr/local/etc/bacula-fd.conf@",BACULA_LOCALBASE."/etc/bacula-fd.conf",$startup_script);
- $startup_script=preg_replace("@" . BACULA_LOCALBASE . "/etc/bacula/bacula-fd.conf@",BACULA_LOCALBASE."/etc/bacula-fd.conf",$startup_script);
- file_put_contents("{$startup_file}.sh",$startup_script,LOCK_EX);
+ $startup_script=preg_replace("@/usr/local/sbin/bacula-fd@",BACULA_LOCALBASE."/sbin/bacula-fd",$startup_script);
+ $startup_script=preg_replace("@/usr/local/etc/bacula-fd.conf@",BACULA_LOCALBASE."/etc/bacula/bacula-fd.conf",$startup_script);
+ $startup_script=preg_replace("@/usr/local/etc/bacula/bacula-fd.conf@",BACULA_LOCALBASE."/etc/bacula/bacula-fd.conf",$startup_script);
+ file_put_contents(BACULA_STARTUP_SCRIPT,$startup_script,LOCK_EX);
// Ensure bacula-fd has a+rx
- exec("chmod a+rx {$startup_file}.sh");
+ exec("chmod a+rx " . BACULA_STARTUP_SCRIPT);
}
//check config
@@ -85,7 +88,7 @@ function baculaclient_custom_php_write_config(){
// create Director
switch ($bc['type']){
case "Director":
- $baculaclient_conf .= "Director { \n\t Name = {$bc['director']}-dir #{$bc['description']}\n\t Password = \"{$bc['password']}\"\n\t}\n";
+ $baculaclient_conf .= "Director { \n\t Name = {$bc['director']}-dir #{$bc['description']}\n\t Password = \"{$bc['password']}\"\n\t}\n";
Break;
case "Monitor":
$baculaclient_conf .= "Director { \n\t Name = {$bc['director']}-mon #{$bc['description']}\n\t Password = \"{$bc['password']}\"\n\t Monitor = yes\n\t}\n";
@@ -95,24 +98,24 @@ function baculaclient_custom_php_write_config(){
$baculaclient_conf .= "Director { \n\t Name = {$bc['director']}-mon #{$bc['description']}\n\t Password = \"{$bc['password']}\"\n\t Monitor = yes\n\t}\n";
$LocalDirector = $bc['director'];
}
-
+
}
-
+
// create Messages
$baculaclient_conf .= "Messages { \n\t Name = Standard \n\t director = {$LocalDirector}-dir = all, !skipped, !restored\n\t}\n";
// create FielDaemon
-
+
if (is_array($config['installedpackages']['baculaclientfd']['config'])){
$port = $config['installedpackages']['baculaclientfd']['config'][0]['port'];
$jobs = $config['installedpackages']['baculaclientfd']['config'][0]['jobs'];
}
else{
$port="9102";
- $jobs="20";
+ $jobs="20";
}
$baculaclient_conf .= "FileDaemon { \n\t Name = {$LocalDirector}-fd #\n\t FDport = {$port}\n\t WorkingDirectory = /var/db/bacula\n\t Pid Directory = /var/run\n\tMaximum Concurrent Jobs = {$jobs}\n\t}\n";
- file_put_contents(BACULA_LOCALBASE."/etc/bacula-fd.conf",$baculaclient_conf,LOCK_EX);
- exec(BACULA_LOCALBASE . "/etc/rc.d/bacula-fd.sh restart");
+ file_put_contents(BACULA_LOCALBASE."/etc/bacula/bacula-fd.conf",$baculaclient_conf,LOCK_EX);
+ exec(BACULA_STARTUP_SCRIPT . " restart");
// Mount Read-only
conf_mount_ro();
}