aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2012-06-29 10:44:07 -0700
committerMarcello Coutinho <marcellocoutinho@gmail.com>2012-06-29 10:44:07 -0700
commit6ca5ee6a94a5bb5687a7e70f0cf56f51d45fc9be (patch)
tree9a95ff6ce16161b726f05cb01bab40ffb85554de /config
parent3218802e1f1d6cbe4f4f592188b6bd93324c6ed9 (diff)
parentc305afc781e8b61a647b07e5f954af7f87e522cd (diff)
downloadpfsense-packages-6ca5ee6a94a5bb5687a7e70f0cf56f51d45fc9be.tar.gz
pfsense-packages-6ca5ee6a94a5bb5687a7e70f0cf56f51d45fc9be.tar.bz2
pfsense-packages-6ca5ee6a94a5bb5687a7e70f0cf56f51d45fc9be.zip
Merge pull request #272 from djgel/master
Changes in bacula_client ... More functions ... less errors I'll help you to reduce error even more :)
Diffstat (limited to 'config')
-rw-r--r--config/bacula-client/bacula-client.inc112
-rw-r--r--config/bacula-client/bacula-client.xml92
-rw-r--r--config/bacula-client/bacula-client_fd.xml86
3 files changed, 104 insertions, 186 deletions
diff --git a/config/bacula-client/bacula-client.inc b/config/bacula-client/bacula-client.inc
index 7cb27b1f..fd6e2d65 100644
--- a/config/bacula-client/bacula-client.inc
+++ b/config/bacula-client/bacula-client.inc
@@ -1,6 +1,6 @@
<?php
-* ========================================================================== */
+/* ========================================================================== */
/*
bacula-client.inc
part of pfSense (http://www.pfSense.com)
@@ -38,43 +38,20 @@
require_once("config.inc");
require_once("util.inc");
-function restart_bacula-client(){
- //backup /usr/local/etc/bacula-fd.conf before any change
- $etc_bacula-client=" /usr/local/etc/bacula-fd.conf";
- $pfsense_version=preg_replace("/\s/","",file_get_contents("/etc/version"));
- if (!file_exists('/root/'.$pfsense_version.'.bacula-fd.backup')){
- copy ($etc_bacula-client,'/root/'.$pfsense_version.'.bacula-fd.backup');
- }
-
- //patch /usr/local/etc/bacula-fd.conf if need
- $sshd_file=file($etc_bacula-client);
- $sshd_new_file="";
- foreach ($sshd_file as $line){
- if (preg_match('/sshconf .= "Port/',$line)){
- $sshd_new_file.= $line;
- $sshd_new_file.= "\t".'if(file_exists("/etc/ssh/sshd_extra")){$sshconf.=file_get_contents("/etc/ssh/sshd_extra");}'."\n";
- }
- elseif(!preg_match('/sshd_extra/',$line)){
- $sshd_new_file.= $line;
- }
- }
- file_put_contents($etc_sshd,$sshd_new_file,LOCK_EX);
- mwexec_bg($etc_sshd);
- }
-
-function bacula-client_custom_php_install_command(){
+function baculaclient_custom_php_install_command(){
global $g, $config;
- conf_mount_rw();
- $fd = fopen("/usr/local/etc/rc.d/bacula-fd", "w");
+ conf_mount_rw();
+ unlink_if_exists("/usr/local/etc/rc.d/bacula-fd");
+ $fd = fopen("/usr/local/etc/rc.d/bacula-client.sh", "w");
if(!$fd) {
- log_error("Could not open /usr/local/etc/rc.d/bacula-fd for writing.");
+ log_error("Could not open /usr/local/etc/rc.d/bacula-client.sh for writing.");
return;
}
- // Ensure svscan.sh has a+rx
- exec("chmod a+rx /usr/local/etc/rc.d/bacula-fd");
+ // Ensure bacula-fd has a+rx
+ exec("chmod a+rx /usr/local/etc/rc.d/bacula-client.sh");
- $bacula-fd = <<<EOD
+ $baculafd = <<<EOD
#!/bin/sh
#
# $FreeBSD: ports/sysutils/bacula-server/files/bacula-fd.in,v 1.7 2012/01/14 08:56:57 dougb Exp $
@@ -99,22 +76,26 @@ command=/usr/local/sbin/bacula-fd
load_rc_config $name
-: ${bacula_fd_enable="YES"}
-: ${bacula_fd_flags=" -u root -g wheel -v -c /usr/local/etc/bacula-fd.conf"}
-: ${bacula_fd_pidfile="/var/run/bacula-fd.9102.pid"}
+: \${bacula_fd_enable="YES"}
+: \${bacula_fd_flags=" -u root -g wheel -v -c /usr/local/etc/bacula-fd.conf"}
+: \${bacula_fd_pidfile="/var/run/bacula-fd.9102.pid"}
-pidfile="${bacula_fd_pidfile}"
+pidfile="\${bacula_fd_pidfile}"
-run_rc_command "$1"
+run_rc_command "\$1"
EOD;
- fwrite($fd, $bacula-fd);
+ fwrite($fd, $baculafd);
fclose($fd);
conf_mount_ro();
+ if (!is_array($config['installedpackages']['baculaclient'])) {
+ $config['installedpackages']['baculaclient']['config'][0]['ports'] = "9102";
+ $config['installedpackages']['baculaclient']['config'][0]['jobs'] = "20";
}
+}
-function bacula-client_custom_php_deinstall_command(){
+function baculaclient_custom_php_deinstall_command(){
global $g, $config;
conf_mount_rw();
@@ -123,56 +104,59 @@ function bacula-client_custom_php_deinstall_command(){
unlink_if_exists("/usr/local/etc/bacula-fd.conf");
// 2. Re-run sshd config generation script
- exec("/usr/local/etc/rc.d/bacula-fd stop");
-
+ exec("/usr/local/etc/rc.d/bacula-client.sh stop");
conf_mount_ro();
- }
+
+}
-function bacula-client_custom_php_write_config(){
+function baculaclient_custom_php_write_config(){
global $g, $config;
+ exec("/usr/local/etc/rc.d/bacula-client.sh stop");
$fd = fopen("/usr/local/etc/bacula-fd.conf", "w");
if(!$fd) {
log_error("Could not open /usr/local/etc/bacula-fd.conf for writing.");
return;
}
- if (is_array($config['installedpackages']['bacula-client']['config'])){
+ if (is_array($config['installedpackages']['baculaclient']['config'])){
// Mount Read-write
conf_mount_rw();
// Make Head
- $baculaclient_conf .= <<<EOD
- #
- # Default Bacula File Daemon Configuration file
- #
+ /*
+ $baculaclient_conf = <<<EOD
+ # Bacula File Daemon Configuration file
# For Bacula release 5.2.6 (21 February 2012) -- pfsense 2.0.x
- #
# There is not much to change here except perhaps the
- #
# List Directors who are permitted to contact this File daemon
- #
EOD;
+ */
// Read config
- foreach ($config['installedpackages']['bacula-client']['config'] as $baculaclient){
- foreach ($baculaclient['row'] as $bc){
+ foreach ($config['installedpackages']['baculaclient']['config'][0]['row'] as $bc) {
// create Director
- if $bc['type'] < 2
- $baculaclient_conf .= "Director { \n\t Name = $bc['director']-dir #$bc['description']\n\t Password = ".'"'.$bc['password'].'"'."\n}\n";
- if $bc['type'] > 0
- $baculaclient_conf .= "Director { \n\t Name = $bc['director']-mon #$bc['description']\n\t Password = ".'"'.$bc['password'].'"'."\n\t Monitor = yes\n}\n";
- if $bc['type'] = 1
- $LocalDirector = $bc['director']
- }
+ if (strcmp($bc['type'],"0")) {
+ $baculaclient_conf .= "Director { \n\t Name = ".$bc['director']."-dir #".$bc['description']."\n\t Password = ".'"'.$bc['password'].'"'."\n}\n";
+ }
+ if (strcmp($bc['type'],"2")){
+ $baculaclient_conf .= "Director { \n\t Name = ".$bc['director']."-mon #".$bc['description']."\n\t Password = ".'"'.$bc['password'].'"'."\n\t Monitor = yes\n}\n";
+ }
+ if (strcmp($bc['type'],"1")){
+ $baculaclient_conf .= "Director { \n\t Name = ".$bc['director']."-dir #".$bc['description']."\n\t Password = ".'"'.$bc['password'].'"'."\n}\n";
+ $baculaclient_conf .= "Director { \n\t Name = ".$bc['director']."-mon #".$bc['description']."\n\t Password = ".'"'.$bc['password'].'"'."\n\t Monitor = yes\n}\n";
+ $LocalDirector = $bc['director'];
+ }
}
+
// create Messages
$baculaclient_conf .= "Messages { \n\t Name = Standard \n\t director = ".$LocalDirector."-dir = all, !skipped, !restored\n\t \n}\n";
// create FielDaemon
- $port = $config['installedpackages']['bacula-client']['config'][0]['port'];
- $dir = $config['installedpackages']['bacula-client']['config'][0]['dir'];
- $jobs = $config['installedpackages']['bacula-client']['config'][0]['jobs']
- $baculaclient_conf .= "FileDaemon { \n\t Name = $filedaemon-fd #\n\t FDport = $port\n\t WorkingDirectory = $dir\n\t Maximun Concurrent Jobs = $jobs\n \n}\n";
+ $port = $config['installedpackages']['baculaclient']['config'][0]['port'];
+ $jobs = $config['installedpackages']['baculaclient']['config'][0]['jobs'];
+ $baculaclient_conf .= "FileDaemon { \n\t Name = ".$filedaemon."-fd #\n\t FDport = ".$port."\n\t WorkingDirectory = /var/db/bacula\n\t Pid Directory = /var/run\n\t Maximun Concurrent Jobs = ".$jobs."\n \n}\n";
fwrite($fd, $baculaclient_conf);
fclose($fd);
}
+
+ exec("/usr/local/etc/rc.d/bacula-client.sh start");
}
// Mount Read-only
diff --git a/config/bacula-client/bacula-client.xml b/config/bacula-client/bacula-client.xml
index 965e2b60..3820944f 100644
--- a/config/bacula-client/bacula-client.xml
+++ b/config/bacula-client/bacula-client.xml
@@ -1,60 +1,35 @@
<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd">
-<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?>
-<packagegui>
- <copyright>
- <![CDATA[
-/* ========================================================================== */
-/*
- bacula-client.xml
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2012 Marcio Carlos Braga Antao
- All rights reserved.
-*/
-/* ========================================================================== */
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-/* ========================================================================== */
- ]]>
- </copyright>
- <description>Client Install for Bacula 5.2.6 Backup</description>
- <requirements>Bacula Server Installed in or network</requirements>
- <faq>Currently there are no FAQ items provided.</faq>
- <name>bacula-client</name>
+<packagegui>
+ <copyright>Copyright (C) 2012 Marcio Carlos Braga Antao</copyright>
+ <description>Client Install for Bacula 5.2.6 Backup</description>
+ <requirements>Bacula Server Installed in or network</requirements>
+ <faq>Currently there are no FAQ items provided.</faq>
+ <name>baculaclient</name>
<version>5.2.6</version>
- <title>Bacula-Client Setting</title>
- <aftersaveredirect>pkg_edit.php?xml=bacula-client.xml&amp;id=0</aftersaveredirect>
+ <title>Bacula-Client: Setting</title>
+ <aftersaveredirect>/pkg_edit.php?xml=bacula-client.xml&amp;id=0</aftersaveredirect>
<include_file>/usr/local/pkg/bacula-client.inc</include_file>
+ <configpath>installedpackages->package->baculaclient</configpath>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/bacula-client/bacula-client.inc</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/bacula-client/bacula-client_fd.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/bacula-client/bacula-client_view_config.php</item>
+ </additional_files_needed>
<menu>
- <name>Bacula-Client</name>
- <tooltiptext></tooltiptext>
+ <name>Bacula-client</name>
+ <tooltiptext>bacula backup client</tooltiptext>
<section>Services</section>
- <configfile>/pkg_edit.php?xml=bacula-client.xml&amp;id=0</configfile>
+ <configfile>bacula-client.xml</configfile>
</menu>
<tabs>
<tab>
@@ -64,8 +39,8 @@
</tab>
<tab>
<text>FileDaemon</text>
- <url>/pkg.php?xml=bacula-client-fd.xml</url>
- <active/>
+ <url>/pkg_edit.php?xml=bacula-client_fd.xml&amp;id=0</url>
+
</tab>
<tab>
<text>View Configuration</text>
@@ -89,8 +64,8 @@
<fields>
<field>
<type>listtopic</type>
- <fieldname>temp</fieldname>
- <name>File configuration</name>
+ <fieldname>directors</fieldname>
+ <name>Directors</name>
</field>
<field>
<fielddescr>Director Name</fielddescr>
@@ -112,7 +87,7 @@
<fieldname>password</fieldname>
<type>input</type>
<size>30</size>
- <description><![CDATA[Enter password for DIrector use to Access.]]></description>
+ <description><![CDATA[Enter password for Diector use to Access.]]></description>
</field>
<field>
@@ -120,28 +95,25 @@
<fieldname>type</fieldname>
<type>select</type>
<options>
- <option><name>director</name><value>0</value></option>
- <option><name>local</name><value>1</value></option>
- <option><name>monitor</name><value>2</value></option>
-
+ <option><name>director</name><value>0</value></option>
+ <option><name>local</name><value>1</value></option>
+ <option><name>monitor</name><value>2</value></option>
</options>
<description>This is a Local Director?</description>
</field>
</fields>
<custom_php_install_command>
- bacula-client_custom_php_install_command();
+ baculaclient_custom_php_install_command();
</custom_php_install_command>
<custom_php_command_before_form>
</custom_php_command_before_form>
<custom_php_validation_command>
- bacula-client_settings_post_validate($_POST, &amp;$input_errors);
</custom_php_validation_command>
<custom_delete_php_command>
- bacula-client_custom_php_write_config()
</custom_delete_php_command>
<custom_add_php_command>
- bacula-client_custom_php_write_config()
</custom_add_php_command>
<custom_php_resync_config_command>
+ baculaclient_custom_php_write_config();
</custom_php_resync_config_command>
</packagegui> \ No newline at end of file
diff --git a/config/bacula-client/bacula-client_fd.xml b/config/bacula-client/bacula-client_fd.xml
index 98c2dbec..6776838f 100644
--- a/config/bacula-client/bacula-client_fd.xml
+++ b/config/bacula-client/bacula-client_fd.xml
@@ -1,70 +1,44 @@
<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd">
-<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?>
<packagegui>
- <copyright>
- <![CDATA[
-/* ========================================================================== */
-/*
- bacula-client.xml
- part of pfSense (http://www.pfSense.com)
- Copyright (C) 2012 Márcio Carlos Braga Antão
- All rights reserved.
-*/
-/* ========================================================================== */
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-/* ========================================================================== */
- ]]>
- </copyright>
+ <copyright>Copyright (C) 2012 Marcio Carlos Braga Antao</copyright>
<description>Client Install for Bacula 5.2.6 Backup</description>
<requirements>Bacula Server Installed in or network</requirements>
<faq>Currently there are no FAQ items provided.</faq>
- <name>bacula-client</name>
+ <name>bacula-client_fd</name>
<version>5.2.6</version>
- <title>Bacula-Client Setting</title>
- <aftersaveredirect>pkg_edit.php?xml=bacula-client.xml&amp;id=0</aftersaveredirect>
+ <title>Bacula-Client: FileDaemon Setting</title>
+ <aftersaveredirect>/pkg_edit.php?xml=bacula-client_fd.xml&amp;id=0</aftersaveredirect>
<include_file>/usr/local/pkg/bacula-client.inc</include_file>
+ <configpath>installedpackages->package->baculaclient</configpath>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
<item>http://www.pfsense.com/packages/config/bacula-client/bacula-client.inc</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/bacula-client/bacula-client_fd.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/bacula-client/bacula-client_view_config.php</item>
+ </additional_files_needed>
<menu>
- <name>bacula-client</name>
+ <name>Bacula-client</name>
<tooltiptext>bacula backup client</tooltiptext>
- <section>sysutils</section>
- <configfile>bacula-client.xml</configfile>
+ <section>Services</section>
+ <configfile>bacula-client_fd.xml</configfile>
</menu>
<tabs>
<tab>
<text>Directors</text>
<url>/pkg.php?xml=bacula-client.xml</url>
- <active/>
</tab>
<tab>
<text>FileDaemon</text>
- <url>/pkg.php?xml=bacula-client_fd.xml</url>
+ <url>/pkg_edit.php?xml=bacula-client_fd.xml&amp;id=0</url>
<active/>
</tab>
<tab>
@@ -74,47 +48,35 @@
</tabs>
<fields>
<field>
- <type>listtopic</type>
- <fieldname>temp</fieldname>
- <name>File configuration</name>
- </field>
- <field>
<fielddescr>File Daemon Port</fielddescr>
<fieldname>port</fieldname>
<type>input</type>
<size>4</size>
- <description>Port for a File Daemon</description>
+ <description>Port for a File Daemon. Default : 9102 </description>
<required/>
</field>
<field>
- <fielddescr>WorkingDirectory</fielddescr>
- <fieldname>dir</fieldname>
- <description>Working Directory</description>
- <type>input</type>
- <size>60</size>
- </field>
- <field>
<fielddescr>Maximun Concurrent Jobs</fielddescr>
<fieldname>jobs</fieldname>
<type>input</type>
<size>3</size>
- <description>Maximun Concurrent Jobs</description>
+ <description>Maximun Concurrent Jobs. Default : 20</description>
</field>
</fields>
+
<custom_php_install_command>
- bacula-client_custom_php_install_command();
+ baculaclient_custom_php_install_command();
</custom_php_install_command>
<custom_php_command_before_form>
</custom_php_command_before_form>
<custom_php_validation_command>
</custom_php_validation_command>
<custom_delete_php_command>
- bacula-client_custom_php_write_config()
</custom_delete_php_command>
<custom_add_php_command>
- bacula-client_custom_php_write_config()
</custom_add_php_command>
<custom_php_resync_config_command>
+ baculaclient_custom_php_write_config();
</custom_php_resync_config_command>
</packagegui> \ No newline at end of file