From 9cefde0b754650de9bc33630c1256f4ad18313e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rcio=20Carlos?= Date: Wed, 27 Jun 2012 17:26:55 -0300 Subject: add package bacula-client For Backup with a bacula 5 a pfsense 2 --- config/bacula-client/bacula-client.inc | 182 +++++++++++++++++++++ config/bacula-client/bacula-client.xml | 149 +++++++++++++++++ config/bacula-client/bacula-client_fd.xml | 120 ++++++++++++++ config/bacula-client/bacula-client_view_config.php | 85 ++++++++++ 4 files changed, 536 insertions(+) create mode 100644 config/bacula-client/bacula-client.inc create mode 100644 config/bacula-client/bacula-client.xml create mode 100644 config/bacula-client/bacula-client_fd.xml create mode 100644 config/bacula-client/bacula-client_view_config.php (limited to 'config/bacula-client') diff --git a/config/bacula-client/bacula-client.inc b/config/bacula-client/bacula-client.inc new file mode 100644 index 00000000..7cb27b1f --- /dev/null +++ b/config/bacula-client/bacula-client.inc @@ -0,0 +1,182 @@ +. + 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. + */ +/* ========================================================================== */ + 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(){ + global $g, $config; + conf_mount_rw(); + $fd = fopen("/usr/local/etc/rc.d/bacula-fd", "w"); + if(!$fd) { + log_error("Could not open /usr/local/etc/rc.d/bacula-fd for writing."); + return; + } + + // Ensure svscan.sh has a+rx + exec("chmod a+rx /usr/local/etc/rc.d/bacula-fd"); + + $bacula-fd = << 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'] + } + } + // 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"; + fwrite($fd, $baculaclient_conf); + fclose($fd); + } +} + + // Mount Read-only + conf_mount_ro(); + + + ?> \ No newline at end of file diff --git a/config/bacula-client/bacula-client.xml b/config/bacula-client/bacula-client.xml new file mode 100644 index 00000000..11ce0641 --- /dev/null +++ b/config/bacula-client/bacula-client.xml @@ -0,0 +1,149 @@ + + + + + + + Copyright (C) 2011 Brian Scholer + 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. + */ +/* ========================================================================== */ + ]]> + + Client Install for Bacula 5.2.6 Backup + Bacula Server Installed in or network + Currently there are no FAQ items provided. + bacula-client + 5.2.6 + Bacula-Client Setting + pkg_edit.php?xml=bacula-client.xml&id=0 + /usr/local/pkg/bacula-client.inc + + /usr/local/pkg/ + 0755 + http://www.pfsense.com/packages/config/bacula-client/bacula-client.inc + + + bacula-client + bacula backup client +
sysutils
+ bacula-client.xml +
+ + + Directors + /pkg.php?xml=bacula-client.xml + + + + FileDaemon + /pkg.php?xml=bacula-client-fd.xml + + + + View Configuration + /bacula-client_view_config.php + + + + + Server Director + director + + + Type + type + + + Description + description + + + + + listtopic + temp + File configuration + + + Director Name + director + input + 60 + Name of director + + + + Description + description + Enter a description for this file. + input + 60 + + + Password + password + input + 30 + + + + + Director tyoe + type + select + + + + + + + This is a Local Director? + + + + bacula-client_custom_php_install_command(); + + + + + bacula-client_settings_post_validate($_POST, &$input_errors); + + + bacula-client_custom_php_write_config() + + + bacula-client_custom_php_write_config() + + + +
\ No newline at end of file diff --git a/config/bacula-client/bacula-client_fd.xml b/config/bacula-client/bacula-client_fd.xml new file mode 100644 index 00000000..98c2dbec --- /dev/null +++ b/config/bacula-client/bacula-client_fd.xml @@ -0,0 +1,120 @@ + + + + + + + + Client Install for Bacula 5.2.6 Backup + Bacula Server Installed in or network + Currently there are no FAQ items provided. + bacula-client + 5.2.6 + Bacula-Client Setting + pkg_edit.php?xml=bacula-client.xml&id=0 + /usr/local/pkg/bacula-client.inc + + /usr/local/pkg/ + 0755 + http://www.pfsense.com/packages/config/bacula-client/bacula-client.inc + + + bacula-client + bacula backup client +
sysutils
+ bacula-client.xml +
+ + + Directors + /pkg.php?xml=bacula-client.xml + + + + FileDaemon + /pkg.php?xml=bacula-client_fd.xml + + + + View Configuration + /bacula-client_view_config.php + + + + + listtopic + temp + File configuration + + + File Daemon Port + port + input + 4 + Port for a File Daemon + + + + WorkingDirectory + dir + Working Directory + input + 60 + + + Maximun Concurrent Jobs + jobs + input + 3 + Maximun Concurrent Jobs + + + + + bacula-client_custom_php_install_command(); + + + + + + + bacula-client_custom_php_write_config() + + + bacula-client_custom_php_write_config() + + + +
\ No newline at end of file diff --git a/config/bacula-client/bacula-client_view_config.php b/config/bacula-client/bacula-client_view_config.php new file mode 100644 index 00000000..d0d16dc1 --- /dev/null +++ b/config/bacula-client/bacula-client_view_config.php @@ -0,0 +1,85 @@ + + Copyright (C) 2012 Márcio Carlos 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. +*/ + +require("guiconfig.inc"); + +$pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); +if(strstr($pfSversion, "1.2")) + $one_two = true; + +$pgtitle = "Bacula-Client: View Configuration"; +include("head.inc"); + +?> + + + + +

+ + + + +
+ +
+ + + + + +
+ +
+
+ + + + +
+ +
+
+
+
+
+ + + \ No newline at end of file -- cgit v1.2.3