aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2012-06-29 16:01:03 -0300
committermarcelloc <marcellocoutinho@gmail.com>2012-06-29 16:01:03 -0300
commit3c29c5cfe7a8844bb7bea25fe00663208e6cbe2e (patch)
tree1ee0378149b191c7f2923abd37212641cfcce45a
parent6ca5ee6a94a5bb5687a7e70f0cf56f51d45fc9be (diff)
downloadpfsense-packages-3c29c5cfe7a8844bb7bea25fe00663208e6cbe2e.tar.gz
pfsense-packages-3c29c5cfe7a8844bb7bea25fe00663208e6cbe2e.tar.bz2
pfsense-packages-3c29c5cfe7a8844bb7bea25fe00663208e6cbe2e.zip
bacula-client - fix more errors, almost done
-rw-r--r--config/bacula-client/bacula-client.inc154
-rw-r--r--config/bacula-client/bacula-client.xml64
-rw-r--r--config/bacula-client/bacula-client_fd.xml83
-rw-r--r--config/bacula-client/bacula-client_view_config.php7
-rw-r--r--pkg_config.8.xml7
-rw-r--r--pkg_config.8.xml.amd644
6 files changed, 173 insertions, 146 deletions
diff --git a/config/bacula-client/bacula-client.inc b/config/bacula-client/bacula-client.inc
index fd6e2d65..d64dd06b 100644
--- a/config/bacula-client/bacula-client.inc
+++ b/config/bacula-client/bacula-client.inc
@@ -4,7 +4,8 @@
/*
bacula-client.inc
part of pfSense (http://www.pfSense.com)
- Copyright (C) 2012 Marcio Carlos
+ Copyright (C) 2012 Marcio Carlos Braga Antao
+ Copyright (C) 2012 Marcello Coutinho
All rights reserved.
Based on m0n0wall (http://m0n0.ch/wall)
@@ -40,59 +41,7 @@
function baculaclient_custom_php_install_command(){
global $g, $config;
- 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-client.sh for writing.");
- return;
- }
-
- // Ensure bacula-fd has a+rx
- exec("chmod a+rx /usr/local/etc/rc.d/bacula-client.sh");
-
- $baculafd = <<<EOD
-#!/bin/sh
-#
-# $FreeBSD: ports/sysutils/bacula-server/files/bacula-fd.in,v 1.7 2012/01/14 08:56:57 dougb Exp $
-#
-# PROVIDE: bacula_fd
-# REQUIRE: DAEMON
-# KEYWORD: shutdown
-#
-# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
-# to enable this service:
-#
-# bacula_fd_enable (bool): Set to NO by default.
-# Set it to YES to enable bacula_fd.
-# bacula_fd_flags (params): Set params used to start bacula_fd.
-#
-
-. /etc/rc.subr
-
-name="bacula_fd"
-rcvar=bacula_fd_enable
-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"}
-
-pidfile="\${bacula_fd_pidfile}"
-
-run_rc_command "\$1"
-
-EOD;
-
- 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";
- }
+ baculaclient_custom_php_write_config();
}
function baculaclient_custom_php_deinstall_command(){
@@ -104,63 +53,62 @@ function baculaclient_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-client.sh stop");
+ exec("/usr/local/etc/rc.d/bacula-fd.sh stop");
conf_mount_ro();
-
}
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']['baculaclient']['config'])){
- // Mount Read-write
- conf_mount_rw();
- // Make Head
- /*
- $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']['baculaclient']['config'][0]['row'] as $bc) {
- // create 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'];
- }
+ conf_mount_rw();
+ //check config_file
+ $startup_file="/usr/local/etc/rc.d/bacula-fd";
+ if (file_exists($startup_file)){
+ $startup_script=file_get_contents($startup_file);
+ $startup_script=preg_replace("/NO/","YES",$startup_script);
+ file_put_contents("{$startup_file}.sh",$startup_script,LOCK_EX);
+ // Ensure bacula-fd has a+rx
+ exec("chmod a+rx {$startup_file}.sh");
}
-
+
+ //check config
+ if (is_array($config['installedpackages']['baculaclient']['config'])){
+ $baculaclient_conf="";
+ foreach ($config['installedpackages']['baculaclient']['config'] as $bc) {
+ // 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";
+ Break;
+ case "Local":
+ $baculaclient_conf .= "Director { \n\t Name = {$bc['director']}-mon #{$bc['description']}\n\t Password = \"{$bc['password']}\"\n\t Monitor = yes\n\t}\n";
+ break;
+ case "Monitor":
+ $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']}-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}\n";
+ $baculaclient_conf .= "Messages { \n\t Name = Standard \n\t director = {$LocalDirector}-dir = all, !skipped, !restored\n\t \n}\n";
// create FielDaemon
-
- $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);
+
+ if (is_array($config['installedpackages']['baculaclientfd']['config'])){
+ $port = $config['installedpackages']['baculaclientfd']['config'][0]['port'];
+ $jobs = $config['installedpackages']['baculaclientfd']['config'][0]['jobs'];
+ $filedaemon = $config['installedpackages']['baculaclientfd']['config'][0]['name'];
+ }
+ else{
+ $filedaemon="default";
+ $port="9102";
+ $jobs="20";
+ }
+ $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";
+ file_put_contents("/usr/local/etc/bacula-fd.conf",$baculaclient_conf,LOCK_EX);
+ exec("/usr/local/etc/rc.d/bacula-fd.sh restart");
+ // Mount Read-only
+ conf_mount_ro();
+ }
}
-
- exec("/usr/local/etc/rc.d/bacula-client.sh start");
-}
-
- // 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
index 3820944f..12eb48a2 100644
--- a/config/bacula-client/bacula-client.xml
+++ b/config/bacula-client/bacula-client.xml
@@ -1,13 +1,53 @@
<?xml version="1.0" encoding="utf-8" ?>
-<packagegui>
- <copyright>Copyright (C) 2012 Marcio Carlos Braga Antao</copyright>
+<packagegui>
+<copyright>
+ <![CDATA[
+/* $Id$ */
+/* ========================================================================== */
+/*
+ bacula-client.xml
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) Marcio Carlos Braga Antao
+ Copyright (C) 2012 Marcello Coutinho
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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>baculaclient</name>
<version>5.2.6</version>
<title>Bacula-Client: Setting</title>
- <aftersaveredirect>/pkg_edit.php?xml=bacula-client.xml&amp;id=0</aftersaveredirect>
+ <aftersaveredirect>/pkg.php?xml=bacula-client.xml</aftersaveredirect>
<include_file>/usr/local/pkg/bacula-client.inc</include_file>
<configpath>installedpackages->package->baculaclient</configpath>
<additional_files_needed>
@@ -31,6 +71,12 @@
<section>Services</section>
<configfile>bacula-client.xml</configfile>
</menu>
+ <services>
+ <rcfile>bacula-fd.sh</rcfile>
+ <name>Bacula-client</name>
+ <executable>bacula-fd</executable>
+ <description>bacula backup client</description>
+ </services>
<tabs>
<tab>
<text>Directors</text>
@@ -39,8 +85,7 @@
</tab>
<tab>
<text>FileDaemon</text>
- <url>/pkg_edit.php?xml=bacula-client_fd.xml&amp;id=0</url>
-
+ <url>/pkg_edit.php?xml=bacula-client_fd.xml</url>
</tab>
<tab>
<text>View Configuration</text>
@@ -85,19 +130,18 @@
<field>
<fielddescr>Password</fielddescr>
<fieldname>password</fieldname>
- <type>input</type>
+ <type>password</type>
<size>30</size>
<description><![CDATA[Enter password for Diector use to Access.]]></description>
</field>
-
<field>
<fielddescr>Director tyoe</fielddescr>
<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>Director</value></option>
+ <option><name>Local</name><value>Local</value></option>
+ <option><name>Monitor</name><value>Monitor</value></option>
</options>
<description>This is a Local Director?</description>
</field>
diff --git a/config/bacula-client/bacula-client_fd.xml b/config/bacula-client/bacula-client_fd.xml
index 6776838f..be9d3fd8 100644
--- a/config/bacula-client/bacula-client_fd.xml
+++ b/config/bacula-client/bacula-client_fd.xml
@@ -1,36 +1,55 @@
<?xml version="1.0" encoding="utf-8" ?>
<packagegui>
- <copyright>Copyright (C) 2012 Marcio Carlos Braga Antao</copyright>
+ <copyright>
+ <![CDATA[
+/* $Id$ */
+/* ========================================================================== */
+/*
+ bacula-client_df.xml
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2012 Marcio Carlos Braga Antao
+ Copyright (C) 2012 Marcello Coutinho
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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_fd</name>
+ <name>baculaclientfd</name>
<version>5.2.6</version>
<title>Bacula-Client: FileDaemon Setting</title>
- <aftersaveredirect>/pkg_edit.php?xml=bacula-client_fd.xml&amp;id=0</aftersaveredirect>
+ <aftersaveredirect>/pkg_edit.php?xml=bacula-client_fd.xml</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>bacula backup client</tooltiptext>
- <section>Services</section>
- <configfile>bacula-client_fd.xml</configfile>
- </menu>
<tabs>
<tab>
<text>Directors</text>
@@ -38,7 +57,7 @@
</tab>
<tab>
<text>FileDaemon</text>
- <url>/pkg_edit.php?xml=bacula-client_fd.xml&amp;id=0</url>
+ <url>/pkg_edit.php?xml=bacula-client_fd.xml</url>
<active/>
</tab>
<tab>
@@ -48,6 +67,19 @@
</tabs>
<fields>
<field>
+ <type>listtopic</type>
+ <fieldname>Daemon</fieldname>
+ <name>daemon</name>
+ </field>
+ <field>
+ <fielddescr>Daemon name</fielddescr>
+ <fieldname>name</fieldname>
+ <type>input</type>
+ <size>25</size>
+ <description>Name for File Daemon. Default : default </description>
+ <required/>
+ </field>
+ <field>
<fielddescr>File Daemon Port</fielddescr>
<fieldname>port</fieldname>
<type>input</type>
@@ -60,6 +92,7 @@
<fieldname>jobs</fieldname>
<type>input</type>
<size>3</size>
+ <required/>
<description>Maximun Concurrent Jobs. Default : 20</description>
</field>
diff --git a/config/bacula-client/bacula-client_view_config.php b/config/bacula-client/bacula-client_view_config.php
index d0d16dc1..a89f1d48 100644
--- a/config/bacula-client/bacula-client_view_config.php
+++ b/config/bacula-client/bacula-client_view_config.php
@@ -3,7 +3,7 @@
bacula-client_view_config.php
part of pfSense (http://www.pfsense.com/)
Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
- Copyright (C) 2012 Márcio Carlos Antão
+ Copyright (C) 2012 M�rcio Carlos Ant�o
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,8 @@ include("head.inc");
<tr><td>
<?php
$tab_array = array();
- $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=varnish_settings.xml&id=0");
+ $tab_array[] = array(gettext("Directors"), false, "/pkg.php?xml=bacula-client.xml");
+ $tab_array[] = array(gettext("FileDaemon"), false, "/pkg_edit.php?xml=bacula-client_fd.xml");
$tab_array[] = array(gettext("View Configuration"), true, "/bacula-client_view_config.php");
display_top_tabs($tab_array);
?>
@@ -65,7 +66,7 @@ include("head.inc");
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabcont" >
- <textarea id="varnishlogs" rows="50" cols="100%">
+ <textarea id="varnishlogs" rows="50" cols="87%">
<?php
$config_file = file_get_contents("/usr/local/etc/bacula-fd.conf");
echo $config_file;
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 5a3954b0..e3b801cc 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1617,6 +1617,7 @@
<pkginfolink></pkginfolink>
<required_version>2.0</required_version>
<configurationfile>systempatches.xml</configurationfile>
+ </package>
<package>
<name>bacula-client</name>
<pkginfolink>http://www.bacula.org/</pkginfolink>
@@ -1626,9 +1627,9 @@
<version>5.2.6 pkg v 0.2</version>
<status>Beta</status>
<required_version>2.0</required_version>
- <config_file>http:///www.pfsense.com/packages/config/bacula-client/bacula-client.xml</config_file>
- <depends_on_package_base_url>http://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/All/</depends_on_package_base_url>
- <depends_on_package>bacula-client-5.2.6.tbz</depends_on_package>
+ <config_file>http://www.pfsense.com/packages/config/bacula-client/bacula-client.xml</config_file>
+ <depends_on_package_base_url>http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-8.1-release/All/</depends_on_package_base_url>
+ <depends_on_package>bacula-client-5.0.0_1.tbz</depends_on_package>
<build_port_path>/usr/ports/sysutils/bacula-client</build_port_path>
<build_pbi>
<port>sysutils/bacula-client</port>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index af4f8cf4..9a5014fd 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -1604,8 +1604,8 @@
<status>Beta</status>
<required_version>2.0</required_version>
<config_file>http://www.pfsense.com/packages/config/bacula-client/bacula-client.xml</config_file>
- <depends_on_package_base_url>http://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/All/</depends_on_package_base_url>
- <depends_on_package>bacula-client-5.2.6.tbz</depends_on_package>
+ <depends_on_package_base_url>http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-8.1-release/All/</depends_on_package_base_url>
+ <depends_on_package>bacula-client-5.0.0_1.tbz</depends_on_package>
<build_port_path>/usr/ports/sysutils/bacula-client</build_port_path>
<build_pbi>
<port>sysutils/bacula-client</port>