Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ pgsql-archlog
pgsql-restore
Makefile
.libs

# Editor Backup Files
*~
99 changes: 99 additions & 0 deletions Makefile.bareos
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#
# Makefile for inteos-pgsql-plugin on Linux
#

# Absolute or relative PATH to BAREOS source dir with build libraries and binaries.
BAREOS_SRC =

# Flags & libs
BAREOS_VERSION = $(shell bconsole help 2>&1|grep Version:|awk '{print $$2}')
PGSQL_VERSION = $(shell grep PLUGIN_VERSION pgsql-fd.c|grep define|awk '{print $$3}'|sed 's/"//g')
LIBTOOL = $(BAREOS_SRC)/libtool

plugindir = /usr/lib64/bareos/plugins
sbindir = /usr/sbin
libdir = /usr/lib/bareos
confdir = /etc/bareos

CXX = g++
CFLAGS = -g -Wall -fno-strict-aliasing -fno-exceptions -fPIC
CXXFLAGS = -g -fno-strict-aliasing -fno-exceptions -fno-rtti -Wall -fPIC
LDFLAGS =
BAREOS_H = -I$(BAREOS_SRC)/src -I$(BAREOS_SRC)/src/include -I$(BAREOS_SRC)/src/filed
DB_H = -I/usr/include/postgresql
DB_LIB = /usr/lib
BAREOS_LIBS = -L$(BAREOS_SRC)/src/lib -lbareos
DB_LIBS = -L$(DB_LIB) -R $(DB_LIB) -lpq -lcrypt
INSTALL = /usr/bin/install -c

PGSQLSRC = pgsql-fd.c pgsql-archlog.c pgsql-restore.c pgsqllib.c
PGSQLOBJ = $(PGSQLSRC:.c=.lo)
BACSRC = keylist.c parseconfig.c pluglib.c utils.c
BACOBJ = $(BACSRC:.c=.lo)

all: pgsql Makefile

clean: libtool-clean pgsql-clean
@echo "Cleaning objects ..."
@rm -rf *.o *.lo

%.lo : %.c Makefile
@echo "Compiling $(@:.lo=.c) ..."
@$(LIBTOOL) --silent --tag=CXX --mode=compile $(CXX) $(CXXFLAGS) -c $(@:.lo=.c)

$(BACOBJ): Makefile $(BACSRC)
@echo "Compiling BAClib required $(@:.lo=.c) ..."
@$(LIBTOOL) --silent --tag=CXX --mode=compile $(CXX)$(CXXFLAGS) $(BAREOS_H) -c $(@:.lo=.c)

pgsql: Makefile pgsql-fd.la pgsql-archlog pgsql-restore

$(PGSQLOBJ): Makefile $(PGSQLSRC)
@echo "Compiling PGSQL $(@:.lo=.c) ..."
@$(LIBTOOL) --silent --tag=CXX --mode=compile $(CXX) $(CXXFLAGS) $(BAREOS_H) $(DB_H) -c $(@:.lo=.c)

pgsql-fd.la: pgsql-fd.lo keylist.lo parseconfig.lo pluglib.lo utils.lo
@echo "Building PGSQL $(@:.la=.so) ..."
@$(LIBTOOL) --silent --tag=CXX --mode=link $(CXX) -shared $(LDFLAGS) $^ -o $@ -rpath $(plugindir) -module \
-export-dynamic -avoid-version $(DB_LIBS)

pgsql-archlog: pgsql-archlog.lo parseconfig.lo keylist.lo pgsqllib.lo utils.lo pluglib.lo
@echo "Making $@ ..."
@$(LIBTOOL) --silent --tag=CXX --mode=link $(CXX) -o $@ $^ $(BAREOS_LIBS) $(DB_LIBS)

pgsql-restore: pgsql-restore.lo parseconfig.lo keylist.lo pgsqllib.lo utils.lo pluglib.lo
@echo "Making $@ ..."
@$(LIBTOOL) --silent --tag=CXX --mode=link $(CXX) -o $@ $^ $(BAREOS_LIBS) $(DB_LIBS)

pgsql-clean:
@echo "Cleaning pgsql ..."
@rm -f pgsql-archlog pgsql-restore pgsql-fd.so pgsql-fd.la pgsql-fd.lo

libtool-clean:
@echo "Cleaning libtool ..."
@rm -rf .libs _libs

install-pgsql-fd: pgsql-fd.la
@echo "Installing plugin ... $(^:.la=.so)"
@mkdir -p $(DESTDIR)$(plugindir)
@$(LIBTOOL) --silent --tag=CXX --mode=install $(INSTALL) -m 0750 $^ $(DESTDIR)$(plugindir)
@rm -f $(DESTDIR)$(plugindir)/$^

install-pgsql-utils: pgsql-archlog pgsql-restore
@echo "Installing utils ... $^"
@mkdir -p $(DESTDIR)$(sbindir)
@$(LIBTOOL) --silent --tag=CXX --mode=install $(INSTALL) -m 0755 $^ $(DESTDIR)$(sbindir)

install-pgsql-config: pgsql.conf
@echo "Installing config ... $^"
@mkdir -p $(DESTDIR)$(confdir)
@$(LIBTOOL) --silent --tag=CXX --mode=install $(INSTALL) -m 0640 pgsql.conf $(DESTDIR)$(confdir)/pgsql.conf.example

install-pgsql: install-pgsql-fd install-pgsql-config install-pgsql-utils

install: install-pgsql

package-pgsql: install-pgsql inteos-pgsql.spec
@echo "Package pgsql $(PGSQL_VERSION) for Bacula $(BAREOS_VERSION)"
@tar cjvPf ../pgsql-$(PGSQLVERSION)_$(BAREOSVERSION).tar.bz2 $(DESTDIR)$(confdir)/pgsql.conf.example $(DESTDIR)$(sbindir)/pgsql-archlog $(DESTDIR)$(sbindir)/pgsql-restore $(DESTDIR)$(plugindir)/pgsql-fd.so
@cp ../pgsql-$(PGSQLVERSION)_$(BAREOSVERSION).tar.bz2 /root/rpmbuild/SOURCES
@rpmbuild -bb inteos-pgsql.spec
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pgsql-plugin
contrib-pgsql-plugin
============

PGSQL Plugin is a Bacula File Daemon plugin wich perform PostgreSQL database on-line backup and point-in-time recovery.
PGSQL Plugin is a Bareos File Daemon plugin wich perform PostgreSQL database on-line backup and point-in-time recovery.
2 changes: 0 additions & 2 deletions fdapi.h

This file was deleted.

2 changes: 1 addition & 1 deletion keylist.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define _KEYLIST_H_

#ifndef __WIN32__
#include "bacula.h"
#include "bareos.h"
#endif

#define KEY_NO_ATTR (-1)
Expand Down
2 changes: 1 addition & 1 deletion pgsql-archlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ enum ARCHEXITS {
EXITARCHDSTDIR = 14,
EXITARCHDSTACC = 15,
EXITCATDBTRANS = 16,
EXITARCHERROR = 17,
EXITARCHERROR = 17
};

/*
Expand Down
Loading